Environment Variables
Frontend (Next.js)
Set in .env (local) or GitHub Secrets (CI/CD).
| Variable | Required | Default | Description |
|---|---|---|---|
NEXT_PUBLIC_SITE_URL | No | - | Canonical site URL |
NEXT_PUBLIC_POSTHOG_KEY | Yes (prod) | - | PostHog project API key |
NEXT_PUBLIC_POSTHOG_HOST | Yes (prod) | - | PostHog ingest host (https://ph.anshulbisen.com) |
NEXT_PUBLIC_CHAT_WORKER_URL | Yes | http://localhost:8787 | Chat worker URL |
NEXT_PUBLIC_TURNSTILE_SITE_KEY | No | 1x00000000000000000000AA (test key) | Cloudflare Turnstile site key |
NEXT_PUBLIC_APP_VERSION | Auto | From package.json | App version (set in next.config.mjs) |
Chat Worker
Wrangler Vars (Non-secret)
Set in wrangler.toml:
| Variable | Value | Description |
|---|---|---|
ALLOWED_ORIGIN | https://anshulbisen.com | CORS allowed origin |
Wrangler Secrets
Set via wrangler secret put:
| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY | Yes | Google Gemini API key |
SLACK_BOT_TOKEN | Yes | Slack Bot User OAuth Token |
SLACK_SIGNING_SECRET | Yes | Slack app signing secret |
SLACK_CHANNEL_ID | Yes | Slack channel ID for chat threads |
TURNSTILE_SECRET_KEY | Yes | Cloudflare Turnstile secret key |
RATE_LIMIT_BYPASS_TOKEN | No | Token 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)
| Secret | Used By | Description |
|---|---|---|
CLOUDFLARE_API_TOKEN | deploy.yml | Cloudflare API token (Pages deploy + cache) |
CLOUDFLARE_API_KEY | deploy-chat-worker.yml | Cloudflare API key (Worker deploy) |
CLOUDFLARE_EMAIL | deploy-chat-worker.yml | Cloudflare account email |
CLOUDFLARE_ACCOUNT_ID | Both deploy workflows | Cloudflare account ID |
CLOUDFLARE_ZONE_ID | deploy.yml | DNS zone for cache purge |
NEXT_PUBLIC_POSTHOG_KEY | deploy.yml | PostHog project token |
NEXT_PUBLIC_POSTHOG_HOST | deploy.yml | PostHog ingest URL |
SLACK_HOMELAB_TOKEN | notify.yml | Slack token for CI notifications |