Documentation

Environment variables

Configuration and secrets for your builds and servers, stored encrypted and scoped to the environments you choose.

Adding a variable

Open the project, choose Environment Variables, then enter a name, a value and the environments it applies to. Names are conventionally upper case with underscores, for example DATABASE_URL.

Environments

EnvironmentUsed by
ProductionProduction deployments.
PreviewPreview deployments. Optionally limited to one branch, so a staging branch can use a staging database.
DevelopmentReserved for local development.

The same name can exist for several environments with different values. A variable limited to a branch wins over the same name set for all previews.

Write-only values

Values are encrypted at rest. After you save one, the dashboard and the API never show it again; you can replace or delete it, but not read it back. If you lose a value, set a new one.

When changes apply

A variable is read when a deployment is built and when its server starts, so a change applies to the next deployment. Existing deployments keep the values they were built with. After changing one, redeploy from the deployment page or push a new commit.

Variables in browser code

Frameworks decide which variables are copied into code sent to the browser, usually by a prefix such as NEXT_PUBLIC_ or VITE_. Anything with that prefix is visible to every visitor, so never put a secret in one. Variables without it stay on the server and in the build.