GuideConnect Your App

Environment Variables

Configure routing and UI asset delivery, then add application secrets without exposing them to the browser.

9 min readConnect Your AppUpdated for Nexus 0.1
On this page 5

What you will learn

  • Understand every included environment variable.
  • Separate server secrets from public values.
  • Know when a rebuild is required.

Included variables

The distributed .env.example contains four optional values.

dotenv
NEXT_BASE_PATH=
NEXT_PUBLIC_STRIP_APP_PATH=true
NEXUS_UI_CSS_URL=
NEXUS_UI_CSS_INTEGRITY=

Meaning and timing

NEXT_BASE_PATH mounts the whole application below a path. NEXT_PUBLIC_STRIP_APP_PATH enables clean dashboard URLs. Both should be decided before building.

NEXUS_UI_CSS_URL switches from the bundled stylesheet to an external immutable stylesheet. NEXUS_UI_CSS_INTEGRITY verifies that external file. Customers normally leave both empty.

Add your application variables

Only variables prefixed NEXT_PUBLIC_ are exposed to browser bundles. Keep database credentials, private API keys, signing keys, and service secrets server-only.

dotenv
NEXT_PUBLIC_API_BASE_URL=https://api.example.com
DATABASE_URL=server-only-value
AUTH_SECRET=server-only-value

Environment files

Commit .env.example with safe placeholders. Do not commit real .env.local or production secrets. Configure production values through your deployment platform or protected service environment.

  • Development has documented defaults.
  • CI has only the values required to build and test.
  • Production secrets are rotated and access-controlled.
  • A configuration change that affects the client triggers a rebuild.