On this page

Local development

Run Postgres, Auth, REST, Realtime, Storage, Edge Functions and a local Studio on your own machine with stitchdb start.

Terminal
stitchdb start

Starts a complete StitchDB project on your machine as plain processes, bound to 127.0.0.1 only. No Docker. The first start downloads the runtime once (about 40 MB, into ~/.stitchdb/runtime); later starts take about a second. Your migrations are applied, and seed.sql runs on the first start. The command prints the URLs and keys (--output json for scripts and agents):

ServiceDefault address
API (REST, Auth, Storage, Realtime, Functions)http://127.0.0.1:54321
Postgrespostgresql://postgres:[email protected]:54322/postgres
Local Studio (tables, SQL, users, storage)http://127.0.0.1:54323
Mail catcher (every e-mail Auth sends)http://127.0.0.1:54324

Use the printed API URL and anon key in your app exactly like a hosted project:

JavaScript
const stitchdb = createClient('http://127.0.0.1:54321', '<local anon key>')

#Everyday commands

CommandDoes
stitchdb statusServices, URLs, keys and memory use (--all: every local project on this machine)
stitchdb stopStops everything; your local data is kept
stitchdb stop --no-backupStops and deletes the local data
stitchdb db resetRebuilds the local database from your migrations and seed.sql
stitchdb migration upApplies new migration files to the running local database
stitchdb db query --local "select …"Runs SQL locally
stitchdb start -x realtime,storageLeaves services out (also: auth, rest, functions, mail, studio)
stitchdb start --eagerStarts every service now and keeps them running
stitchdb stop --allStops every local project on this machine

#Configuration

Ports and local Auth settings live in stitchdb/config.toml:

toml
[api]
port = 54321
schemas = ["public"]

[db]
port = 54322

[auth]
site_url = "http://localhost:3000"
additional_redirect_urls = ["http://localhost:3000/**"]
enable_signup = true

[auth.email]
enable_confirmations = false   # local sign-ups are confirmed automatically

Run stitchdb start again after changing it.

#Several projects and git worktrees

Each project folder, and each git worktree of the same repository, is its own local project with its own database, files and ports, so you (or several coding agents) can run branches side by side. A folder uses the ports in config.toml when they are free; when another local project already has them, it picks free ones, remembers them for that folder and says so on start. stitchdb status --all lists them.

#Light on memory

Postgres starts right away. Auth, REST and each Edge Function start on their first request and stop again after 10 minutes without requests, so an idle project uses little memory. Change the delay with [local] idle_minutes in config.toml, or keep everything running with stitchdb start --eager.

#What runs locally

Postgres 17 with the common extensions (including pgvector and pg_cron), the same Auth and REST API servers as your hosted project, Realtime (broadcast, presence and Postgres changes with your RLS policies), Storage (files in the project's data folder, access checked with your storage.objects policies) and Edge Functions on Deno, behind one gateway. Platform features that only make sense when hosted (read replicas, backups, billing, image transformations, resumable uploads, the full Studio) are not part of the local runtime.