What problem does it solve?
Better Auth integration guidance reduces the friction of implementing a full-featured, secure authentication system in TypeScript projects by consolidating configuration, adapter selection, session strategies, and plugin setup into actionable best practices.
Core Features & Use Cases
- Environment & config guidance: Clear rules for BETTER_AUTH_SECRET, BETTER_AUTH_URL, and when to prefer env vars over hardcoded options.
- Database & adapter guidance: How to wire direct DB pools or ORM adapters (Prisma, Drizzle, Mongo) and the distinction between model names and table names.
- Session strategies & security: Recommendations for secondary storage, cookie cache modes (compact, jwt, jwe), session lifetimes, and secure cookie settings.
- Plugins, hooks & CLI: Best practices for adding plugins (passkeys, OAuth, two-factor), using hooks for lifecycle events, and running CLI commands for migrations and schema generation.
- Use case: Configure a Next.js backend with Prisma, enable email/password and Google OAuth, store sessions in Redis, and run the CLI to apply schema migrations.
Quick Start
Generate a Better Auth configuration for a TypeScript project using Prisma, enable email/password and Google OAuth, set BETTER_AUTH_SECRET and BETTER_AUTH_URL in your environment, and run the CLI migrate command.