What problem does it solve?
This guide removes uncertainty and repetitive trial-and-error when integrating Better Auth by providing a consolidated checklist and configuration guidance for server and client setup, database adapters, session strategies, plugins, and security hardening.
Core Features & Use Cases
- Environment and CLI Workflow: Clear instructions for required environment variables, where to place auth.ts, and when to run the @better-auth/cli migrate and generate commands.
- Database & Session Strategies: Guidance for direct DB connections, ORM adapters (Prisma/Drizzle/Mongo), secondary storage for sessions, and cookie cache strategies to balance security and performance.
- Plugins, Hooks & Security: How to add and tree-shake plugins, configure hooks for pre/post actions, enforce secure cookies, rate limiting, and recommended safety flags for production deployments.
- Use Case: Set up email/password and Google OAuth sign-in for a TypeScript web app, persist sessions in Redis, run migrations, and verify the health endpoint before launch.
Quick Start
Create an auth.ts with your chosen database adapter, set BETTER_AUTH_SECRET and BETTER_AUTH_URL in your environment, run the Better Auth CLI migrations, and verify the GET /api/auth/ok endpoint returns a status of ok.