Launchframe

Database

Launchframe uses Drizzle ORM with PostgreSQL. Two driver options are available.

Driver modules

db-pg (default)

Uses the pg (node-postgres) driver. Most familiar, mainstream, and compatible.

db-postgresjs

Uses postgres.js — a modern, high-performance driver with a cleaner API. Choose this if you prefer it.

Select your driver with --database-driver:

npx create-launchframe my-app --database-driver pg
npx create-launchframe my-app --database-driver postgres.js

Key files

FilePurpose
src/lib/db.tsDrizzle client initialization
src/db/schema.tsDatabase schema (users, sessions, accounts)
src/db/seed.tsDemo data seeder
drizzle.config.tsDrizzle Kit configuration

Schema

The default schema includes Better Auth tables:

// src/db/schema.ts
export const user = pgTable('user', {
  id: text('id').primaryKey(),
  email: text('email').notNull().unique(),
  name: text('name'),
  emailVerified: boolean('email_verified').notNull().default(false),
  image: text('image'),
  createdAt: timestamp('created_at').notNull().defaultNow(),
  updatedAt: timestamp('updated_at').notNull().defaultNow(),
});

Commands

pnpm db:push      # Push schema to database (dev)
pnpm db:migrate   # Run migrations (production)
pnpm db:seed      # Seed demo data
pnpm db:studio    # Open Drizzle Studio GUI

Environment

DATABASE_URL=postgresql://user:password@localhost:5432/my_app