Menu

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.