Local database
Develop with a local Turso-compatible SQLite database using Drizzle.
The starter uses Drizzle ORM with @libsql/client. Development runs against a
SQLite file in packages/database; no Turso account, token, CLI, or database
server is required.
Configure and initialize
Add the database settings to .env.local at the repository root:
DATABASE_URL="file:./local.db"
DATABASE_AUTH_TOKEN=""Relative file: URLs resolve from packages/database in both applications and
database commands. This configuration creates packages/database/local.db.
Database files and SQLite journal/WAL files are Git-ignored. You can also use an
absolute file URL such as file:/absolute/path/local.db.
pnpm install
pnpm --filter @repo/database migrate
pnpm devSet BETTER_AUTH_SECRET and the app URLs in .env.local as well. Use port 4000
for SaaS, 4001 for marketing, and 4002 for docs.
The default Resend mail provider initializes at startup, so set RESEND_API_KEY
to your development mail key. The database itself needs no cloud credentials.
Change the schema
The active schema is packages/database/drizzle/schema/sqlite.ts. Better Auth
uses the Drizzle adapter with the SQLite provider. Query helpers and Zod schemas
are exported through @repo/database.
Generate a migration after editing the schema, review the SQL under
packages/database/drizzle/migrations, and apply it:
pnpm --filter @repo/database generate
pnpm --filter @repo/database migrateFor a disposable development database, you can push schema changes directly:
pnpm --filter @repo/database pushpush creates no migration history. Use migrations for databases that need a
durable, repeatable upgrade path. Running pnpm dev does not apply migrations.
Inspect the local database with Drizzle Studio:
pnpm --filter @repo/database studioSQLite is the model source. PostgreSQL/MySQL Drizzle schema files remain as inactive starter alternatives. All persistence uses the single Drizzle query layer; the project has no Prisma configuration or direct dependency.
Use Turso Cloud
Replace the environment values with the database URL and token from Turso:
DATABASE_URL="libsql://your-db-name-your-org.turso.io"
DATABASE_AUTH_TOKEN="your-auth-token"Apply the migrations with pnpm --filter @repo/database migrate and restart the
application. This initializes the remote schema; it does not upload the contents
of the local SQLite file or migrate an existing PostgreSQL database.
See Turso local development and Drizzle with Turso for the supported connection options.