Skip to main content

Environment Variables

Copy .env.example to .env.local and fill in the values.

Required Variables

VariableDescriptionWhere to Get It
NEXT_PUBLIC_SUPABASE_URLSupabase project URLSupabase Dashboard > Settings > API
NEXT_PUBLIC_SUPABASE_ANON_KEYSupabase anonymous/public keySupabase Dashboard > Settings > API

Optional Variables

VariableDescriptionWhen Needed
SUPABASE_SERVICE_ROLE_KEYSupabase admin key (bypasses RLS)E2E test user setup, admin scripts
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYStripe public key (test mode)Billing features
STRIPE_SECRET_KEYStripe secret key (test mode)Billing API calls
STRIPE_WEBHOOK_SECRETStripe webhook signing secretProcessing Stripe events
TEST_USER_EMAILE2E test user emailRunning Playwright tests
TEST_USER_PASSWORDE2E test user passwordRunning Playwright tests

Example .env.local

# Supabase (required)
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIs...

# Supabase Admin (optional)
SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIs...

# Stripe (optional - only for billing features)
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

# E2E Testing (optional)
TEST_USER_EMAIL=e2e.test.hostmetrics@gmail.com
TEST_USER_PASSWORD=E2ETestPassword123!
Never commit .env.local to git. It’s already in .gitignore. The SUPABASE_SERVICE_ROLE_KEY and STRIPE_SECRET_KEY are sensitive — never expose them in client-side code.

Vercel Deployment Variables

When deploying to Vercel, add these same variables in your Vercel project settings under Settings > Environment Variables. Use production Supabase and Stripe keys (not test keys) for the production environment.