Database Setup
Connect your PostgreSQL database - Supabase, Neon, Railway, or self-hosted
TL;DR: Set
DATABASE_URLto any PostgreSQL connection string. That's it.
Straktur uses PostgreSQL with Drizzle ORM for type-safe database access.
Supported Providers
| Provider | Best For | Pricing |
|---|---|---|
| Supabase | Full-stack apps, includes Auth & Storage | Free tier available |
| Neon | Serverless, auto-scaling | Free tier available |
| Railway | Simple deploys, good DX | Free tier available |
| Self-hosted | Full control | Your infrastructure |
Supabase
Recommended for most projects - includes database, auth, and storage in one platform.
Setup
- Create project at supabase.com
- Go to Settings → Database → Connection string
- Copy the URI (Transaction mode for serverless)
DATABASE_URL=postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgresUse Transaction mode (port 6543) for serverless environments like Vercel. Use Session mode (port 5432) for long-running connections.
Neon
Best for serverless - scales to zero, branching for dev/preview.
Setup
- Create project at neon.tech
- Copy connection string from dashboard
DATABASE_URL=postgresql://[user]:[password]@[endpoint].neon.tech/[database]?sslmode=requireNeon automatically handles connection pooling. No extra configuration needed.
Railway
Simplest setup - one-click PostgreSQL, great for quick deploys.
Setup
- Create project at railway.app
- Add PostgreSQL service
- Copy
DATABASE_URLfrom Variables tab
DATABASE_URL=postgresql://postgres:[password]@[host].railway.app:5432/railwaySelf-hosted
Any PostgreSQL 14+ works. Use Docker for local development:
docker run -d \
--name postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=straktur \
-p 5432:5432 \
postgres:16DATABASE_URL=postgresql://postgres:postgres@localhost:5432/strakturAfter Connecting
Once DATABASE_URL is set, push your schema:
npm run db:push
npm run db:migrateVerify Connection
npm run db:studioOpens Drizzle Studio at https://local.drizzle.studio to browse your data.
Environment Variables
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string |