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.
Supabase CLI supports global flags for every command.
Flags
--debug
Optional
no type
output debug logs to stderr
--dns-resolver <[ native | https ]>
Optional
no type
lookup domain names using the specified resolver
--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 or --workdir flag.
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 link
Link your local development project to a hosted Supabase project.
PostgREST configurations are fetched from the Supabase platform and validated against your local configuration file.
Optionally, database settings can be validated if you provide a password. Your database password is saved in native credentials storage if available.
If you do not want to be prompted for the database password, such as in a CI environment, you may specify it explicitly via the SUPABASE_DB_PASSWORD environment variable.
Some commands like db dump, db push, and db remote commit require your project to be linked first.
Flags
-p, --password <string>
Optional
no type
Password to your remote Postgres database.
--project-ref <string>
REQUIRED
no type
Project ref of the Supabase project.
supabase link --project-ref ********************
$ 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. To exclude multiple containers, either pass in a comma separated string, such as -x gotrue,imgproxy, or specify -x flag multiple times.
It is recommended to have at least 7GB of RAM to start all services.
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
Stops the Supabase local development stack.
Requires supabase/config.toml to be created in your current working directory by running supabase init.
All Docker resources are cleaned up by default. Use --backup flag to persist your local development data between restarts.
Flags
--backup
Optional
no type
Backs up the current database before stopping.
supabase stop
$ supabase status
Shows status of the Supabase local development stack.
Requires the local development stack to be started by running supabase start or supabase db start.
You can export the connection parameters for initializing supabase-js locally by specifying the -o env flag. Supported parameters include JWT_SECRET, ANON_KEY, and SERVICE_ROLE_KEY.
A supabase/migrations directory will be created if it does not already exists in your current workdir. All schema migration files must be created in this directory following the pattern <timestamp>_<name>.sql.
Outputs from other commands like db diff may be piped to migration new <name> via stdin.
Flags
--db-url <string>
Optional
no type
connect using the specified database url
supabase migration new schema_test
$ supabase migration list
Lists migration history in both local and remote databases.
Requires your local project to be linked to a remote database by running supabase link. For self-hosted databases, you can pass in the connection parameters using --db-url flag.
Note that URL strings must be escaped according to RFC 3986.
Local migrations are stored in supabase/migrations directory while remote migrations are tracked in supabase_migrations.schema_migrations table. Only the timestamps are compared to identify any differences.
In case of discrepancies between the local and remote migration history, you can resolve them using the migration repair command.
Flags
-p, --password <string>
Optional
no type
Password to your remote Postgres database.
--db-url <string>
Optional
no type
connect using the specified database url
supabase migration list
$ supabase migration repair
Repairs the remote migration history table.
Requires your local project to be linked to a remote database by running supabase link.
If your local and remote migration history goes out of sync, you can repair the remote history by marking specific migrations as --status applied or --status reverted. Marking as reverted will delete an existing record from the migration history table while marking as applied will insert a new record.
For example, your migration history table may look like this after running db remote commit for the first time.
$ supabase migration list
LOCAL │ REMOTE │ TIME (UTC)
─────────────────┼────────────────┼──────────────────────
20230103054303 │ 20230103054303 │ 2023-01-03 05:43:03
To reset your migration history to a clean state, first delete your local migration file.
$ rm supabase/migrations/20230103054303_remote_commit.sql
$ supabase migration list
LOCAL │ REMOTE │ TIME (UTC)
─────────────────┼────────────────┼──────────────────────
│ 20230103054303 │ 2023-01-03 05:43:03
Then mark the remote migration 20230103054303 as reverted.
$ supabase migration repair 20230103054303 --status reverted
Repaired migration history: 20230103054303 => reverted
$ supabase migration list
LOCAL │ REMOTE │ TIME (UTC)
─────────────────┼────────────────┼──────────────────────
Now you can run db remote commit again to dump the remote schema as a local migration file.
Output format of the command, useful when using the CLI in scripts or CI workflows.
pretty
REQUIRED
[ pretty | json | yaml | toml ]
json
REQUIRED
[ pretty | json | yaml | toml ]
yaml
REQUIRED
[ pretty | json | yaml | toml ]
toml
REQUIRED
[ pretty | json | yaml | toml ]
Use only with certain commands to output the raw SAML 2.0 Metadata XML stored in your project's authentication configuration.
$ supabase sso list
List all connections to a SSO identity provider to your Supabase project.
Flags
--project-ref <string>
REQUIRED
string
Project ref of the Supabase project.
--output [ pretty | json | yaml | toml ]
Optional
[ pretty | json | yaml | toml ]
Output format of the command, useful when using the CLI in scripts or CI workflows.
pretty
REQUIRED
[ pretty | json | yaml | toml ]
json
REQUIRED
[ pretty | json | yaml | toml ]
yaml
REQUIRED
[ pretty | json | yaml | toml ]
toml
REQUIRED
[ pretty | json | yaml | toml ]
Use only with certain commands to output the raw SAML 2.0 Metadata XML stored in your project's authentication configuration.
$ supabase sso show <provider-id>
Provides the information about an established connection to an identity provider. You can use --metadata to obtain the raw SAML 2.0 Metadata XML document stored in your project's configuration.
Flags
--project-ref <string>
REQUIRED
string
Project ref of the Supabase project.
--output [ pretty | json | yaml | toml ]
Optional
[ pretty | json | yaml | toml ]
Output format of the command, useful when using the CLI in scripts or CI workflows.
pretty
REQUIRED
[ pretty | json | yaml | toml ]
json
REQUIRED
[ pretty | json | yaml | toml ]
yaml
REQUIRED
[ pretty | json | yaml | toml ]
toml
REQUIRED
[ pretty | json | yaml | toml ]
Use only with certain commands to output the raw SAML 2.0 Metadata XML stored in your project's authentication configuration.
supabase sso show 6df4d73f-bf21-405f-a084-b11adf19fea5 \
--project-ref abcdefghijklmnopqrst
$ supabase sso add
Add and configure a new connection to a SSO identity provider to your Supabase project.
Flags
--project-ref <string>
REQUIRED
string
Project ref of the Supabase project.
--output [ pretty | json | yaml | toml ]
Optional
[ pretty | json | yaml | toml ]
Output format of the command, useful when using the CLI in scripts or CI workflows.
pretty
REQUIRED
[ pretty | json | yaml | toml ]
json
REQUIRED
[ pretty | json | yaml | toml ]
yaml
REQUIRED
[ pretty | json | yaml | toml ]
toml
REQUIRED
[ pretty | json | yaml | toml ]
Use only with certain commands to output the raw SAML 2.0 Metadata XML stored in your project's authentication configuration.
--type saml
REQUIRED
string
Type of identity provider being added. Only SAML 2.0 supported at this time.
saml
REQUIRED
string
--metadata-url <URL>
REQUIRED
string
A URL (typically HTTPS) that points to a SAML 2.0 Metadata XML document describing the SAML features supported by the identity provider being added.
Mutually exclusive with --metadata-file.
--metadata-file <path to file>
REQUIRED
string
A path to a file containing a SAML 2.0 Metadata XML document describing the SAML features supported by the identity provider being added. Prefer using --metadata-url if possible.
Mutually exclusive with --metadata-url.
domains
Optional
string
A comma separated list of email domains to associate with this identity provider. Used to quickly sign users in on the frontend by identifying the correct identity provider based on the email address of the user.
attribute-mapping-file
Optional
string
A file containing a JSON document describing the attribute mappings attached to this identity provider. User information contained in the SAML assertion will be mapped according to the rules laid out in this document.
Update the configuration settings of a already added SSO identity provider.
Flags
--project-ref <string>
REQUIRED
string
Project ref of the Supabase project.
--output [ pretty | json | yaml | toml ]
Optional
[ pretty | json | yaml | toml ]
Output format of the command, useful when using the CLI in scripts or CI workflows.
pretty
REQUIRED
[ pretty | json | yaml | toml ]
json
REQUIRED
[ pretty | json | yaml | toml ]
yaml
REQUIRED
[ pretty | json | yaml | toml ]
toml
REQUIRED
[ pretty | json | yaml | toml ]
Use only with certain commands to output the raw SAML 2.0 Metadata XML stored in your project's authentication configuration.
--metadata-url <URL>
Optional
string
A URL (typically HTTPS) that points to a SAML 2.0 Metadata XML document describing the SAML features supported by the identity provider being added.
Mutually exclusive with --metadata-file.
--metadata-file <path to file>
Optional
string
A path to a file containing a SAML 2.0 Metadata XML document describing the SAML features supported by the identity provider being added. Prefer using --metadata-url if possible.
Mutually exclusive with --metadata-url.
domains
Optional
string
A comma separated list of email domains to associate with this identity provider. Used to quickly sign users in on the frontend by identifying the correct identity provider based on the email address of the user. When provided all of the domains already attached to the identity provider will be replaced with this list.
add-domains
Optional
no type
Associates these additional email domains to the existing set of domains. See --domains for a detailed explanation.
remove-domains
Optional
no type
Removes these email domains from the existing set of domains. See --domains for a detailed explanation.
attribute-mapping-file
Optional
string
A file containing a JSON document describing the attribute mappings attached to this identity provider. User information contained in the SAML assertion will be mapped according to the rules laid out in this document.
Remove a connection to an already added SSO identity provider. Removing the provider will prevent existing users from logging in. Please treat this command with care.
Flags
--project-ref <string>
REQUIRED
string
Project ref of the Supabase project.
--output [ pretty | json | yaml | toml ]
Optional
[ pretty | json | yaml | toml ]
Output format of the command, useful when using the CLI in scripts or CI workflows.
pretty
REQUIRED
[ pretty | json | yaml | toml ]
json
REQUIRED
[ pretty | json | yaml | toml ]
yaml
REQUIRED
[ pretty | json | yaml | toml ]
toml
REQUIRED
[ pretty | json | yaml | toml ]
Use only with certain commands to output the raw SAML 2.0 Metadata XML stored in your project's authentication configuration.
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
Manage vanity subdomains for Supabase projects.
Usage of vanity subdomains and custom domains is mutually exclusive.
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.