Environment Variables
Required Environment Variables
Ensure all environment variables are configured in Vercel Dashboard → Settings → Environment Variables:
Supabase (Next.js app)
NEXT_PUBLIC_SUPABASE_URL
NEXT_PUBLIC_SUPABASE_ANON_KEY
SERVICE_ROLE_KEY # service role; server-only
SUPER_ADMIN_TEAM_ID # team id of the super-admin team; server-only, hydrated to TeamsContext
Directus (Common Voter Search)
DIRECTUS_API_EMAIL_SEARCH
DIRECTUS_API_PASSWORD_SEARCH
DIRECTUS_URL_SEARCH
The voter-search route also accepts per-request credential keys (
credentials.{name, emailKey, passwordKey, endpointKey}) so a different Directus tenant can be addressed by adding any extraDIRECTUS_API_*env vars and passing the env var names in the request body.
Redis (Upstash)
REDIS_URL # rediss://default:<password>@<host>:<port>
Supabase Edge Functions
Set via the Supabase CLI (supabase secrets set …) or in the Supabase dashboard. Required by the various functions under supabase/functions/**:
# All edge functions
SUPABASE_URL
SUPABASE_ANON_KEY
SUPABASE_SERVICE_ROLE_KEY
# send-email
SMTP_HOST
SMTP_PORT
SMTP_USERNAME
SMTP_PASSWORD
SMTP_SENDER_EMAIL
SMTP_SENDER_NAME
# sync-to-redis
REDIS_URL
Setting Environment Variables in Vercel
- Go to Vercel Dashboard → Your Project
- Navigate to Settings → Environment Variables
- Add each variable for the appropriate environments:
- Production (main branch)
- Preview (all branches)
Environment Variable Best Practices
✅ Do:
- Set variables for all environments
- Use different credentials for dev/staging/production
- Keep
SERVICE_ROLE_KEYsecure (never commit) - Test with production-like values in staging
❌ Don't:
- Commit
.env.localfiles - Use production credentials in development
- Share environment variables in code or PRs