Skip to content

Managing remote config as code

Keep a hosted project's settings in your config file and sync them with the CLI using config diff, pull, and push.

Your config file (supabase/config.toml or supabase/config.jsonc) already defines your local stack. The supabase config commands use the same file for a hosted project: diff shows what differs, pull copies the project's settings into the file, and push applies the file to the project. Your project settings then go through review like the rest of your code.

For the local stack and env() secrets, refer to Managing config and secrets. For every key the file supports, refer to the CLI config reference.

Before you begin

Install the CLI, log in, and link a project:

supabase login
supabase link YOUR_PROJECT_REF

Replace YOUR_PROJECT_REF with your project ref, from the Dashboard URL: https://supabase.com/dashboard/project/YOUR_PROJECT_REF. With no flag, the config commands use SUPABASE_PROJECT_ID if it is set, and the linked project if it is not. To target another project or a branch, refer to Targeting a branch.

Secrets and environment variables

Do not put secret values in your config file. Reference them with env(), as described in Managing config and secrets. For branches, refer to Managing secrets for branches.

  • config diff and config pull never read secret values. The platform masks them, and the CLI prints a Note: that lists the masked keys.
  • config pull skips env() references, so it does not replace them with literal values.
  • config push resolves each declared secret and sends it only when it differs from the hosted value.

Values from environment variables

Environment variables can override values in your file. config diff labels each override, for example (from SUPABASE_AUTH_SITE_URL in supabase/.env.local), and config push prints Pushing N values set by environment variables: … before it asks. The local side of config diff is what config push sends. Refer to Seeing where a value came from.

Key commands at a glance

Use these commands to compare, pull, and push project settings:

CommandWhat it does
supabase config diffShows differences between your config file and a project (read-only)
supabase config diff --exit-codeSame, but exits 2 when it finds a difference (for CI)
supabase config pullWrites a project's settings into your config file
supabase config pull --dry-runShows what a pull writes, without writing
supabase config pushApplies the settings your file declares to a project
--remote=YOUR_PROJECT_REF or --remote=YOUR_BRANCHTargets another project or a branch (all three commands)

See what differs

supabase config diff compares your config file with a hosted project. It never changes your file or the project.

supabase config diff
supabase config diff --remote=staging

The CLI labels each difference:

  • [update]: the setting is in both, with different values.
  • [remote-only]: the setting is on the project but not in your file. The label also marks an undeclared setting whose hosted value differs from the default.
  • [local-only]: the setting is in your file but not on the project.

Local-stack sections, such as [studio], [analytics], [realtime], and ports, never show as differences. db.major_version and [db.pooler] do show, but config push cannot write them. Change those in the Dashboard.

Checking for drift in CI

With --exit-code, config diff exits with status 2 when it finds a difference, and 1 on an error. A CI job can then fail when a project drifts from your repo:

supabase config diff --remote=YOUR_PROJECT_REF --exit-code

For machine-readable output, add --output-format json or --output-format stream-json.

Pull remote config into your file

supabase config pull writes a project's current settings into your config file. Use it to start from an existing project, or to bring in a change that someone made in the Dashboard.

supabase config pull --dry-run
supabase config pull
supabase config pull --remote=staging
  • Preview. --dry-run lists each difference and whether pull writes or skips it. It writes nothing and asks nothing.
  • Confirmation. In a terminal, pull asks first, and the default answer is Yes. With JSON output, pull takes the default without asking. Otherwise, pull reads one line from stdin: y or yes writes, empty input takes the default, and any other answer declines.
  • Small edits. Pull changes only the values that differ, and keeps your comments, ordering, and other keys. Small edits work in config.toml, config.json, and config.jsonc.
  • Uncommitted changes. If your config file has uncommitted git changes, pull warns you, and the default answer changes to No. With --yes, JSON output, or no terminal, pull fails instead. --force skips the check.
  • Secrets. Pull never writes secret values.

Push local config to a project

supabase config push applies the settings your config file declares to the target project.

supabase config push
supabase config push --remote=staging

Push compares your file with the project and sends only the values that differ. Settings that your file does not declare keep their hosted values. Some settings, such as SMTP or an OAuth provider, must be sent as a group. When one value in a group changes, push sends the group and uses the hosted values for the rest.

Push prints the diff for each resource, then asks one question that names the resources and the target. The default answer is No.

Pushing from CI or an agent

Push asks only in a terminal with text output, and never when an AI coding agent runs it. In any other run, push fails before it changes anything, unless you pass --yes:

supabase config push --remote=YOUR_PROJECT_REF --yes

You can also export SUPABASE_YES=1 in your shell. SUPABASE_YES in a .env file does not count, and piped input such as echo y | does not confirm anything. Refer to When the CLI can't ask.

What config push can write

Push writes these sections, in this order:

AreaConfig sectionNotes
Data API (PostgREST)[api]
Database settings[db.settings]
Network restrictions[db.network_restrictions]Only when enabled = true
SSL enforcement[db.ssl_enforcement]Only when the section is in your file
Auth[auth]Includes providers, email templates, and [auth.oauth_server]
Storage[storage]Includes S3 protocol, image transformation, analytics, and vector
Database webhooks[experimental.webhooks]Enable only

Push does not write other settings, such as the database major version, [db.pooler], compute size, and custom domains, even when they are valid in the file. Change those settings in the Dashboard. For Storage buckets and Edge Functions, use supabase seed buckets and supabase functions deploy.

When a push enables a paid add-on, such as phone MFA, it prints the cost before it asks.

Targeting a branch

All three commands accept --remote=YOUR_TARGET. YOUR_TARGET is a project ref, or the name or UUID of a branch of the linked project. A value of exactly 20 lowercase letters is always a project ref.

supabase config diff --remote=my-preview-branch
supabase config pull --remote=my-preview-branch
supabase config push --remote=my-preview-branch

Use =. A bare --remote means the linked project, and it does not read the next word as its value.

To link the CLI to a branch instead, run supabase link my-preview-branch.

Deploying config on merge

If you use Branching with the GitHub integration, you do not need config push for branches. When you push a config change to git, the integration applies it to the matching Supabase branch. To give a persistent branch its own settings, add a [remotes.<name>] block with that branch's project ref as project_id. Refer to Branch configuration and the GitHub integration.

For every command and flag, refer to the CLI reference.