GuidesDatabase
Local PostgreSQL
Run a PostgreSQL database on your machine for development.
Docs are in beta — content is improving rapidly. Found something missing? Open an issue on GitHub or reach out on Twitter (X).
Option A — Postgres.app (macOS, recommended)
- Download and install Postgres.app
- Open it and start the server
- Open a terminal and create a database:
Configure your $PATH to use the included command line tools.
Add this to ~/.zshrc file":
# Postgres.app
export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"createdb app-db-name- Your connection string to be updated in
.env.local:
DATABASE_URL=postgres://username:password@localhost:5432/app-db-nameOption B — Docker
docker run --name betterstarter-db \
-e POSTGRES_DB=betterstarter \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
-d postgres:16Connection string:
DATABASE_URL=postgres://postgres:postgres@localhost:5432/betterstarterRun Migrations
Once DATABASE_URL is set in .env.local:
pnpm db:generate
pnpm db:migrate