Docs

SQLite

SQLite is a lightweight, serverless, self-contained SQL database engine that is widely used for local data storage in applications. Read more here.

Example Usage

Make sure you have SQLite installed and configured. Then, you can connect it straight into Better Auth.

auth.ts
import { betterAuth } from "better-auth";
import Database from "better-sqlite3";
 
export const auth = betterAuth({
  database: new Database("database.sqlite"),
});

For more information, read Kysely's documentation to the SqliteDialect.

Schema generation & migration

The Better Auth CLI allows you to generate or migrate your database schema based on your Better Auth configuration and plugins.

SQLite Schema Generation

SQLite Schema Migration

✅ Supported✅ Supported
Schema Generation
npx @better-auth/cli@latest generate
Schema Migration
npx @better-auth/cli@latest migrate

Additional Information

SQLite is supported under the hood via the Kysely adapter, any database supported by Kysely would also be supported. (Read more here)

If you're looking for performance improvements or tips, take a look at our guide to performance optimizations.

On this page