Back to documentation
Ownership & Security

Environment Variables Explained

What environment variables are, which values are safe in the browser, and how 9orb keeps secrets out of your code.

Environment variables are named settings an app reads while it runs — a database address, a secret used to sign sign-in sessions, configuration. They exist so that secrets and settings live outside the code.

You usually do not need to touch them

For apps it hosts, 9orb sets the required values automatically. For example, every app gets its database address and a freshly generated signing secret:

# Set by 9orb automatically — server-only, never in the code
DATABASE_URL=postgresql://...
APP_SECRET=(generated for your app)

These values are never committed to the code repository.

The critical distinction: public vs secret

In Next.js projects, a variable's name decides where it is visible:

  • Names starting with NEXT_PUBLIC_ are compiled into the code that runs in the browser. Anyone can see them. Only genuinely public values may use this prefix.
  • All other names exist only on the server. The browser never sees them.
Never "fix" a missing-variable error by adding NEXT_PUBLIC_ to a secret's name. That publishes the secret to every visitor.

Seeing your project's variables

The project's Environment page lists the variables your product uses. The JSON export of a project includes their names (never their values).