Skip to main content
Each part’s full env table is in its own doc — this page is the map and the gotchas.

Conventions

  • Each part ships two templates, env/env.dev and env/env.prod; a script copies the chosen one to .env: npm run switch_to_dev / switch_to_prod. .env is gitignored.
  • VITE_* (app, admin) and PUBLIC_* (website) are inlined into the built bundle — so switch to prod before building, and never put a secret in one (it ships to every visitor). They’re for public values: URLs, public keys, feature flags.
  • Real secrets live only in the API’s server environment (env.prod on the server) — filled into the REPLACE_ME_* placeholders, never committed. A placeholder left unfilled there counts as unset (that integration stays off); production refuses to start without DATABASE_URL, REDIS_URL, JWT_SECRET and DATA_ENCRYPTION_KEY (see Deployment).
  • A placeholder left unfilled in the app’s env.prod is caught: an optional integration whose value still starts with REPLACE_ME counts as unset and stays off, and npm run build stops if VITE_BACKEND_URL is still one (see App).

Where each part’s variables live

The minimum to boot the backend

DATABASE_URL, REDIS_URL, JWT_SECRET (≥32 chars). Everything else (Google/Apple, SMTP, RevenueCat, OneSignal, admin) is optional and inert until configured — an unconfigured integration returns a clear error rather than crashing at boot.

Cross-part wiring that must agree

  • App → API base: VITE_BACKEND_URL — the API origin.
  • Website support form → API: PUBLIC_SUPPORT_ENDPOINT is the full URL of the API’s POST /v1/support — e.g. https://api.example.com/v1/support. Empty = the form runs in demo mode (validates, then shows an “email us” notice).
  • Support form → your inbox: the API emails each form message to its MAIL_REPLY_TO with Reply-To set to the sender, so SMTP must be configured on the API. Nothing is stored — the in-app ticket inbox is for signed-in accounts only.
  • Admin origin ↔ API CORS: set ADMIN_URL in the API env to the admin’s origin, or CORS refuses it (looks like an auth bug). Native schemes are always allowed.
  • CORS_ORIGINS (API) must list each web origin (app web build, website) exactly.
  • client_id: the app’s VITE_CLIENT_ID must be listed in the API’s CLIENT_IDS (the kit ships both as shipwide), or sign-in fails with unknown_client. Rename them together. The admin’s admin is always allowed.

Gotchas

OneSignal: the app only knows VITE_ONESIGNAL_APP_ID (public). The REST API key is a server secret in shipwide_api — never move it into a VITE_*. See Push & VoIP.
  • VITE_APP_NAME namespaces all local data on the app (encrypted storage, settings, cache, deep-link scheme). Changing it after launch orphans users’ existing local data.
  • Add any new VITE_* to src/vite-env.d.ts — vite/client’s index signature means a typo is not a type error, it just reads undefined.