Home

Supabase CLI

The Supabase CLI provides tools to develop your project locally and deploy to the Supabase Platform. The CLI is still under development, but it contains all the functionality for working with your Supabase projects and the Supabase Platform.

Global flags

Supabase CLI supports global flags for every command.

Flags

  • --debug
    Optional
    no type

    output debug logs to stderr

  • --experimental
    Optional
    no type

    enable experimental features

  • -h, --help
    Optional
    no type

    help for supabase

  • --workdir <string>
    Optional
    no type

    path to a Supabase project directory

$ supabase init

Initialize configurations for Supabase local development.

A supabase/config.toml file is created in your current working directory. This configuration is specific to each local project.

You may override the directory path by specifying the SUPABASE_WORKDIR environment variable.

In addition to config.toml, the supabase directory may also contain other Supabase objects, such as migrations, functions, tests, etc.

supabase init

$ supabase login

Connect the Supabase CLI to your Supabase account by logging in with your personal access token.

Your access token is stored securely in native credentials storage. If native credentials storage is unavailable, it will be written to a plain text file at ~/.supabase/access-token.

If this behavior is not desired, such as in a CI environment, you may skip login by specifying the SUPABASE_ACCESS_TOKEN environment variable in other commands.

The Supabase CLI uses the stored token to access Management APIs for projects, functions, secrets, etc.

supabase login

$ supabase start

Starts the Supabase local development stack.

Requires supabase/config.toml to be created in your current working directory by running supabase init.

All service containers are started by default. You can exclude those not needed by passing in -x flag.

Health checks are automatically added to verify the started containers. Use --ignore-health-check flag to ignore these errors.

Flags

  • -x, --exclude <strings>
    Optional
    no type

    Names of containers to not start. [gotrue, realtime, storage-api, imgproxy, kong, inbucket, postgrest, pgadmin-schema-diff, migra, postgres-meta, studio, deno-relay]

  • --ignore-health-check
    Optional
    no type

    Ignore unhealthy services and exit 0

supabase start

$ supabase stop

Stop all local Supabase containers

Flags

  • --backup
    Optional
    no type

    Backs up the current database before stopping.

supabase stop

$ supabase status

Show status of local Supabase containers

Flags

  • -o, --output <[ env | json | pretty | toml | yaml ]>
    Optional
    no type

    Output format of status variables.

  • --override-name <strings>
    Optional
    no type

    Override specific variable names.

supabase status

$ supabase test db

Tests local database with pgTAP

supabase test db

$ supabase gen types typescript

Generate types for TypeScript. Must specify one of --local, --linked, --project-id, or --db-url

Flags

  • --db-url <string>
    Optional
    no type

    Generate types from a database url.

  • --linked
    Optional
    no type

    Generate types from the linked project.

  • --local
    Optional
    no type

    Generate types from the local dev database.

  • --project-id <string>
    Optional
    no type

    Generate types from a project ID.

  • --schema <stringArray>
    Optional
    no type

    Schemas to generate types for.

supabase gen types typescript [flags]

$ supabase db dump

Dumps schemas from the remote database

Flags

  • -f, --file <string>
    Optional
    no type

    File path to save the dumped schema.

  • -p, --password <string>
    Optional
    no type

    Password to your remote Postgres database.

supabase db dump [flags]

$ supabase db push

Push new migrations to the remote database

Flags

  • --dry-run
    Optional
    no type

    Print the migrations that would be applied, but don't actually apply them.

  • -p, --password <string>
    Optional
    no type

    Password to your remote Postgres database.

supabase db push [flags]

$ supabase db reset

Resets the local database to current migrations

supabase db reset

$ supabase db diff

Diffs the local database for schema changes

Flags

  • -f, --file <string>
    Optional
    no type

    Saves schema diff to a new migration file.

  • --linked
    Optional
    no type

    Diffs local schema against linked project.

  • -s, --schema <strings>
    Optional
    no type

    List of schema to include.

  • --use-migra
    Optional
    no type

    Use migra to generate schema diff.

  • --use-pgadmin
    Optional
    no type

    Use pgAdmin to generate schema diff.

supabase db diff [flags]

$ supabase db lint

Checks local database for typing error

Flags

  • --level <[ warning | error ]>
    Optional
    no type

    Error level to emit.

  • -s, --schema <strings>
    Optional
    no type

    List of schema to include.

supabase db lint [flags]

$ supabase db remote commit

