पाठ 19 / 25

The Supabase CLI and Local Stack

Run everything on your machine.

A full stack in containers

supabase init creates a supabase/ folder with config.toml, a migrations/ directory and a place for seed.sql. supabase start runs Postgres, Auth, Storage, Realtime, the API gateway and Studio locally in Docker and prints local URLs and keys. Developing locally keeps experiments away from production data and makes the schema reproducible. supabase stop shuts it down.

Local first, migrations always

The Supabase CLI runs the stack locally, tracks schema changes as migrations and generates types.

Three ideas: the CLI and local stack, migrations and deploys, types plus environments.
Figure 7.1 — Local stack, migration files, staging, production.

Starting a local project

Commands (requires Docker).

supabase init              # create supabase/ with config.toml
supabase start             # run the local stack and print URLs and keys
supabase status            # show local URLs and keys again
supabase db reset          # rebuild local db from migrations + seed.sql
supabase stop              # stop the containers

A flight simulator

The local stack is a simulator: you can crash as often as you like and reset, without touching real passengers.

त्वरित जाँच: What does supabase db reset do locally?

  • Uploads files to Storage
  • Deletes the remote production project
  • Rotates the API keys
  • Recreates the database from migrations and the seed file
Answer

Recreates the database from migrations and the seed file — A clean, reproducible local database.