Skip to main content

Environment and configuration

The typed list is Env in api/src/env.ts. See Configuration for how the three sources (wrangler.jsonc, .dev.vars, secrets) fit together.

Bindings​

BindingTypePurpose
ASSETSFetcherWorkers Static Assets: the built SPA in frontend/dist, with single-page-application fallback. /api/* runs the Worker first.
DBD1DatabaseThe D1 database claimpilot-chat. Used when DATABASE_PROVIDER is d1.

Variables​

VariableKindDefault in codePinned in wrangler.jsoncNotes
DATABASE_PROVIDERvard1d1 (default env), neon (env.neon)d1, neon or none
DATABASE_URLsecretnonenoNeon connection string
AI_PROVIDERvarGemininoscripted for tests only
GEMINI_API_KEYsecretnonenoGoogle AI Studio key
GEMINI_MODELvargemini-3.1-flash-liteyesText chat
GEMINI_LIVE_MODELvargemini-3.1-flash-live-previewyesVoice
GENERATOR_MODELvarGEMINI_MODELyesClaim generator
GEMINI_THINKING_LEVELvarmodel defaultno (commented example)low, medium, high; anything else is ignored
GEMINI_VOICEvarCharonyesPrebuilt Live voice
AI_GATEWAY_ACCOUNT_IDvarnoneyesWith AI_GATEWAY_ID, turns the gateway on
AI_GATEWAY_IDvarnoneyes (claimpilot-chat)Blank values count as unset
CF_AIG_TOKENsecretnonenoRequired when the gateway is authenticated
ALLOWED_ORIGINSvarunset: no cross-origin embeddingyesComma-separated; :* matches any numeric port
EMBED_KEYsecretunset: opennoGates chat, voice and feedback

/api/health reports the models, the store and the gateway actually in use.

The e2e Worker​

The Playwright suite runs its own Worker with e2e/worker.env, which sets AI_PROVIDER=scripted, DATABASE_PROVIDER=d1, blanks every key, URL and gateway id, and allows one test origin (http://allowed.example). It holds no secrets and stops wrangler reading api/.dev.vars.

The CLI​

npm run generate and npm run copy-claims run in plain Node. They read GEMINI_API_KEY, GENERATOR_MODEL, DATABASE_URL and the gateway variables from the environment, or from api/.dev.vars for anything unset (loadDevVars). db/migrate.mjs reads DATABASE_URL the same way.

The docs site​

VariableDefaultPurpose
DOCS_URLhttp://localhost:3000The site's public URL, for canonical links and the sitemap
DOCS_BASE_URL/The path it is served under