Supabase CLI
The Supabase CLI provides tools to develop your project locally and deploy to the Supabase Platform.
You can use the Supabase CLI to run the entire Supabase stack locally on your machine, simply by running supabase init
(to create a new local project) and then supabase start
.
The Supabase CLI provides tools to develop your project locally, deploy to the Supabase Platform, handle database migrations, and generate types directly from your database schema.
Installing the Supabase CLI#
Install the CLI as dev dependency via npm:
_10npm install supabase --save-dev
Run the CLI by prefixing each command with npx
(only applicable when installing through npm
):
_10npx supabase <command>
Updating the Supabase CLI#
When a new version is released, you can update the CLI using the same methods.
_10npm update supabase --save-dev
If you have any Supabase containers running locally, remember to restart them after upgrading to use the new features.
_10supabase stop --no-backup_10supabase start
Running Supabase locally#
The Supabase CLI uses Docker containers to manage the local development stack. To get started,
- Install Docker Desktop
Inside the folder where you want to create your project, run:
_10supabase init
This will create a new supabase
folder. It's safe to commit this folder to your version control system.
Now, to start the Supabase stack, run:
_10supabase start
This takes time on your first run because the CLI needs to download the Docker images to your local machine. The CLI includes the entire Supabase toolset, and a few additional images that are useful for local development (like a local SMTP server and a database diff tool).
The local development environment includes Supabase Studio, a graphical interface for working with your database, running by default on localhost:54323.
Stopping local services#
When you are finished working on your Supabase project, you can stop the stack with:
_10supabase stop
Full command reference#
The CLI provides a number of commands to help you develop your project locally and deploy to the Supabase Platform. You can find all commands inside the CLI Reference docs, including: