The short answer
Keep secrets out of the repository. On Unbroker each variable is All, Production, or Preview. A new preview copies All and Preview, and it never copies Production-only values.
NEXT_PUBLIC_* and VITE_* are public in the client bundle even when you load them from Variables. A running revision picks up a runtime change only after you redeploy.
What belongs in the repo vs in the platform
A flag that is safe to publish can live in source. A database password, an API key, and a session signing secret belong in the service’s Variables view. Do not commit them.
The deployment reference says never to commit production secrets, to store them in the service configuration, and to rotate them if they are exposed. The guide adds screenshots and agent prompts to that list.
| Value | Where it belongs |
|---|---|
| Public feature flag | The repository, when publishing it is acceptable |
| Browser-facing API origin | Public frontend configuration |
| Database password or connection string | Backend runtime variable |
| Session signing secret | Backend runtime variable |
| Beacon public key | May be included in frontend configuration |
| Beacon JWT signing secret | Backend only |
That split is the same for an app that started in Lovable, Bolt, or Cursor. What a public page still does not prove is an AI-built app in production. A frontend and an API in one project still get different variables: the public origin on the frontend, the database URL on the API. The layout is frontend and API.
Scopes: All, Production and Preview
All, Production, and Preview are the three scopes. Those names stay in English in the UI.
All covers production and preview environments. Variables that already exist stay on All until you change them. Production covers production. The reference describes that choice as only the production project. Preview covers non-production environments, including pull request previews and named environments such as staging.
The same key can hold a different value on each scope. Inside a service or a project, the environment-specific value overrides All. A reference to another service’s variable resolves in the deployment’s environment.
Set a production API origin under Production and a staging origin under Preview. Do not put a production database credential in All unless you intend every new preview to receive it. That is the production vs preview split.
Pasting a .env file imports every variable into the scope you selected. Editing or deleting a variable affects only that variant. To change the scope and keep the stored secret, leave the new value blank.
The October 6 note is environment variables for production and previews.
Service variables vs shared project variables
A service variable belongs to one application. A shared project variable is a shared environment variable for the project, used when several services need the same setting. The service variable overrides the shared one when the key matches.
Use the shared variable for a value that really is common. Use the service variable when one service needs a different database or a different key.
Shared project variables require Pro. Free does not include them. Pull request previews require Pro as well. Pro is $25 a month with $25 of usage credit. The credit resets each billing cycle and does not roll over. If eligible usage stays under the credit, the monthly charge is still $25. The rows are on pricing and in Plans. What Free leaves out is free backend hosting.
Public build variables vs runtime secrets
NEXT_PUBLIC_* and VITE_* are public build variables. Next.js public env vars use the NEXT_PUBLIC_ prefix. Unbroker selects those prefixes for the target environment before the build. A value that ends up in the JavaScript bundle is public even if you typed it in Variables. When that public value is the API origin the browser should call, the build order, CORS, and cookies are deploy a frontend and an API separately.
Other variables stay runtime-only, except package-registry credentials. For a generated JavaScript build or a custom Dockerfile, set NODE_AUTH_TOKEN or GITHUB_TOKEN on the service or as a shared project variable. Unbroker prefers a non-empty NODE_AUTH_TOKEN, then falls back to GITHUB_TOKEN. The selected credential is mounted as a BuildKit secret and exposed under both names during dependency install. It is not passed as a build argument, and it is not baked into an image environment variable. NODE_AUTH_TOKEN is removed from the runtime environment. GITHUB_TOKEN can remain at runtime for an app that also calls the GitHub API. For GitHub Packages, use your own personal access token with read:packages. A Dockerfile receives a variable only when it requests --mount=type=secret. Declaring ARG does not supply the value. The reference is environment variables.
A Next.js server starts at Deploy Next.js. What changes between next dev and that server, including NEXT_PUBLIC_ at build time, is Next.js in production. Changing a public origin is a separate step from attaching a hostname. DNS and the certificate are custom domain and HTTPS.
What new previews copy (and what they never copy)
A new preview copies All and Preview. It never copies a Production-only variable.
Each preview is an independent copy. Changing the parent variable does not rewrite a preview that already exists. Marking the variable Production does not revoke a secret that preview already stored. Remove it on that preview, or recreate the preview, and rotate the credential if it may have been exposed. Changing the label is not revocation.
Automatic pull request previews run only branches from the connected repository. An external fork is skipped, because that code could read the preview’s secrets. Previews inherit the source service’s access protection and its Wait for CI setting. Closing or merging the pull request removes the preview. Activity refreshes a seven-day expiration. How to keep the database off production is pull request preview environments.
Apply, verify, rotate
Open the service, pick the scope, and enter the value in Cloud. Redeploy so the running revision uses the new runtime configuration. If the value is compiled into frontend assets, that change needs a new build as well.
When automatic deploys are on, a push to the configured branch queues a deployment. That deployment is what applies the variable. The branch, watch paths, and waiting for GitHub checks are deploy on git push.
Verify with an application request. Do not print the secret. For a database URL, run a bounded query. For an API origin, look at the browser request destination. Do not dump the whole environment into logs.
Where the upstream service supports overlapping credentials, create the replacement, update the variable, redeploy, and verify before you revoke the old value. When overlap is impossible, use the maintenance window that provider requires. Check workers and other consumers, not only the web service. Worker services require Pro.
Agents and prompts
Give the agent the key names and the scopes. Enter secret values in Cloud. Do not put them in the prompt, the repository, or a screenshot.
MCP service inspection does not return credentials or environment variable values. get_service reads a service without them. How to limit the token is letting a coding agent deploy safely. An app built in Cursor still uses the same split. The checklist is deploy with Cursor.
How this works on Unbroker
For PaaS secrets management, Unbroker uses the Variables view. You choose the key, the value, and the scope. Shared project variables and pull request previews require Pro. An external fork does not get an automatic preview.
Checklist
- Keep production secrets out of the repository, screenshots, and agent prompts.
- Put a connection string in Variables. Leave a public flag in source only when publishing it is acceptable.
- Scope a production credential to Production. Do not leave it on All.
- Point Preview at a database or API key you can throw away.
- Let a service variable override a shared project variable when one service needs a different value.
- Treat
NEXT_PUBLIC_*andVITE_*as public. They are chosen before the build. - Redeploy after a runtime change. Rebuild when the value is compiled into frontend assets.
- After you tighten a scope, edit or recreate previews that already copied the old value.
- Rotate a leaked password with overlap when the provider allows it, then check workers and other consumers.
- Give an agent names and scopes. Enter secret values in Cloud.
FAQ
Where should I store API keys for a deployed app?
In the service's Variables view in Cloud, not in the repository and not in a committed .env. A production key belongs on Production. Give Preview a test key, and leave a value on All only when every new preview should receive it. The steps are the environment variables guide.
What's the difference between All, Production and Preview environment variables?
All applies to production and to preview environments. Production applies to production. The reference describes that choice as only the production project. Preview applies to non-production environments, including pull request previews and named environments such as staging. For the same key, the environment-specific value overrides All inside that service or project.
Do pull request previews get production secrets?
A new preview copies All and Preview and does not receive Production-only values. A production secret left on All is copied. An existing preview keeps the copy it already has, and marking the variable Production does not remove that copy. Pull request previews require Pro. The map is pull request preview environments.
Are NEXT_PUBLIC_ or VITE_ variables secret?
No. Those prefixes are public build variables. Unbroker selects them for the target environment before the build. A value that lands in the JavaScript bundle is public even when you typed it in Variables.
Do I need to redeploy after changing a variable?
Yes. Redeploy the service so the running revision uses the new runtime value. If that value is compiled into frontend assets, the change needs a new build as well.
What are shared project variables and do they need Pro?
A shared project variable is one setting several services in the project can use. A service variable with the same key overrides it. Shared project variables require Pro, and Free does not include them. Pro is $25 a month with $25 of usage credit. See pricing and Plans.
How do I rotate a leaked database password?
When the database allows two passwords at once, create the replacement, update the variable, redeploy, and verify with a bounded query before you revoke the old password. When overlap is not possible, use the maintenance window that provider requires. Edit or recreate previews that already copied the old value. Check workers and other consumers, not only the web service. Do not print the password in logs.
Can a coding agent see my secret values?
MCP service inspection does not return them. The get_service tool inspects a service without credentials or environment variable values. The agent still sees a secret you paste into the prompt, the repository, or a screenshot. Give it names and scopes, and enter values in Cloud. Token limits are in letting a coding agent deploy safely.