Skip to content

DocsBuild and deploy

Environment variables

Config variables, encrypted at rest, and secrets the platform never stores: how to add them, when they apply, who sees their values, and the limits.

Environment variables hold what should not be in your code: database addresses, API keys, settings that differ between apps. Your app reads them from process.env. Each one is a Config variable or a secret.

Under Settings, Variables, the page has two sections: Config variables and Secrets.

  • A Config variable is kept by the platform, encrypted at rest. The owner and the admins can read its value back, and it reaches the install, the build and everything that runs inside the app.
  • A secret is write-only. Its value is handed to the running app when you save it and is never kept by the platform: nobody can read it back, the person who set it included. It reaches everything that runs inside the app, but not the install and the build.
Config variable Secret
Readable by the owner and the admins Yes, one value at a time, and in an export No, nobody can read it
Available during the install and the build Yes No
Available to the running app, deploy commands, commands, cron jobs and workers Yes Yes
Bulk edit Yes No
How to change it Edit in its row, or Bulk edit Replace with a new value
Turn it into the other type Make secret Not possible: remove it and add a Config variable

Make a value a secret when only the running app needs it and nobody should read it again: an API key, a database password, a signing key. A value the build needs, such as a token for a private package or a NEXT_PUBLIC_* value, has to be a Config variable.

After the October 2026 incident at another hosting provider, where encrypted environment variables were taken from that provider’s systems, the platform stores nothing it does not need.

Under Config variables, enter a Key and a Value and choose Add.

To change one, choose Edit in its row, give the new value and choose Save. Reveal shows the current value, one variable at a time, to the owner and the admins.

To add many at once, choose Bulk edit and write one KEY=value per line. You can paste the content of a .env file. Lines you remove are deleted when you save. Bulk edit covers Config variables only. See Bulk edit for how the text is read.

A value may hold any text, also several lines. It cannot hold a NUL character, a control character, an invisible character or bytes that are not UTF-8. Such a value is refused with “The value of … contains characters that cannot be used.” or “The value of … holds a NUL character, which a variable cannot carry.” The same rules hold for the value of a secret.

Under Secrets, enter a Key and a Value and choose Add secret. Secrets are added and replaced one at a time.

The value is handed to the running app and is not kept by the platform. It is never shown again, also not to you, and it does not appear in a reveal, an export, bulk edit, the logs or the activity trail.

A row shows the key and when the secret was last set, with two buttons:

  • Replace gives the secret a new value. The current value cannot be shown.
  • Remove deletes the secret.

A secret’s key cannot be renamed: remove the secret and add it again under the new key.

A secret is not there while the app is installed and built. A value the build needs has to be a Config variable, see During the build.

Make secret on a row under Config variables turns that variable into a secret. The value moves at once and is removed from the platform’s storage at once. The dialog says that this cannot be undone and that the build will no longer see the value. Anyone who may set variables may use it: the owner, the admins and the members.

The running app picks the change up with the next deployment, like every change to a variable. That deployment builds the app again, because the build no longer has the value.

A secret cannot be turned back into a Config variable. Remove the secret, then add a Config variable with the same key and a value you know.

Bulk edit covers Config variables only. It shows the app’s Config variables as the text of a .env file and reads your text back the same way. The dialog says: “One KEY=value per line. A value with line breaks is written in quotes with \n. Lines you remove are deleted on save.”

  • Quotes. A value in double quotes, KEY="...", reads \n as a line break, \r and \t as a carriage return and a tab, \" as a quote and \\ as a backslash. A value in single quotes is taken exactly as written.
  • Line breaks. In bulk edit, a value with line breaks shows on one line in double quotes with \n where each break is (KEY="line one\nline two"); write \n there to put a line break in a value. Bulk edit is the way to give a value several lines.
  • Comments. A line that starts with # is skipped, and so is a blank line. In a value without quotes, a # starts a comment, with or without a space before it: A=b#c sets A to b. Put the value in quotes to keep a #: A="b#c".
  • export in front of a name is dropped, so export KEY=value works.
  • Nothing is skipped silently. A line that is not a variable stops the whole save and is named by its number, and nothing is changed. The browser shows the first problem before the text is sent.

Secrets are untouched by bulk edit: they are not in its text, a line you remove deletes a Config variable only, and a line that names a secret is refused.