Commit remote changes as a new migration

Flags

  • -p, --password <string>
    Optional
    no type

    Password to your remote Postgres database.

  • -s, --schema <strings>
    Optional
    no type

    List of schema to include.

supabase db remote commit

$ supabase migration new

Create an empty migration script

supabase migration new <migration name>

$ supabase migration list

List local and remote migrations

Flags

  • -p, --password <string>
    Optional
    no type

    Password to your remote Postgres database.

supabase migration list [flags]

$ supabase migration repair

Repairs the migration history table

Flags

  • -p, --password <string>
    Optional
    no type

    Password to your remote Postgres database.

  • --status <[ applied | reverted ]>
    REQUIRED
    no type

    Version status to update.

supabase migration repair <version> [flags]

$ supabase projects create

Create a project on Supabase

Flags

  • --db-password <string>
    Optional
    no type

    Database password of the project.

  • -i, --interactive
    Optional
    no type

    Enables interactive mode.

  • --org-id <string>
    Optional
    no type

    Organization ID to create the project in.

  • --plan <[ free | pro ]>
    Optional
    no type

    Select a plan that suits your needs.

  • --region <string>
    Optional
    no type

    Select a region close to you for the best performance.

supabase projects create <project name> [flags]

$ supabase projects list

List all Supabase projects the logged-in user can access.

supabase projects list

$ supabase orgs list

List all organizations the logged-in user belongs.

supabase orgs list

$ supabase functions new

Create a new Function locally

supabase functions new <Function name>

$ supabase functions download

Download the source code for a Function from the linked Supabase project.

Flags

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase functions download <Function name> [flags]

$ supabase functions serve

Serve a Function locally

Flags

  • --env-file <string>
    Optional
    no type

    Path to an env file to be populated to the Function environment.

  • --import-map <string>
    Optional
    no type

    Path to import map file.

  • --no-verify-jwt
    Optional
    no type

    Disable JWT verification for the Function.

supabase functions serve <Function name> [flags]

$ supabase functions deploy

Deploy a Function to the linked Supabase project.

Flags

  • --import-map <string>
    Optional
    no type

    Path to import map file.

  • --legacy-bundle
    Optional
    no type

    Use legacy bundling mechanism.

  • --no-verify-jwt
    Optional
    no type

    Disable JWT verification for the Function.

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase functions deploy <Function name> [flags]

$ supabase functions delete

Delete a Function from the linked Supabase project. This does NOT remove the Function locally.

Flags

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase functions delete <Function name> [flags]

$ supabase secrets set

Set a secret(s) to the linked Supabase project.

Flags

  • --env-file <string>
    Optional
    no type

    Read secrets from a .env file.

supabase secrets set [flags] <NAME=VALUE> ...

$ supabase secrets list

List all secrets in the linked project.

supabase secrets list

$ supabase secrets unset

Unset a secret(s) from the linked Supabase project.

supabase secrets unset <NAME> ...

$ supabase domains activate

Activates the custom hostname configuration for a project.

This reconfigures your Supabase project to respond to requests on your custom hostname. After the custom hostname is activated, your project's auth services will no longer function on the Supabase-provisioned subdomain.

Flags

  • --include-raw-output
    Optional
    no type

    Include raw output (useful for debugging).

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase domains activate

$ supabase domains create

Create a custom hostname for your Supabase project.

Expects your custom hostname to have a CNAME record to your Supabase project's subdomain.

Flags

  • --custom-hostname <string>
    Optional
    no type

    The custom hostname to use for your Supabase project.

  • --include-raw-output
    Optional
    no type

    Include raw output (useful for debugging).

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase domains create [flags]

$ supabase domains get

Retrieve the custom hostname config for your project, as stored in the Supabase platform.

Flags

  • --include-raw-output
    Optional
    no type

    Include raw output (useful for debugging).

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase domains get

$ supabase domains reverify

Re-verify the custom hostname config for your project

Flags

  • --include-raw-output
    Optional
    no type

    Include raw output (useful for debugging).

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase domains reverify

$ supabase domains delete

Deletes the custom hostname config for your project

Flags

  • --include-raw-output
    Optional
    no type

    Include raw output (useful for debugging).

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase domains delete

$ supabase vanity-subdomains activate

Activate a vanity subdomain for your Supabase project.

