What it does
Better Auth is a TypeScript authentication framework with integrations across web frameworks. Core features and plugins cover password login, social providers, organizations, and additional authentication methods.
Why it’s interesting
The plugin system connects server capabilities to typed client APIs. Database ownership gives teams flexibility, alongside responsibility for configuring and operating authentication correctly.
Real-world use case
Add login and organization membership to a B2B app, using your own database and a typed frontend client.
What I can learn
- 01
Plugin inference
extend server and client types together.
- 02
HTTP adapters
bridge authentication handlers into multiple frameworks.
- 03
Schema generation
derive database requirements from configuration.
One thing to explore
Authentication plugins
Follow the implementation and connect it to the learning points above.
Explore the source (opens in a new tab)10-Minute Challenge
Configure a local SQLite auth instance
Before you start: Node.js, npm, and the current installation guide at https://better-auth.com/docs/installation.
- Install the packages below in a disposable TypeScript project.
- Save the configuration as auth.ts. Generate a BETTER_AUTH_SECRET and set BETTER_AUTH_URL=http://localhost:3000 in your local environment.
- Use the migration command in the current installation guide to create the schema, then inspect the generated tables. Mounting a handler and building a login UI are follow-up tasks.
npm install better-auth better-sqlite3npm install -D @types/better-sqlite3openssl rand -base64 32import { betterAuth } from "better-auth";import Database from "better-sqlite3";
export const auth = betterAuth({ database: new Database("./sqlite.db"), emailAndPassword: { enabled: true },});