Your app's environment

Every environment variable your app runs with, who sets it, and how to see the list from the console, the CLI or your assistant.

Your app's environment

Every app on the Ghosty platform runs with a set of environment variables. Some you create yourself (secrets and settings), the rest the platform sets for you. Since it can be hard to remember which ones are there, the platform lists all of them in one place — by name and by who sets them. Secret values are never shown anywhere.

Where to see the list

  • Console → your app → Secrets tab → the Environment card.
  • CLI: run ghosty env inside the app folder (ghosty env --json for tooling).
  • Your assistant: the Ghosty MCP tool list_environment — ask "what environment variables does my app have?" before changing code that reads one.

Each variable shows its source:

Source What it means Value shown?
Platform Set by the Ghosty platform when it runs your app. No — "Set by the platform".
Your secret A secret you saved (console Secrets tab or ghosty secret <name>), available as UPPER_SNAKE_CASE of its name. Never — secret values are write-only.
App config A plain setting you wrote in app.config.json under env, applied to the running app by ghosty provision. Yes — it lives in your own repository already. A setting whose name looks like a credential (…_KEY, …_TOKEN, …_PASSWORD, …) is masked.
Access mode Set by the platform for the app's access mode (invite link code, member sign-in key). No.

What the platform sets

Always:

  • NODE_ENVproduction.
  • APP_NAME — your app's slug.
  • GCP_PROJECT_ID — an internal identifier for your workspace. Nothing to configure.
  • PORT, K_SERVICE, K_REVISION, K_CONFIGURATION — set by the runtime when it starts your app; your app must listen on PORT.

When the feature is on:

  • DATABASE_URL — the connection to the Ghosty database, when your app has a database. Treated as a secret.
  • DB_SERVER_CA — the certificate your app uses to verify its database connection (public, not a secret).
  • FILE_STORAGE_BUCKET — the name of your app's private file storage, when file storage is enabled.
  • GHOSTY_INTEGRATIONS_URL and GHOSTY_INTEGRATIONS_TOKEN — how your app talks to the integrations gateway (the token is a secret). Every app gets these on its first publish.
  • INVITE_CODE — in invite mode, the code behind your shareable link (see the Access tab for the link).
  • ACCESS_GATE_SECRET — in members mode, the key that verifies member sign-ins. Treated as a secret.

These names are reserved: a secret you create cannot use one of them, and a setting in app.config.json with one of these names is ignored.

Changing a setting

Plain settings (feature flags, log levels — never credentials) live in app.config.json under env:

{
  "env": { "FEATURE_FLAG": "on", "LOG_LEVEL": "info" }
}
  • Add or change one: edit the file and run ghosty provision (or /provision with your assistant). The setting is applied to the running app right away — you'll see it in the list as App config. Publishing your code (ghosty deploy) on its own does not apply a changed setting.
  • Switch one off: keep the name and give it an empty value (""), then run ghosty provision. A setting you delete from the file keeps its last value on the running app until you replace it — the platform only adds and updates settings, it never removes them on its own.
  • Secrets are different: ghosty secret <name> applies the value to the running app immediately, no provision needed.

While the app is still setting up

Right after you create an app, the list shows what its first launch will inject (the console says "once it finishes setting up"). Settings from your own app.config.json appear in the console once the app is running; ghosty env and your assistant already include them from the file in your folder.

Debugging "why is X undefined"

  1. Open the list and check the exact name — variables are case-sensitive.
  2. If it's a secret you expected: save it from the Secrets tab or with ghosty secret <name>; it is applied to the running app right away.
  3. If it's a plain setting: add it to app.config.json under env and run ghosty provision — publishing alone does not apply settings.
  4. Locally, ghosty dev reads backend/.env.local — a value that works locally but not in production usually means the secret was never saved on the platform. See Secrets and local development.