Environment variables
Set the variables your app reads, keep secrets hidden, and share one value with several apps.
API keys, database URLs, NODE_ENV. Set them on the app's Environment tab. The app gets them
at build time and at run time.
Add variables
Type the name and the value
Turn on Secret for a credential. To add many at once, paste a whole .env into the Key
field: you get one row per line. Save in the bar at the bottom adds them all.

Redeploy
Variables reach the app on the next deploy. Click Redeploy on the Changes not deployed yet notice.
The arrow next to Add also offers Database, to connect a managed database's connection string.
Plain and secret
| Plain | Secret | |
|---|---|---|
| Shown again | Yes | Never |
| Edit | Yes | No: delete it and add it again |
| Change the type | To secret, with Edit or Make Secret on selected rows | Never back to plain |
A plain variable named like a credential, such as DB_PASSWORD, gets a warning icon.
Share a variable with several apps
One value, like a SENTRY_DSN, that several apps use. Change it once and every app gets it on its
next deploy.
Create it
Variables in the sidebar, the Shared tab, then New shared variable. Secret applies to every row.

Pick who it is offered to
| Scope | Offered to |
|---|---|
| This team | Every app in the team |
| Projects | The apps of the projects you pick, or only of some of their environments |
| Specific apps | The apps you pick. The only scope that adds it to them right away |
Add it to the app
On the app's Environment tab, the arrow next to Add, then Shared. An offered variable reaches nothing until an app adds it. Then redeploy.

Remove from this app, on the row, drops it from this app only. Creating or changing a shared variable needs Manage environment variables on the whole team.
Which value wins
When one name is set in several places, the app gets the first of:
- A preview override, on a pull request preview only. They are in the Preview overrides section of the Environment tab.
- A shared variable the app has added.
- The app's own variable.
In a Compose app, a key the compose file sets itself keeps the compose value.
Good to know
- A
Dockerfilebuild sees only the names it declares withARG, likeARG NEXT_PUBLIC_API_URL. Any other build gets every variable. - A
.env.examplein the repository lists its names at the top of the tab, with a warning icon, until you give each a value. - A preview built from a fork gets only the plain preview overrides.
Something wrong? See Deploys and builds.
Did this page help you?