The text written by bulk edit reads back exactly: a value that holds a #, a quote, a backslash, a line break or a space at either end is written in double quotes for you.

The dialog says What to do
Line 3: not a KEY=value line. Write the line as KEY=value, or remove it
Line 3: … is not a variable name (capital letters, digits, underscores). Rename the variable, see Names
Line 3: names that start with PLATFORM_ are kept for the platform. Choose another name
Line 3: … is set by the platform and cannot be overridden. Remove the line, see Set for you
Line 3: … appears twice. Keep one of the two lines
Line 3: … is a secret. Replace it in the Secrets section. Remove the line, and give the secret its new value with Replace under Secrets
Line 3: the value of … starts with a quote that never closes. Close the quote on the same line, and write \n for a line break
Line 3: the value of … has text after its closing quote. Move the text inside the quotes, or put a # before a comment
The text can hold at most 562 KB. Save the variables in two rounds
The text contains characters that cannot be used. The text is not UTF-8. Save it as UTF-8 and paste it again
A variable was added at the same moment. Open bulk edit again and save once more. Someone added a variable while you edited. Open bulk edit again

Every member of the team may save with bulk edit, as they may add, change and remove variables one by one.

A saved variable reaches the app with the next deployment, a Config variable or a secret alike. After a change, the app shows a notice with Redeploy now: it puts the current version online again with the new values. A change to a Config variable has the next deployment build the app again (see During the build), and so does Make secret, because the build loses the value. Adding, replacing or removing a secret never builds the app again.

Where Config variable Secret
The running app Yes Yes
Deploy commands Yes Yes
Commands Yes Yes
Cron jobs Yes Yes
Workers Yes Yes
Install and build Yes No

Deploy commands, commands, cron jobs and workers run inside the app, so they get its secrets like the running app does. Only the install and the build do not.

Every Config variable is set while the app is installed and built, as it is for the running app. A secret is not. Nothing to switch on for a Config variable that holds:

  • a token for a private package, read by your .npmrc
  • a value your build puts into the built files: NEXT_PUBLIC_*, VITE_*, NUXT_PUBLIC_* and the like

So a value the build needs has to be a Config variable, also when it is a token: add it under Config variables, not as a secret. If it was made a secret, remove the secret and add a Config variable with the same key and the value.

A Config variable is set for the install and the build commands only while they run. It is not stored in the built image.

A value the build wrote into the files changes only with a new build. So after you add, change or remove a Config variable, the next deployment builds the app again, and the notice says so.

A name is made of capital letters, digits and underscores, and does not start with a digit: DATABASE_URL, STRIPE_KEY, MAX_ITEMS.

These are set for every app. You cannot change or remove them:

Variable Value
PORT The port from your build settings: 3000, or the framework’s own, unless you change it
NODE_ENV production

A Valkey cache attached to the app adds five more under its prefix, REDIS_URL, REDIS_HOST, REDIS_PORT, REDIS_USERNAME and REDIS_PASSWORD, set by the platform too, listed under Provided by the platform and removed when it is detached. A Postgres database adds DB_CONNECTION, DB_URL, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD and DATABASE_URL the same way (a second one on the app gets a prefix of its own), and PGCHANNELBINDING once for the app. They are neither Config variables nor secrets. Names that start with PLATFORM_ are kept for the platform as well; among them the platform sets PLATFORM_WAKE_URL_<NAME> for each worker that scales to zero. APP_URL is yours to set: add it here like any other variable when your code reads it. An app made before 2026-10-09 has the one the platform set, with the address of that day, as a variable of its own that you can change or remove.

Role Can add, change and remove variables and secrets, and use Make secret Can see Config values
Owner Yes Yes
Admin Yes Yes
Member Yes No

Nobody can see the value of a secret, the person who set it included: the platform does not keep it.

See Teams for the roles.

Limit
Variables for one app, Config variables and secrets together 200
One value, of a Config variable or a secret 32 KB
All names and values of Config variables together 256 KB
The text of one bulk edit save (Config variables only) 562 KB

A .env file that is not committed does not exist on the platform, and it should not be committed. Add its content under Settings, Variables instead: paste it into Bulk edit as Config variables, then choose Make secret on the ones only the running app needs, or add those under Secrets one at a time. A package like dotenv does no harm: it finds no file and the variables are already set.