Database

Database Setup

Connect your PostgreSQL database - Supabase, Neon, Railway, or self-hosted

TL;DR: Set DATABASE_URL to any PostgreSQL connection string. That's it.

Straktur uses PostgreSQL with Drizzle ORM for type-safe database access.

Supported Providers

ProviderBest ForPricing
SupabaseFull-stack apps, includes Auth & StorageFree tier available
NeonServerless, auto-scalingFree tier available
RailwaySimple deploys, good DXFree tier available
Self-hostedFull controlYour infrastructure

Supabase

Recommended for most projects - includes database, auth, and storage in one platform.

Setup

  1. Create project at supabase.com
  2. Go to Settings → Database → Connection string
  3. Copy the URI (Transaction mode for serverless)
DATABASE_URL=postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres

Use 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

  1. Create project at neon.tech
  2. Copy connection string from dashboard
DATABASE_URL=postgresql://[user]:[password]@[endpoint].neon.tech/[database]?sslmode=require

Neon automatically handles connection pooling. No extra configuration needed.


Railway

Simplest setup - one-click PostgreSQL, great for quick deploys.

Setup

  1. Create project at railway.app
  2. Add PostgreSQL service
  3. Copy DATABASE_URL from Variables tab
DATABASE_URL=postgresql://postgres:[password]@[host].railway.app:5432/railway

Self-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:16
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/straktur

After Connecting

Once DATABASE_URL is set, push your schema:

npm run db:push

npm run db:migrate

Verify Connection

npm run db:studio

Opens Drizzle Studio at https://local.drizzle.studio to browse your data.


Environment Variables

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string

Common Issues

On this page