Skip to main content
See what's recently landed on the Neon backend: Object Storage, Functions, AI Gateway, and more
/APIs & SDKs/Configuration commands/deploy

Neon CLI command: deploy

Apply a neon.ts policy to a branch

View as Markdown

The deploy command applies a neon.ts policy to a branch. It is a top-level alias of neon config apply, with the same options.

neon deploy [options]
OptionDescriptionTypeDefaultRequired
--allow-protectedApply to a branch marked protected on Neon without askingbooleanfalseNo
--branchBranch ID or namestring—No
--configPath to a neon.ts policy (defaults to the neon.ts next to .neon, or in cwd without one)string—No
--envPath to a .env file to load into the environment before evaluating neon.ts so Function env values resolve from it. Existing env vars are not overridden. Required Function env (declared required: true, or required: "default-branch" when deploying the default branch) and values that read process.env must be set in this file or the environment.string—No
--env-pullPull the branch's Neon env vars (DATABASE_URL, …) into a local .env after a successful apply. On by default; use --no-env-pull to skip (e.g. when injecting env at runtime with neon-env run / neon dev).booleantrueNo
--project-idProject IDstring—No
--update-existingOverride branch settings that differ from neon.ts without askingbooleanfalseNo
--yes, -yAnswer yes to every confirmation: --update-existing and --allow-protectedbooleanfalseNo

In a terminal, deploy asks before it overrides branch settings that differ from neon.ts or applies to a branch marked protected on Neon. Declining applies nothing.

If neon.ts declares Realtime under preview.realtime, neon deploy enables it on the branch, and the default env pull waits until it's ready and writes NEON_REALTIME_URL and NEON_REALTIME_SECRET.

Without a terminal, there's no prompt. This covers CI, runs with no TTY, and -o json or -o yaml output. In those cases, deploy stops before changing anything and names the flag to re-run with. For scripts, CI, and agents, pass --update-existing to allow the overrides, --allow-protected to allow a protected branch, or -y for both:

neon deploy --branch feature/auth -y

Last updated on

Was this page helpful?
Edit on GitHub