User Authentication and Database
Prerequisites
Before starting to develop new features, please ensure you have completed the following prerequisites:
Architecture Overview
lib/auth/
├── auth-client.ts # Better-auth client definition
├── index.ts # Better-auth core configuration
└── server.ts # Server-side common methods, including: get session, check if current user is admin
lib/db/
├── migrations/ # Migration files generated by `npm run db:generate` command
├── seed/ # Built-in seed data and scripts from the boilerplate
├── config.ts # Database parameter configuration, automated processing
├── index.ts # Drizzle ORM configuration entry point
└── schema.ts # Database table definitions
components/auth/
├── AuthGuard.tsx # Route guard, protects routes that require login access and admin-only routes
├── GoogleOneTap.tsx # Google One Tap login script
├── LoginDialog.tsx # Login modal dialog
└── LoginForm.tsx # Login form
actions/
├── users/ # User-related database operations
├── blogs/ # Blog-related database operations
└── .../ # Others
The following documentation will expand on the current architecture.
Auth Guide
This guide will help you understand the specific implementation and development usage of login authorization features in the Nexty.dev boilerplate.
Database Operations
Detailed guide on database operation methods and best practices.
Database Development Examples
Detailed introduction to developing products based on Nexty.dev, how to vibe coding create and update databases.
User Source Tracking
Learn how to track user registration sources in Nexty.dev and customize the referral system for your needs.