Database Setup
The Booking Kit requires PostgreSQL 15+ with the btree_gist extension.
Supported providers
Section titled “Supported providers”| Provider | Notes |
|---|---|
| Local Docker | Included docker-compose.yml for development |
| Neon | Serverless Postgres, great for Vercel |
| Supabase | Managed Postgres with auth and storage |
| Railway | One-click Postgres provisioning |
| Vercel Postgres | Integrated with Vercel deployments |
| AWS RDS | Production-grade managed Postgres |
| DigitalOcean | Managed databases |
Local development
Section titled “Local development”Docker Compose
Section titled “Docker Compose”docker compose up -dThis starts Postgres 15 with:
- Database:
thebookingkit - Port:
5432 - User:
postgres - Password: from
.env
Connection string
Section titled “Connection string”DATABASE_URL="postgresql://postgres:password@localhost:5432/thebookingkit"Schema setup
Section titled “Schema setup”# 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 datanpm run db:seed -w @thebookingkit/dbProduction deployment
Section titled “Production deployment”1. Provision a database
Section titled “1. Provision a database”Create a Postgres 15+ database with your preferred provider. Ensure the user has permissions to create extensions.
2. Set the connection string
Section titled “2. Set the connection string”DATABASE_URL="postgresql://user:pass@host:5432/thebookingkit?sslmode=require"3. Run migrations
Section titled “3. Run migrations”# Generate and apply Drizzle migrationsnpx drizzle-kit generatenpx drizzle-kit migrate
# Apply custom SQL migrationsnpx tsx packages/db/src/migrate.ts4. Verify btree_gist
Section titled “4. Verify btree_gist”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).
Connection pooling
Section titled “Connection pooling”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_URLfor migrations,DATABASE_URLfor the pooled URL