Configuration & Environment Variables

All configuration lives in .env.local (copy it from .env.local.example). This page groups the variables by what they're for and which ones must stay server-only.

Supabase

VariableServer-only?Notes
NEXT_PUBLIC_SUPABASE_URLNoPublic by design
NEXT_PUBLIC_SUPABASE_ANON_KEYNoRLS-governed, safe to ship to the browser
SUPABASE_SERVICE_ROLE_KEYYesBypasses RLS entirely — never expose this to the client. The widget's public API routes use it because anonymous visitors have no Supabase session for RLS to check

AI Providers

VariableNotes
OPENAI_API_KEYRequired — the widget chat endpoint is fixed to gpt-4o-mini for v1
ANTHROPIC_API_KEYOptional, used by the dashboard chat feature inherited from the base template

Stripe (owner billing)

VariableNotes
STRIPE_SECRET_KEYServer-only
STRIPE_WEBHOOK_SECRETServer-only, verifies incoming webhook signatures
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYClient-side checkout
NEXT_PUBLIC_STRIPE_PORTAL_URLCustomer portal link
STRIPE_PRO_PRICE_ID / STRIPE_TOPUP_PRICE_ID / STRIPE_ENTERPRISE_PRICE_IDPrice IDs from your Stripe dashboard

Widget usage is billed against the bot owner's credit balance — a visitor never sees Stripe.

App

VariableNotes
NEXT_PUBLIC_APP_URLUsed to build the widget's iframe src and OAuth redirect URIs — must be the real deployed URL in production, not localhost
CRON_SECRETProtects scheduled credit-reset endpoints

Email (widget lead notifications)

VariableNotes
RESEND_API_KEYOptional — without it, lead capture still writes to the leads table, but the owner doesn't get an email
EMAIL_FROMThe From address Resend sends lead/credit-exhausted notifications from

CRM booking integrations (Phase 9 scaffold)

VariableNotes
JOBBER_CLIENT_ID / JOBBER_CLIENT_SECRETOnly needed if you're wiring up the Jobber OAuth connect flow
HOUSECALL_PRO_CLIENT_ID / HOUSECALL_PRO_CLIENT_SECRETSame, for Housecall Pro

These only enable the OAuth connect flow — see CRM Integrations for what's real versus stubbed before you rely on them.

Validating your setup

After filling in .env.local, run the built-in checklist rather than guessing:

pnpm dev

Then visit /dashboard/setup — it checks env vars and confirms the database schema was applied correctly.