Skip to content

Environment variables & secrets

A single reference of every configuration value the platform reads.

Backend (Encore secrets)

Encore separates secrets (sensitive) from runtime config. Both are declared in code via secret("Name") and supplied per-environment.

NameWhere usedLocal sourceProduction source
ResendAPIKeyemail/ service — transactional emailbackend/.secrets.local.cueencore secret set --type prod ResendAPIKey
AdminEmailseed/seedAdmin — initial admin.secrets.local.cueencore secret set --type prod AdminEmail
AdminPasswordseed/seedAdmin — initial admin password.secrets.local.cueencore secret set --type prod AdminPassword
WebURLemail/ templates — base URL in outgoing email links.secrets.local.cueencore secret set --type prod WebURL

Local file format

cue
// backend/.secrets.local.cue (git-ignored)
ResendAPIKey: "re_..."
AdminEmail: "admin@n2e.local"
AdminPassword: "ChangeMe!2026"
WebURL: "http://localhost:3000"

Listing what's set

bash
encore secret list --env=local
encore secret list --env=production

Frontend (Next.js)

Frontend env vars live in monitoring_dashboard/.env.local for local dev and in the Vercel dashboard for hosted deployments.

NameRequiredDescription
NEXT_PUBLIC_ENVIRONMENTyeslocal / staging / production. Switches which backend URL the client talks to.
NEXT_PUBLIC_GOOGLE_MAPS_API_KEYnoBrowser-exposed Google Maps key for the dispatch map. Leave blank for a watermarked dev map.

About NEXT_PUBLIC_ prefixes

Any variable prefixed with NEXT_PUBLIC_ is bundled into the browser. Never put server-side secrets there. The Google Maps key is fine because it should be domain-restricted in the Google Cloud Console.

Per-environment matrix

LocalStagingProduction
Backendencore run (port 4000)Encore Cloud staging envEncore Cloud production env
Backend URLhttp://localhost:4000https://staging-<app>.encr.appYour custom domain or https://<app>.encr.app
Frontendbun run dev (port 3000)Vercel previewVercel production
Frontend env.env.localVercel PreviewVercel Production
NEXT_PUBLIC_ENVIRONMENTlocalstagingproduction
Email deliveryResend test modeResend liveResend live
Telemetrylocal Postgres in DockerEncore-managed PostgresEncore-managed Postgres

Rotating a secret

bash
# backend
encore secret set --type prod ResendAPIKey
# the previous value is immediately superseded; no redeploy required

# frontend
# Update the value in Vercel → Settings → Environment Variables
# Click "Redeploy" to pick up the new value

Sanity-checking config

CheckCommand
Local secrets presentcat backend/.secrets.local.cue
Encore environments configuredencore env list
Encore secret list for an envencore secret list --env=production
Frontend env at build timevercel env pull .env.local

If you change a secret value while the backend is running locally, restart encore run for the new value to take effect.

N2E Fleet Management User Guide.