Skip to main content

Environment Contract

Last reviewed: 2026-05-13
Maintained by: Engineering

This is the canonical list of environment variables used by the current setup.

Root API Runtime Variables

VariableRequiredExample local valueUsed forGitHub storage
NODE_ENVyesdevelopmentruntime modevars
PORTyes3000API portvars
DB_HOSTyeslocalhostDB connectionvars
DB_PORTyes5433DB connectionvars
DB_NAMEyeszgridDB connectionvars
DB_USERyespostgresDB connectionvars
DB_PASSWORDyespostgres123DB connectionsecrets
DATABASE_URLyespostgresql://postgres:postgres123@localhost:5433/zgridDB connection / migrationssecrets
JWT_ACCESS_SECRETyesdev-access-secret-change-meaccess token signingsecrets
JWT_REFRESH_SECRETyesdev-refresh-secret-change-merefresh token config validation / auth hardening contractsecrets
JWT_ACCESS_TTLyes15maccess token TTLvars
JWT_REFRESH_TTL_DAYSyes7refresh token TTLvars
WEB_ALLOWED_ORIGINSyeshttp://localhost:3001,http://127.0.0.1:3001CORS allow-listvars
COOKIE_SECUREyesfalseauth cookie policyvars
COOKIE_SAME_SITEyesLaxauth cookie policyvars
COOKIE_DOMAINnoemptycross-subdomain cookie scopevars
EMAIL_PROVIDERyesdev_log locally, resend in staging/productiontransactional email provider selectionvars
EMAIL_FROMyes when EMAIL_PROVIDER is not disabledZgrid <no-reply@zgrid.app>transactional email sendervars
EMAIL_REPLY_TOyes when EMAIL_PROVIDER is not disabledsupport@zgrid.apptransactional email reply-to addressvars
EMAIL_SUPPORT_ADDRESSyes when EMAIL_PROVIDER is not disabledsupport@zgrid.appsupport contact shown in templatesvars
EMAIL_ACTION_BASE_URLyes when EMAIL_PROVIDER is not disabledhttp://localhost:3001absolute base URL for email action linksvars
MANAGER_DESK_URLyes when EMAIL_PROVIDER is not disabledhttp://localhost:3002Manager Desk origin and email URL fallbackvars
RESEND_API_KEYyes when EMAIL_PROVIDER=resendnot set locallyResend API authentication for real deliverysecrets
UPTIMEROBOT_API_KEYnoemptyBack Office System Health uptime monitor checkssecrets
UPTIMEROBOT_MONITOR_IDSnoempty or 123,456Optional monitor filter for System Health uptime componentvars
SENTRY_ENABLEDnofalse locally, true in staging/production when DSN is presentAPI error monitoring togglevars
SENTRY_DSNnoempty locallyAPI Sentry DSNsecrets
SENTRY_ENVIRONMENTnolocal, staging, productionAPI Sentry environment tagvars
SENTRY_RELEASEnoapi@2026.05.13API release tag for issue regression trackingvars
SENTRY_TRACES_SAMPLE_RATEno0 locally, 0.1 in staging, 0.2 in productionAPI trace samplingvars

Manager Desk Runtime Variables

These values belong in apps/manager-desk/.env.local for local work and in the Manager Desk Vercel project settings for hosted environments.

VariableRequiredExample local valueUsed forGitHub storage
NEXT_PUBLIC_API_URLyeshttp://localhost:3000/apiManager Desk API base URLvars
NEXT_PUBLIC_SENTRY_ENABLEDnofalse locally, true when DSN is configuredManager Desk browser error monitoring togglevars
NEXT_PUBLIC_SENTRY_DSNnoempty locallyManager Desk browser Sentry DSNvars
NEXT_PUBLIC_SENTRY_ENVIRONMENTnolocal, staging, productionManager Desk browser Sentry environment tagvars
NEXT_PUBLIC_SENTRY_RELEASEnomanager-desk@2026.05.13Manager Desk browser release tagvars
NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATEno0 locally, 0.05 in staging, 0.1 in productionManager Desk browser trace samplingvars

Back Office Runtime Variables

These values belong in apps/back-office/.env.local for local work and in the Back Office Vercel project settings for hosted environments.

VariableRequiredExample local valueUsed forGitHub storage
NEXT_PUBLIC_API_URLyeshttp://localhost:3000/apiBack Office API base URLvars
NEXT_PUBLIC_SENTRY_ENABLEDnofalse locally, true when DSN is configuredBack Office browser error monitoring togglevars
NEXT_PUBLIC_SENTRY_DSNnoempty locallyBack Office browser Sentry DSNvars
NEXT_PUBLIC_SENTRY_ENVIRONMENTnolocal, staging, productionBack Office browser Sentry environment tagvars
NEXT_PUBLIC_SENTRY_RELEASEnoback-office@2026.05.13Back Office browser release tagvars
NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATEno0 locally, 0.05 in staging, 0.1 in productionBack Office browser trace samplingvars

