Your runtime variables are attached to your environment's Worker when a deployment is published, along with Hiraiship's system variables. Code running at the edge reads them from its env, the object Cloudflare Workers pass to every request. A variable available at build only isn't there; see Build variables.
A Next.js Server Component rendered on request, or a route handler, reads them from cloudflare:workers:
app/api/status/route.ts
import { env } from 'cloudflare:workers';export function GET() { return Response.json({ configured: Boolean(env.API_TOKEN) });}
Frontends
A static frontend (Vite, a client-rendered Rasengan.js app, a static site) has no code at the edge: its files are served as they are, so it can't read variables at runtime. Values it needs must be in the bundle: make them build variables. Only put values there that anyone may see.
Values are strings
Every variable is a string. Parse numbers and booleans yourself: