Supabase CLI | Supabase Docs
Service

Supabase CLI | Supabase Docs

Supabase
2026.03.07
·Web·by 이호민
#CLI#Database#Docker#Local Development#Supabase

Key Points

  • 1The Supabase CLI facilitates local Supabase development, allowing users to initialize and launch the entire stack on their machine using `supabase init` and `supabase start`.
  • 2Running the local stack requires Docker or compatible container tools, along with Node.js 20+ for CLI installation, and downloads necessary Docker images on the first launch.
  • 3Upon starting, the CLI provides local URLs and keys for accessing the Supabase API, database, Studio, Mailpit, and other integrated development tools.

The Supabase CLI is a command-line interface tool engineered to facilitate local development, deployment, and CI/CD workflows for applications integrated with the Supabase platform. Its core methodology centers on orchestrating a comprehensive, containerized development stack locally, replicating the Supabase cloud environment through the judicious use of Docker containers.

Operational Flow and Components: The initial setup involves invoking supabase init within a designated project directory, which scaffolds the necessary configuration files within a new supabase/ folder, amenable to version control. Subsequent execution of supabase start initiates the launch of the entire Supabase service suite via Docker images. This process, particularly on its inaugural run, involves the download and instantiation of multiple container images. The full local stack typically includes:

  1. A PostgreSQL database instance, accessible via DB URL: postgresql://postgres:postgres@localhost:54322/postgres.
  2. An API Gateway, powered by PostgREST, exposing the database schema via a RESTful interface at API URL: http://localhost:54321.
  3. Supabase Studio, a graphical user interface for database management and exploration, available at Studio URL: http://localhost:54323.
  4. Mailpit, a local SMTP server for capturing and inspecting emails generated by the application, accessible at Mailpit URL: http://localhost:54324.
  5. An Analytics service.
  6. An internal database diff tool.
Upon successful startup, the CLI outputs critical access credentials, including the API URL, database URL, Studio URL, Mailpit URL, and project-specific anon and service_role keys (eyJh......).

Maintenance and Lifecycle Management: Updating the CLI, when installed via npm, is performed using npm update supabase --save-dev. A critical aspect of managing the local environment is handling database schema changes and data persistence. Before upgrading or for significant state resets, the CLI mandates stopping all running Supabase containers and optionally deleting their associated data volumes to ensure a clean state for applying new migrations. This can involve:

  1. Generating a schema diff using supabase db diff -f my_schema.
  2. Dumping local data for backup with supabasedbdumpβˆ’βˆ’localβˆ’βˆ’dataβˆ’only>supabase/seed.sqlsupabase db dump --local --data-only > supabase/seed.sql.
  3. Stopping services and discarding local data volumes via supabase stop --no-backup.
For routine cessation without data loss, a simple supabase stop command halts the containerized services while preserving the local database state.