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.
The config commands change project settings, such as Auth, Storage, the Data API, and database settings. They do not change your schema or data. For schema, use db diff, db pull, and db push with migrations. Refer to Local development workflow.
This guide uses CLI v3 syntax. In v2, the config commands used --project-ref instead of --remote, and config push asked once for each resource. Refer to Migrating to CLI v3.
Before you begin
Install the CLI, log in, and link a project:
supabase loginsupabase link YOUR_PROJECT_REFReplace 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.
The examples use supabase <command>, which works when you install the CLI with Homebrew or Scoop. If you added the CLI as a project dependency, run it through your package runner, for example npx supabase <command>, pnpm supabase, yarn supabase, or bunx supabase.
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 diffandconfig pullnever read secret values. The platform masks them, and the CLI prints aNote:that lists the masked keys.config pullskipsenv()references, so it does not replace them with literal values.config pushresolves 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:
| Command | What it does |
|---|---|
supabase config diff | Shows differences between your config file and a project (read-only) |
supabase config diff --exit-code | Same, but exits 2 when it finds a difference (for CI) |
supabase config pull | Writes a project's settings into your config file |
supabase config pull --dry-run | Shows what a pull writes, without writing |
supabase config push | Applies the settings your file declares to a project |
--remote=YOUR_PROJECT_REF or --remote=YOUR_BRANCH | Targets 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 diffsupabase config diff --remote=stagingThe 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-codeFor 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-runsupabase config pullsupabase config pull --remote=staging- Preview.
--dry-runlists 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:
yoryeswrites, 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, andconfig.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.--forceskips the check. - Secrets. Pull never writes secret values.
Pull writes to the first match in this list:
[remotes.<name>], when you pass--remote-label <name>.- A
[remotes.<name>]block whoseproject_idmatches the target. - A new
[remotes.<branch-name>]block at the end of the file, when you target a branch by name or UUID (not by project ref). A UUID target names the block after the branch's project ref. - The top level of the file.
A top-level write also changes supabase start settings, such as auth.site_url and db.major_version, and pull warns when it does. To write to a [remotes] block instead, pass --remote-label.
Refer to Branch configuration for how [remotes] blocks work.
Push local config to a project
supabase config push applies the settings your config file declares to the target project.
supabase config pushsupabase config push --remote=stagingPush 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.
config push has no --dry-run flag. Run supabase config diff first and review the output.
The file that supabase init creates holds local development values, such as site_url = "http://127.0.0.1:3000" and OAuth providers with enabled = false. If you push that file unchanged, those values replace your hosted settings. For an existing project, run supabase config pull before your first push.
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 --yesYou 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:
| Area | Config section | Notes |
|---|---|---|
| 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.
You can still change settings in the Dashboard. A Dashboard change shows in the next config diff, and config pull adds it to your file. A config push replaces the hosted value with the value in your file, so pull Dashboard changes before you push.
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-branchsupabase config pull --remote=my-preview-branchsupabase config push --remote=my-preview-branchUse =. 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.