Reference: Config (Env Vars)
Env vars are the veins of this HUD. Here’s what each one does and which tier reads it.
Web app (web/.env.local)
NEXT_PUBLIC_SUPABASE_URL— Supabase REST endpoint exposed to the browser.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY/NEXT_PUBLIC_SUPABASE_ANON_KEY— Public keys for client reads.SUPABASE_SERVICE_ROLE_KEY— Server-only key with full access; used in API routes + cron handlers.SUPABASE_PROJECT_REF— Supabase project identifier (needed for CLI deploys).NEXT_PUBLIC_DEFAULT_RSS/NEXT_PUBLIC_DEFAULT_TWITTER_HANDLE— Warm-start sources for zero-state HUDs.NEXT_PUBLIC_X_BEARER_TOKEN— Low-throughput token for Twitter ingestion (used server-side only).CRON_SECRET— Shared secret required by/api/cron/*in staging/prod.GEMINI_API_KEY— Optional fallback for AI summaries.
Edge Functions (supabase/functions/*)
SUPABASE_URL(orNEXT_PUBLIC_SUPABASE_URL) — Base URL for Supabase client inside functions.SUPABASE_SERVICE_ROLE_KEY— Gives the worker write access.X_BEARER_TOKEN— Twitter bearer token for the worker; we default to the public env var if present.
Precedence rules we live by
- User-provided Gemini keys (stored in
profiles.ai_settings) beat the sharedGEMINI_API_KEY. - Service-role secrets stay server-side. Never import them into client bundles.
- Cron requests must include
x-cron-secret: <CRON_SECRET>outside local dev.
Warning Suspect a leak? Rotate keys immediately—Supabase’s dashboard and Google Cloud Console both make it a two-click job.