Supabase Local Development Guide
Run a complete backend with Postgres, Auth, Storage, and more on localhost using Supabase CLI, with the API gateway defaulting to 54321.
Supabase is an open-source alternative to Firebase (PostgreSQL + Auth + Storage + Realtime). The Supabase CLI can launch a full stack in local Docker, making it easy to debug with the frontend.
Prerequisites
- Docker Desktop (or Docker Engine + Compose)
- Supabase CLI
brew install supabase/tap/supabase
# or npm i -g supabaseQuick Start
supabase init
supabase startThe CLI will output the local URL and keys, for example:
| Service | Typical localhost Address |
|---|---|
| API | http://localhost:54321 |
| Studio | http://localhost:54323 |
| PostgreSQL | localhost:54322 |
| Inbucket (Email Testing) | http://localhost:54324 |
Refer to the ports output by supabase start.
Frontend Connection
.env.local:
NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321
NEXT_PUBLIC_SUPABASE_ANON_KEY=<anon key from supabase start>Common Commands
supabase stop
supabase status
supabase db reset
supabase migration new my_changeDifferences from Bare PostgreSQL
The Supabase local stack = Postgres + Auth API + Storage + Kong Gateway; it is not just a :5432 database.
Frequently Asked Questions
Docker Not Runningsupabase start depends on Docker; start Docker Desktop first.
Port Conflicts
Adjust [api] port in config.toml, among others.
Summary
Supabase local development runs with supabase start, with the API endpoint typically at http://localhost:54321 and Studio at 54323, suitable for local debugging of full-stack projects like Next.js.