Better Auth Setup and Configuration
Configure Better Auth for your SaaS application including core settings, database adapter, and security options.
Better Auth is configured in the @kit/better-auth package. This guide covers the core configuration and setup.
The main configuration is in:
packages/better-auth/└── src/ ├── auth.ts # Better Auth configuration and instance └── plugins/ # Auth plugins (MFA, etc.)If you plan on updating the Better Auth configuration, add new plugins, etc. this is the correct place where you can do it.
Core Configuration
The core configuration is in the packages/better-auth/src/auth.ts file.
Here, we define:
- Drizzle: the database adapter (we use Drizzle ORM with PostgreSQL by default)
- Plugins: the plugins we use (MFA, organizations, etc.)
- Emails: the emails sent from events emitted by Better Auth
- Configuration: the default configuration for Better Auth
Database Adapter
We use Drizzle to connect to your PostgreSQL database (which you can change to a different database supported by Drizzle ORM should you want to).
Please feel free to customize the default configuration to your needs.
Next: Auth Methods →