SQLite is a lightweight, serverless, self-contained SQL database. Better Auth uses Kysely under the hood for SQLite, which means any database Kysely supports is also supported by Better Auth. SQLite is a good fit for:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/better-auth/better-auth/llms.txt
Use this file to discover all available pages before exploring further.
- Local development and testing
- Serverless edge runtimes (Cloudflare D1)
- Embedded or single-user applications
Drivers
Better Auth accepts any of the SQLite drivers listed below. Choose the one that matches your runtime.better-sqlite3 (recommended)
The most widely used synchronous SQLite driver for Node.js.Node.js built-in SQLite (experimental)
Starting from Node.js 22.5.0 you can use the built-in SQLite module without installing a package:auth.ts
Bun built-in SQLite
Bun ships with a built-in SQLite module:auth.ts
Schema generation and migration
The Better Auth CLI can both generate the schema and apply migrations directly to your SQLite file.- migrate
- generate
| Command | Supported |
|---|---|
npx auth@latest generate | Yes |
npx auth@latest migrate | Yes |
generate produces a SQL file you can inspect and apply manually. migrate runs the SQL directly against your database file.Cloudflare D1
Cloudflare D1 is a SQLite-compatible edge database. Because D1 can only be accessed from a Cloudflare Worker, the CLI cannot run migrations against it directly. Use programmatic migrations instead:auth.ts
src/index.ts
Experimental joins
Enabling joins allows Better Auth to use SQLJOIN clauses to fetch related data in a single query instead of multiple round-trips.
auth.ts