Environment Variables

Complete reference of all environment variables organized by service with scope, defaults, and configuration notes

Kit uses 100+ environment variables configured in apps/boilerplate/.env.local. This page is a complete reference organized by service. For setup instructions, see Configuration. For deployment, see Production Checklist.

Naming Convention

Next.js enforces a strict naming rule for environment variable visibility:
  • NEXT_PUBLIC_ prefix — Exposed to the browser (client-side). Bundled into JavaScript at build time.
  • No prefix — Server-only. Available in API routes, middleware, and server components. Never sent to the browser.
Table columns:
  • Name — The environment variable name
  • ScopeClient (browser-accessible) or Server (server-only)
  • Required — Whether the app needs this variable to function
  • Default — Value used when not set (blank = no default, must be configured)
  • Description — What the variable controls

Core Application

NameScopeRequiredDefaultDescription
NEXT_PUBLIC_APP_URLClientYeshttp://localhost:3000Application base URL for links, redirects, and CORS
NODE_ENVServerAutoEnvironment: development, production, test
CRON_SECRETServerProdBearer token for Vercel Cron Job authentication

Authentication (Clerk)

NameScopeRequiredDefaultDescription
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYClientYesClerk public key for frontend auth components
CLERK_SECRET_KEYServerYesClerk secret key for server-side auth operations
CLERK_WEBHOOK_SECRETServerYesSvix signature verification for Clerk webhooks
NEXT_PUBLIC_CLERK_SIGN_IN_URLClientNo/loginSign-in page URL (hash routing: /login#)
NEXT_PUBLIC_CLERK_SIGN_UP_URLClientNo/registerSign-up page URL (hash routing: /register#)
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URLClientNo/dashboardRedirect URL after successful sign-in
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URLClientNo/dashboardRedirect URL after successful sign-up
NEXT_PUBLIC_CLERK_ENABLEDClientNotrueSet to false to disable Clerk (test/demo environments)
NEXT_PUBLIC_DEMO_MODEClientNofalseEnable demo mode — bypasses authentication entirely

Database (Supabase + Prisma)

NameScopeRequiredDefaultDescription
DATABASE_URLServerYesPostgreSQL connection URL with PgBouncer pooling
DIRECT_URLServerYesDirect PostgreSQL URL for Prisma migrations (no pooling)
NEXT_PUBLIC_SUPABASE_URLClientYesSupabase project URL
NEXT_PUBLIC_SUPABASE_ANON_KEYClientYesSupabase anonymous key (client-side, RLS-enforced)
SUPABASE_SERVICE_ROLE_KEYServerYesSupabase service role key (bypasses RLS)

Payments (Lemon Squeezy)

Core Configuration

NameScopeRequiredDefaultDescription
LEMONSQUEEZY_API_KEYServerYesLemon Squeezy API key for payment operations
LEMONSQUEEZY_STORE_IDServerYesYour Lemon Squeezy store ID
LEMONSQUEEZY_WEBHOOK_SECRETServerYesHMAC signature verification for payment webhooks
LEMONSQUEEZY_TEST_MODEServerNofalseEnable test mode for payment testing

Variant IDs

Variant IDs link your Lemon Squeezy products to the app's subscription tiers. The required IDs depend on your active pricing model.

Pricing Model

NameScopeRequiredDefaultDescription
NEXT_PUBLIC_PRICING_MODELClientYescredit_basedActive pricing model: credit_based or classic_saas
CURRENCYServerNoEURISO 4217 currency code
PRICING_TIERSServerNobasic,pro,enterpriseComma-separated list of available tiers
PRICING_FREE_TIER_ENABLEDServerNotrueEnable free tier for both models
PRICING_FREE_TIER_NAMEServerNoFree ForeverDisplay name for the free tier

Email (Resend)

NameScopeRequiredDefaultDescription
RESEND_API_KEYServerYesResend API key for sending emails
RESEND_FROM_EMAILServerYesSender email address (e.g., noreply@yourdomain.com)
RESEND_WEBHOOK_SECRETServerYesHMAC signature verification for delivery webhooks
NEXT_PUBLIC_CONTACT_EMAILClientYesPublic contact email displayed on website

File Storage (Vercel Blob)

NameScopeRequiredDefaultDescription
BLOB_READ_WRITE_TOKENServerYesVercel Blob token for file upload and download

AI Integration

Provider Configuration

At least one AI provider API key is required for AI features to function. The system auto-detects available providers based on which keys are set.
NameScopeRequiredDefaultDescription
AI_PROVIDERServerNoAuto-detectForce a specific provider: openai, anthropic, google, xai
AI_MODELServerNoProvider defaultOverride the default model for the selected provider
OPENAI_API_KEYServerConditionalAPI key for OpenAI (GPT models)
ANTHROPIC_API_KEYServerConditionalAPI key for Anthropic (Claude models)
GOOGLE_AI_API_KEYServerConditionalAPI key for Google (Gemini models)
XAI_API_KEYServerConditionalAPI key for xAI (Grok models)
AI_API_KEYServerNoUniversal fallback key — used when no provider-specific key is set for the active AI_PROVIDER, and as embedding key fallback
AI_EMBEDDING_MODELServerNotext-embedding-3-smallEmbedding model for RAG vector generation (must be OpenAI-compatible)

Provider Overrides

NameScopeRequiredDefaultDescription
OPENAI_BASE_URLServerNoOpenAI defaultCustom base URL (for proxies or Azure OpenAI)
OPENAI_ORG_IDServerNoOpenAI organization ID
ANTHROPIC_BASE_URLServerNoAnthropic defaultCustom base URL for Anthropic API
GOOGLE_AI_BASE_URLServerNoGoogle defaultCustom base URL for Google AI API
XAI_BASE_URLServerNohttps://api.x.ai/v1Custom base URL for xAI API

AI Rate Limiting

NameScopeRequiredDefaultDescription
AI_FREE_TIER_REQUESTSServerNo20Monthly request limit for free tier
AI_PRO_TIER_REQUESTSServerNo1000Monthly request limit for pro tier
AI_ENTERPRISE_TIER_REQUESTSServerNo10000Monthly request limit for enterprise tier
AI_RATE_LIMIT_WINDOWServerNo10Burst rate limit window in seconds
AI_RATE_LIMIT_MAX_REQUESTSServerNo10Max requests per burst window
AI_ANONYMOUS_MONTHLY_LIMITServerNo5Max requests per month for anonymous/unauthenticated users

AI Feature Flags

NameScopeRequiredDefaultDescription
AI_STREAMING_ENABLEDServerNotrueEnable streaming AI responses
AI_FUNCTIONS_ENABLEDServerNotrueEnable function calling
AI_VISION_ENABLEDServerNotrueEnable vision/image analysis

AI Chat Feature Flags

NameScopeRequiredDefaultDescription
NEXT_PUBLIC_AI_LLM_CHAT_ENABLEDClientNotrueEnable LLM Chat at /dashboard/chat-llm
NEXT_PUBLIC_AI_RAG_CHAT_ENABLEDClientNotrueEnable RAG Chat at /dashboard/chat-rag
NEXT_PUBLIC_AI_VISION_ENABLEDClientNotrueEnable image analysis in LLM Chat (drag & drop, paste, file picker)
NEXT_PUBLIC_AI_PDF_CHAT_ENABLEDClientNotrueEnable PDF document analysis in LLM Chat (drag & drop, file picker)
NEXT_PUBLIC_AI_AUDIO_INPUT_ENABLEDClientNofalseEnable audio input (speech-to-text) in LLM Chat
NEXT_PUBLIC_AI_IMAGE_GEN_ENABLEDClientNotrueEnable Image Generation at /dashboard/image-gen (standalone — does not require LLM Chat)
NEXT_PUBLIC_AI_CONTENT_GEN_ENABLEDClientNotrueEnable Content Generator at /dashboard/content (standalone — does not require LLM Chat)

Caching (Upstash Redis)

NameScopeRequiredDefaultDescription
UPSTASH_REDIS_REST_URLServerProdUpstash Redis REST API URL
UPSTASH_REDIS_REST_TOKENServerProdUpstash Redis authentication token
Redis is required in production for API rate limiting and AI rate limiting. In development, rate limiting is automatically disabled when Redis is not configured.

Security & CORS

NameScopeRequiredDefaultDescription
ALLOWED_ORIGINSServerNohttp://localhost:3000Comma-separated allowed origins for CORS
CSP_REPORT_URIServerNoContent Security Policy violation reporting endpoint

Styling

NameScopeRequiredDefaultDescription
COLOR_THEMEServerNodefaultActive color theme: default, ocean, forest, sunset, midnight, coral, slate, aurora, crimson
See Color Themes for theme previews and customization.

Feature Flags

NameScopeRequiredDefaultDescription
NEXT_PUBLIC_ENABLE_BLOGClientNotrueEnable blog section (middleware redirects /blog to / when disabled)
ENABLE_CREDIT_SYSTEM_IN_TESTSServerNofalseEnable credit system in unit tests (Vitest only)