This reconfigures your Supabase project to respond to requests on your vanity subdomain. After the vanity subdomain is activated, your project's auth services will no longer function on the {project-ref}.{supabase-domain} hostname.

Flags

  • --desired-subdomain <string>
    Optional
    no type

    The desired vanity subdomain to use for your Supabase project.

  • --experimental
    REQUIRED
    no type

    enable experimental features

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase vanity-subdomains activate [flags]

$ supabase vanity-subdomains get

Get the current vanity subdomain

Flags

  • --experimental
    REQUIRED
    no type

    enable experimental features

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase vanity-subdomains get

$ supabase vanity-subdomains check-availability

Checks if a desired subdomain is available for use

Flags

  • --desired-subdomain <string>
    Optional
    no type

    The desired vanity subdomain to use for your Supabase project.

  • --experimental
    REQUIRED
    no type

    enable experimental features

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase vanity-subdomains check-availability [flags]

$ supabase vanity-subdomains delete

Deletes the vanity subdomain for a project, and reverts to using the project ref for routing.

Flags

  • --experimental
    REQUIRED
    no type

    enable experimental features

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase vanity-subdomains delete

$ supabase network-bans

Network bans are IPs that get temporarily blocked if their traffic pattern looks abusive (e.g. multiple failed auth attempts).

The subcommands help you view the current bans, and unblock IPs if desired.

$ supabase network-bans get

Get the current network bans

Flags

  • --experimental
    REQUIRED
    no type

    enable experimental features

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase network-bans get

$ supabase network-bans remove

Remove a network ban

Flags

  • --db-unban-ip <strings>
    Optional
    no type

    IP to allow DB connections from.

  • --experimental
    REQUIRED
    no type

    enable experimental features

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase network-bans remove [flags]

$ supabase network-restrictions get

Get the current network restrictions

Flags

  • --experimental
    REQUIRED
    no type

    enable experimental features

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase network-restrictions get

$ supabase network-restrictions update

Update network restrictions

Flags

  • --bypass-cidr-checks
    Optional
    no type

    Bypass some of the CIDR validation checks.

  • --db-allow-cidr <strings>
    Optional
    no type

    CIDR to allow DB connections from.

  • --experimental
    REQUIRED
    no type

    enable experimental features

  • --project-ref <string>
    Optional
    no type

    Project ref of the Supabase project.

supabase network-restrictions update [flags]

$ supabase completion zsh

Generate the autocompletion script for the zsh shell.

If shell completion is not already enabled in your environment you will need to enable it. You can execute the following once:

echo "autoload -U compinit; compinit" >> ~/.zshrc

To load completions in your current shell session:

source <(supabase completion zsh); compdef _supabase supabase

To load completions for every new session, execute once:

Linux:

supabase completion zsh > "${fpath[1]}/_supabase"

macOS:

supabase completion zsh > $(brew --prefix)/share/zsh/site-functions/_supabase

You will need to start a new shell for this setup to take effect.

Flags

  • --no-descriptions
    Optional
    no type

    disable completion descriptions

supabase completion zsh [flags]

$ supabase completion powershell

Generate the autocompletion script for powershell.

To load completions in your current shell session:

supabase completion powershell | Out-String | Invoke-Expression

To load completions for every new session, add the output of the above command to your powershell profile.

Flags

  • --no-descriptions
    Optional
    no type

    disable completion descriptions

supabase completion powershell [flags]

$ supabase completion fish

Generate the autocompletion script for the fish shell.

To load completions in your current shell session:

supabase completion fish | source

To load completions for every new session, execute once:

supabase completion fish > ~/.config/fish/completions/supabase.fish

You will need to start a new shell for this setup to take effect.

Flags

  • --no-descriptions
    Optional
    no type

    disable completion descriptions

supabase completion fish [flags]

$ supabase completion bash

Generate the autocompletion script for the bash shell.

This script depends on the 'bash-completion' package. If it is not installed already, you can install it via your OS's package manager.

To load completions in your current shell session:

source <(supabase completion bash)

To load completions for every new session, execute once:

Linux:

supabase completion bash > /etc/bash_completion.d/supabase

macOS:

supabase completion bash > $(brew --prefix)/etc/bash_completion.d/supabase

You will need to start a new shell for this setup to take effect.

Flags

  • --no-descriptions
    Optional
    no type

    disable completion descriptions

supabase completion bash
Need some help?

Not to worry, our specialist engineers are here to help. Submit a support ticket through the Dashboard.