Overview

Understand the authentication integration in the boilerplate.

AI Boilerplate uses Better Auth for authentication.

Better Auth

Better Auth is a framework-agnostic authentication library. It provides a plugin-based architecture that makes it easy to add providers and extend functionality.

Features

FeatureDescription
Email & PasswordTraditional sign-in with email verification.
Magic LinkPasswordless sign-in.
Google OAuthSign in with Google.
GitHub OAuthSign in with GitHub.
Session ManagementList and revoke active sessions.

How It Works

  1. authentication is configured in packages/auth/src/server.ts.
  2. The API is mounted at /api/auth/[...all] in the dashboard application.
  3. Feature flags in packages/utils/src/constants/features.ts control which methods are enabled.
  4. Server components check sessions via auth.api.getSession() to protect routes.
  5. Client components use useSession() from @package/auth/client to access the session.

Next Steps