Skip to main content
Every environment variable is validated at startup using Zod schemas. If a required variable is missing or malformed, the app will crash immediately with a descriptive error — no silent failures.

API (apps/api)

The API has the most env vars since it connects to all external services. The Zod schema lives in apps/api/src/env.ts.

Database

VariableTypeDescription
DATABASE_URLURLNeon Postgres connection string

Redis

VariableTypeDescription
REDIS_URLURLUpstash Redis REST URL
REDIS_REST_TOKENStringUpstash Redis authentication token

Supabase Auth

VariableTypeDescription
SUPABASE_URLURLSupabase project URL
SUPABASE_PUBLISHABLE_KEYStringSupabase anon (publishable) key
SUPABASE_SECRET_KEYStringSupabase service role key (server-side only)
SUPABASE_WEBHOOK_SECRETStringSecret for verifying Supabase auth webhook payloads

File Storage

VariableTypeDescription
BLOB_READ_WRITE_TOKENStringVercel Blob read/write token for CSV uploads and exports

Background Jobs

VariableTypeDescription
INNGEST_EVENT_KEYStringInngest event key for sending events
INNGEST_SIGNING_KEYStringInngest signing key for webhook verification

AI

VariableTypeDescription
ANTHROPIC_API_KEYStringAnthropic API key for Claude Haiku column mapping

Email

VariableTypeDescription
RESEND_API_KEYStringResend API key for transactional emails
RESEND_FROM_EMAILEmailDefault sender address (defaults to noreply@folksbase.dev)

Encryption

VariableTypeDescription
ENCRYPTION_KEY64-char hexAES-256-GCM key for encrypting secrets at rest (e.g., user Resend API keys)
Generate one with:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

App Configuration

VariableTypeDefaultDescription
APP_URLURLhttp://localhost:3000Backend URL (used internally)
FRONTEND_URLStringhttp://localhost:3000Frontend origin(s) for CORS. Comma-separated for multiple origins
PORTNumber3001Port the API server listens on
FRONTEND_URL supports multiple origins and wildcards:
# Single origin
FRONTEND_URL=https://folksbase.joselito.dev

# Multiple origins
FRONTEND_URL=https://folksbase.joselito.dev,https://staging.folksbase.dev

# Wildcard subdomain
FRONTEND_URL=*.folksbase.dev
Each origin is validated at startup to start with http://, https://, or *..

Web App (apps/web)

The frontend has three public env vars. The Zod schema lives in apps/web/src/env.ts.
VariableTypeDescription
NEXT_PUBLIC_API_URLURLAPI base URL (e.g., http://localhost:3001/api)
NEXT_PUBLIC_SUPABASE_URLURLSupabase project URL
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEYStringSupabase anon key
All web app env vars are prefixed with NEXT_PUBLIC_ because they’re exposed to the browser. Never put secrets here.

Database (packages/db)

VariableTypeDescription
DATABASE_URLURLNeon Postgres connection string (validated at module load)
This is the same DATABASE_URL used by the API — the packages/db package validates it independently when the module is imported.

E2E Tests (Playwright)

These are only needed when running Playwright tests. They’re read via process.env directly (not Zod-validated).
VariableTypeDefaultDescription
E2E_USER_EMAILStringTest user email (real Supabase credentials)
E2E_USER_PASSWORDStringTest user password
PLAYWRIGHT_BASE_URLURLhttp://localhost:3000Base URL for E2E tests

Rules for Adding New Env Vars

  1. Add the variable to the Zod schema in the relevant env.ts file
  2. Add it to the corresponding .env.example with a comment
  3. Never commit .env files — they’re in .gitignore
  4. Always import from the typed module (import { env } from '@/env'), never use process.env directly