Files, code and terminal

Environment variables (.env) for apps

Keep secrets out of your code: add, edit and remove variables as key/value rows.

  1. Add them
  2. Read them in code
  3. Set for you

Add them

App settings → Environment variables shows each variable as a key and value you can edit. Press + Add variable for a new row, type the key (e.g. DATABASE_URL) and value, then Save on that row or Save all. The bin icon removes a row. To add many at once, open Paste a .env file, paste one NAME=value per line and save. The app restarts with the new values.

Read them in code

process.env.DATABASE_URL          // Node.js
os.environ['DATABASE_URL']        # Python
System.getenv("DATABASE_URL")     // Java

Set for you

  • PORT — the port your app must listen on
  • HOST — 127.0.0.1
  • NODE_ENV / APP_ENV — production or development (App settings → Mode)

Stuck? Our engineers answer support tickets around the clock. Contact us, or create an account and open a ticket from the dashboard — the same guides are there too.

Next step

Move your site, or your whole cloud estate

Shared hosting you can buy in two minutes. Infrastructure and managed services quoted by an engineer within one business day.