What this covers
Environment variables are set per app on its service page and kept across deploys, so you enter them once. Your app reads them when it starts. A few habits prevent nearly every problem we see: secrets committed to Git, a committed .env file that overrides the portal, a typo in a variable name, and a change that never took effect because the app was not redeployed.
Before you start
List the variables your code reads: search your repository for process.env, os.environ, os.getenv, env( or import.meta.env. Keep a .env.example in the repository with those names and placeholder values, never real ones.
How to do it
- Never commit secrets. Add .env to .gitignore. Treat anything that was ever pushed, even if you deleted it later, as leaked, and replace it.
- Don't commit a .env file for production either. The platform passes your variables to the app directly, and some frameworks, such as Next.js, re-read a committed .env at startup and can overwrite them.
- Set exactly the names your code reads. Names are case-sensitive: DATABASE_URL and database_url are different variables. A variable your code never reads does nothing.
- Redeploy after every change. Variables are read when the app starts, so an edited value has no effect until the next deploy.
- Paste values as they are, without quotes.
- Don't set NODE_ENV=production on a Node app. The platform already builds in production mode, and setting it makes the install skip devDependencies, which breaks builds that need TypeScript or a bundler.
- Anything compiled into a frontend is public. Variables such as NEXT_PUBLIC_ or VITE_ values end up in every visitor's browser, so never put a secret in them. A static site has no runtime variables at all.
- Use long random values for SECRET_KEY, APP_KEY, JWT secrets and the like, for example from python3 -c 'import secrets; print(secrets.token_urlsafe(50))', and a different value for each app.
- Laravel: the .env your app reads is built from your .env.example, then production defaults (APP_ENV=production, APP_DEBUG=false), then your portal variables, which win. An APP_KEY is generated once and kept across deploys; set APP_KEY yourself only if another system has to share it.
- If a credential leaks, change it at its source first, then update the variable and redeploy.
- Never paste secret values into a support ticket. Name the variable instead.
What our team checks
Support can check that the variables your app needs are set and that a deploy ran after you changed them. Support never asks for secret values.
Next step
Compare your .env.example with the Environment Variables section of your service, then redeploy.