Zgrid Mobile Runtime Variables

These values belong in apps/zgrid-mobile/.env for local Expo work and in Expo/EAS project environment variables for hosted builds.

VariableRequiredExample local valueUsed forGitHub storage
EXPO_PUBLIC_API_URLyes outside Expo fallback modehttp://127.0.0.1:3000/apiMobile API base URLn/a
EXPO_PUBLIC_APP_ENVnodevelopmentMobile runtime environment labeln/a
EXPO_PUBLIC_EAS_PROJECT_IDnoempty locallyExpo push token registration / EAS project bindingn/a
EXPO_PUBLIC_ENABLE_RESIDENT_PAYMENTSnofalseResident payments feature flagn/a
EXPO_PUBLIC_SENTRY_ENABLEDnofalse locally, true when DSN is configuredMobile Sentry togglen/a
EXPO_PUBLIC_SENTRY_DSNnoempty locallyMobile Sentry DSNn/a
EXPO_PUBLIC_SENTRY_ENVIRONMENTnolocal, staging, productionMobile Sentry environment tagn/a
EXPO_PUBLIC_SENTRY_RELEASEnomobile@2026.05.13Mobile Sentry release tagn/a
EXPO_PUBLIC_SENTRY_TRACES_SAMPLE_RATEno0 locally, 0.05 in staging, 0.1 in productionMobile trace samplingn/a

Deploy-Only Variables

VariableRequiredUsed forGitHub storage
VERCEL_TOKENyes for deploy environmentsVercel CLI deploysecrets
VERCEL_ORG_IDyes for deploy environmentsVercel project bindingsecrets
VERCEL_PROJECT_ID_MANAGER_DESKyes for deploy environmentsManager Desk deploy targetsecrets
RAILWAY_TOKENhistorical / optionallegacy Railway CLI deploy wiring where still presentsecrets
RAILWAY_PROJECT_IDhistorical / optionallegacy Railway project target wiring where still presentvars
RAILWAY_ENVIRONMENT_IDhistorical / optionallegacy Railway environment target wiring where still presentvars
RAILWAY_SERVICE_ID_APIhistorical / optionallegacy Railway API service target wiring where still presentvars

Environment Scope

Local

Local development uses:

  • .env.example as the template
  • root .env as the actual local configuration
  • apps/manager-desk/.env.example as the Manager Desk local template
  • apps/back-office/.env.example as the Back Office local template
  • apps/zgrid-mobile/.env.example as the mobile local template

Email rule for local development:

  • use EMAIL_PROVIDER=dev_log
  • do not add a real RESEND_API_KEY locally unless you intentionally want to test the real provider
  • local placeholders for sender/support addresses and action URLs are expected and should be replaced in staging/production
  • keep all Sentry toggles disabled locally unless you intentionally want to verify Sentry delivery from your own machine
  • a missing Sentry DSN must not block startup; the app should simply run without Sentry

Staging / Production

GitHub Actions expects the same variable names in:

  • Staging
  • Production

Important:

  • deploy validation uses the same names as runtime
  • there is no fallback mapping for required GitHub Environment values
  • environment validation happens during manual deploy, not on every CI push
  • staging/production must set EMAIL_PROVIDER=resend and provide a real RESEND_API_KEY
  • staging/production can enable API Sentry with SENTRY_ENABLED=true plus a real SENTRY_DSN

Manager Desk hosted environments use Vercel project environment variables with the NEXT_PUBLIC_ names above.

Back Office hosted environments use Vercel project environment variables with the NEXT_PUBLIC_ names above.

Mobile hosted builds use Expo/EAS environment variables with the EXPO_PUBLIC_ names above.

Current docs standard note:

  • API hosting in this portal is documented as Render
  • Railway-related deploy variables above should be treated as historical or optional wiring, not the current hosting standard

Rules and Validation

Secrets

These values must not be committed to the repo:

  • DB passwords
  • JWT secrets
  • deploy tokens
  • Sentry DSNs should still be treated as environment-managed values and not hardcoded in source

If you use:

  • COOKIE_SAME_SITE=None

then this must also be true:

  • COOKIE_SECURE=true

Production Rules

Production startup must fail if:

  • JWT_ACCESS_SECRET is still set to the development placeholder
  • JWT_REFRESH_SECRET is still set to the development placeholder

When You Change the Env Contract

If you add or change an environment variable, always update:

Sentry Notes

  • session replay is intentionally not enabled in the current setup
  • source map upload is intentionally deferred; add it only when the deploy pipeline is ready to handle Sentry auth and release publishing safely