Skip to content

Database Setup

The Booking Kit requires PostgreSQL 15+ with the btree_gist extension.

ProviderNotes
Local DockerIncluded docker-compose.yml for development
NeonServerless Postgres, great for Vercel
SupabaseManaged Postgres with auth and storage
RailwayOne-click Postgres provisioning
Vercel PostgresIntegrated with Vercel deployments
AWS RDSProduction-grade managed Postgres
DigitalOceanManaged databases
Terminal window
docker compose up -d

This starts Postgres 15 with:

  • Database: thebookingkit
  • Port: 5432
  • User: postgres
  • Password: from .env
DATABASE_URL="postgresql://postgres:password@localhost:5432/thebookingkit"
Terminal window
# 1. Push Drizzle schema (tables, enums, indexes)
npx drizzle-kit push
# 2. Apply custom migrations (btree_gist, audit triggers, GDPR)
npx tsx packages/db/src/migrate.ts
# 3. (Optional) Seed sample data
npm run db:seed -w @thebookingkit/db

Create a Postgres 15+ database with your preferred provider. Ensure the user has permissions to create extensions.

Terminal window
DATABASE_URL="postgresql://user:pass@host:5432/thebookingkit?sslmode=require"
Terminal window
# Generate and apply Drizzle migrations
npx drizzle-kit generate
npx drizzle-kit migrate
# Apply custom SQL migrations
npx tsx packages/db/src/migrate.ts

The double-booking prevention constraint requires btree_gist. Most managed Postgres providers support it. Verify:

SELECT * FROM pg_extension WHERE extname = 'btree_gist';

If the extension isn’t installed, the custom migration script will create it automatically (requires CREATE EXTENSION permission).

For serverless deployments (Vercel, Cloudflare), use connection pooling:

  • Neon: Use the pooled connection string (append ?pgbouncer=true)
  • Supabase: Use the pooled port (6543 instead of 5432)
  • PgBouncer: Set DIRECT_URL for migrations, DATABASE_URL for the pooled URL