Skip to content

Environment Variables

Store API keys, secrets and configuration as environment variables in Settings → Env Vars, instead of writing them into the code.

Each variable has a value for one or both targets:

Use this to keep test keys in previews and live keys in production, for example Stripe’s sk_test_… and sk_live_….

Variables are server-only unless their name has your framework’s public prefix, which exposes them to browser code:

FrameworkPublic prefix
Next.jsNEXT_PUBLIC_
Vite, Vite + Hono, TanStack Start, React RouterVITE_
AstroPUBLIC_

Never give a secret a public prefix: anything public ends up in the JavaScript your visitors download.

Custom MCP servers can reference variables as ${NAME} in their URL and headers, so their keys live in one place.

Manage variables over HTTP with the Environment Variables API.