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.jsKey files
| File | Purpose |
|---|---|
src/lib/db.ts | Drizzle client initialization |
src/db/schema.ts | Database schema (users, sessions, accounts) |
src/db/seed.ts | Demo data seeder |
drizzle.config.ts | Drizzle 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 GUIEnvironment
DATABASE_URL=postgresql://user:password@localhost:5432/my_app