Local Supabase
Local Supabase stack for Treeper dev. Runs Postgres, GoTrue (auth), Storage, Realtime, and Studio in Docker via the Supabase CLI.
Prerequisites
Section titled “Prerequisites”- Docker engine running (Docker Desktop or colima — see colima note below)
- Supabase CLI:
brew install supabase/tap/supabase
colima users (one-time setup)
Section titled “colima users (one-time setup)”Supabase CLI probes /var/run/docker.sock directly even when DOCKER_HOST
is exported. On colima the socket lives at ~/.colima/default/docker.sock,
so symlink it once:
sudo ./scripts/colima-docker-sock.shThe script refuses to clobber an existing non-symlink at /var/run/docker.sock
(so Docker Desktop installs are safe). The link survives reboots and is
shared by every project on this machine.
Why ports 55321–55329 (not the default 54321)?
Section titled “Why ports 55321–55329 (not the default 54321)?”Supabase CLI defaults every project to host ports 54321–54329, so two
local stacks collide on the host even though their Docker containers are
namespaced by project_id. This project uses +1000 offsets so it can
run alongside another local Supabase stack:
| Service | Default | Treeper |
|---|---|---|
| API (GoTrue + REST + Storage) | 54321 | 55321 |
| Postgres | 54322 | 55322 |
| Studio | 54323 | 55323 |
| Inbucket | 54324 | 55324 |
| Analytics | 54327 | 55327 |
| DB pooler | 54329 | 55329 |
Ports are pinned in config.toml. To run a third stack, copy that pattern
(another offset) in that project’s config.toml.
Start / stop
Section titled “Start / stop”cd infrasupabase start # first run pulls ~3GB of images, takes 5–15 minsupabase status # prints URLs and keyssupabase stop # halts containers, keeps datasupabase stop --no-backup # halts and wipes the local DB volumeAfter start, you’ll see output like:
API URL: http://127.0.0.1:55321GraphQL URL: http://127.0.0.1:55321/graphql/v1DB URL: postgresql://postgres:[email protected]:55322/postgresStudio URL: http://127.0.0.1:55323Inbucket URL: http://127.0.0.1:55324 (catches all auth emails)anon key: eyJhbGciOi...service_role: eyJhbGciOi...Use the API URL as SUPABASE_URL and the anon key as SUPABASE_ANON_KEY
when running the mobile app:
cd ../apps/mobilefvm flutter run \ --dart-define=SUPABASE_URL=http://127.0.0.1:55321 \ --dart-define=SUPABASE_ANON_KEY=<paste anon key from supabase status>iOS simulator and Android emulator can both reach
127.0.0.1on the host — the simulator shares the host loopback. If you run on a physical device, replace127.0.0.1with your Mac’s LAN IP and ensure the firewall allows port55321.
Auth confirmation emails go to Inbucket at http://127.0.0.1:55324 — open it to grab confirmation links / OTP codes during dev.
Migrations
Section titled “Migrations”supabase migration new <name> # creates supabase/migrations/<ts>_<name>.sqlsupabase db reset # rebuilds local DB from migrations + seed.sqlsupabase db diff -f <name> # captures Studio-made changes as a migrationMigrations are committed; the running container is ephemeral.
Linking to a hosted project (later)
Section titled “Linking to a hosted project (later)”supabase link --project-ref <ref>supabase db push # apply local migrations to the hosted DB