Environment variables
vars are public, non-secret values. Structured-clone-compatible JSON enters env.
{ "name": "hello-typescript", "main": "src/index.ts", "vars": { "GREETING": "Hello from TypeScript" }}export default { fetch(_request: Request, env: Env): Response { return new Response(env.GREETING); },} satisfies ExportedHandler<Env>;Regenerate types after changing vars:
npm exec -- wrangler typespnpm exec wrangler typesbun run wrangler typesWrangler writes literals into worker-configuration.d.ts (for example GREETING: "Hello from TypeScript"). Bundles do not contain vars; development and deployment inject them.
Compatibility
Section titled “Compatibility”| Topic | Cloudflare | open-compute |
|---|---|---|
Public strings/JSON on env, not secrets |
Yes — Environment variables | Yes |
Wrangler [vars] TOML |
Yes | Not provided |
| Dashboard editor / Wrangler environments product | Yes | Not provided |
| Unknown top-level keys | May be ignored | Fail the whole project config |
| Where secrets live | Secrets product | secrets, not vars |