Skip to content

Environment Variables

Frontend (Next.js)

Set in .env (local) or GitHub Secrets (CI/CD).

VariableRequiredDefaultDescription
NEXT_PUBLIC_SITE_URLNo-Canonical site URL
NEXT_PUBLIC_POSTHOG_KEYYes (prod)-PostHog project API key
NEXT_PUBLIC_POSTHOG_HOSTYes (prod)-PostHog ingest host (https://ph.anshulbisen.com)
NEXT_PUBLIC_CHAT_WORKER_URLYeshttp://localhost:8787Chat worker URL
NEXT_PUBLIC_TURNSTILE_SITE_KEYNo1x00000000000000000000AA (test key)Cloudflare Turnstile site key
NEXT_PUBLIC_APP_VERSIONAutoFrom package.jsonApp version (set in next.config.mjs)

Chat Worker

Wrangler Vars (Non-secret)

Set in wrangler.toml:

VariableValueDescription
ALLOWED_ORIGINhttps://anshulbisen.comCORS allowed origin

Wrangler Secrets

Set via wrangler secret put:

VariableRequiredDescription
GEMINI_API_KEYYesGoogle Gemini API key
SLACK_BOT_TOKENYesSlack Bot User OAuth Token
SLACK_SIGNING_SECRETYesSlack app signing secret
SLACK_CHANNEL_IDYesSlack channel ID for chat threads
TURNSTILE_SECRET_KEYYesCloudflare Turnstile secret key
RATE_LIMIT_BYPASS_TOKENNoToken for owner/E2E bypass

TypeScript Interface

typescript
interface Env {
  CHAT_SESSION: DurableObjectNamespace;
  THREAD_MAP: KVNamespace;
  SLACK_BOT_TOKEN: string;
  SLACK_SIGNING_SECRET: string;
  SLACK_CHANNEL_ID: string;
  ALLOWED_ORIGIN: string;
  TURNSTILE_SECRET_KEY: string;
  GEMINI_API_KEY: string;
  RATE_LIMIT_BYPASS_TOKEN?: string;  // optional
}

CI/CD Secrets (GitHub)

SecretUsed ByDescription
CLOUDFLARE_API_TOKENdeploy.ymlCloudflare API token (Pages deploy + cache)
CLOUDFLARE_API_KEYdeploy-chat-worker.ymlCloudflare API key (Worker deploy)
CLOUDFLARE_EMAILdeploy-chat-worker.ymlCloudflare account email
CLOUDFLARE_ACCOUNT_IDBoth deploy workflowsCloudflare account ID
CLOUDFLARE_ZONE_IDdeploy.ymlDNS zone for cache purge
NEXT_PUBLIC_POSTHOG_KEYdeploy.ymlPostHog project token
NEXT_PUBLIC_POSTHOG_HOSTdeploy.ymlPostHog ingest URL
SLACK_HOMELAB_TOKENnotify.ymlSlack token for CI notifications