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
├── 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
├── team/ # Data layer of the team management page
├── blogs/ # Blog-related database operations
└── .../ # OthersTeams
Since v4.0.0 the boilerplate ships team support built on the Better Auth organization plugin: the organization as a billing subject, a shared credit pool, seat management and email invitations. See Teams and Organizations.
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 (Legacy)
Learn how to track user registration sources in NEXTY.DEV and customize the referral system for your needs.
User Source
Introduction to NEXTY.DEV's built-in user source and attribution methods and secondary development guide.
Login Rate Limiting
Introduction to NEXTY.DEV's built-in login rate limiting configuration methods and secondary development guide.
Teams and Organizations
Team support built on the Better Auth organization plugin — workspaces, seats, the invitation flow, the shared credit pool and the organization deletion guard