New:New releases:CLIcreate-clubedge-app v0.49.1·Clubedge Starter v0.32.0

Clubedge Starter Docs

Database

Drizzle schema, migrations, and seed data on PostgreSQL.

Application tables are managed with Drizzle. Keep one migration source of truth for application tables: do not also create an independent Supabase migration history for those same tables.

From the repository root:

pnpm db:check
pnpm db:generate
pnpm db:migrate

db:generate creates migration files from packages/db/src/schema into packages/db/drizzle; review and commit those files. With Better Auth, its tables have their own schema and migrations in packages/auth-better-auth, applied by the same commands.

db:migrate applies committed migrations. db:push is available for local development, but do not use it as a production migration workflow. Use pnpm db:seed only against a database where seed data is appropriate.

The database commands run in packages/db and read DATABASE_URL from apps/web/.env.local, so the project keeps one environment file. With a separate API, they also read apps/api/.env.local, where the API keeps it. A variable set in the shell wins, then apps/web/.env.local, then apps/api/.env.local. A project without a website has only the API's file. The Postgres.js client is configured with prepare: false for compatibility with transaction poolers (Supabase's, Neon's).

Pooled and direct connections

Hosted PostgreSQL usually offers two URLs. The pooled one (Neon's host ending in -pooler, Supabase's port 6543) runs each transaction on any free server connection, which suits the app's many short requests. Migrations and the background jobs worker need a whole session to themselves, which a transaction pooler can't give.

Set DATABASE_URL_DIRECT to the direct URL (Starter v0.19.0 or newer), and pnpm db:migrate, Drizzle Kit, the production migrator, and the jobs worker use it; everything else stays on DATABASE_URL. Without it, they all use DATABASE_URL.

apps/web/.env.local
DATABASE_URL=postgresql://user:password@ep-cool-name-123-pooler.eu-central-1.aws.neon.tech/neondb?sslmode=require
DATABASE_URL_DIRECT=postgresql://user:password@ep-cool-name-123.eu-central-1.aws.neon.tech/neondb?sslmode=require

pnpm check:services connects through both, and pnpm check:env refuses a DATABASE_URL_DIRECT that points at localhost, isn't a postgresql:// URL, or points at Neon's pooler.

In production

The production image contains a migrator that applies every package's migrations with only DATABASE_URL, or DATABASE_URL_DIRECT when it is set. With a separate API, the API's image contains it, with Hono or FastAPI. Run it before a new version starts serving; see Docker and Deploy.

How is this guide?