Environment Variables
Complete reference for all environment variables.
Required Variables
These variables are required for the application to function:
Database
DATABASE_URL="postgresql://user:password@host/db?sslmode=require"Authentication
BETTER_AUTH_SECRET="at-least-32-characters-random-key"
BETTER_AUTH_URL="http://localhost:3000"Application URL
NEXT_PUBLIC_APP_URL="http://localhost:3000"Service Integrations
AI Text Provider Routing
Prompt generation, prompt optimization, prompt assistant, and chat use a routed text provider. Set the primary provider and optional fallbacks. Fallbacks are opt-in; leave them empty to use only the primary provider:
AI_TEXT_PROVIDER="openai"
AI_TEXT_FALLBACK_PROVIDERS=""Use AI_TEXT_PROVIDER="openai" when you want OpenAI or an OpenAI-compatible gateway to be primary.
Task-specific overrides are also supported:
AI_TEXT_PROVIDER_CHAT="openai"
AI_TEXT_FALLBACK_PROVIDERS_CHAT=""
AI_TEXT_PROVIDER_CHAT_STREAM="openai"
AI_TEXT_FALLBACK_PROVIDERS_CHAT_STREAM=""
AI_TEXT_PROVIDER_PROMPT_GENERATE="openai"
AI_TEXT_FALLBACK_PROVIDERS_PROMPT_GENERATE=""
AI_TEXT_PROVIDER_PROMPT_OPTIMIZE="openai"
AI_TEXT_FALLBACK_PROVIDERS_PROMPT_OPTIMIZE=""
AI_TEXT_PROVIDER_PROMPT_ASSISTANT_RUN="openai"
AI_TEXT_FALLBACK_PROVIDERS_PROMPT_ASSISTANT_RUN=""Volcano Engine (AI Features)
Required for Volcano-backed text, image generation, and video generation:
VOLCANO_ENGINE_API_KEY="your-volcano-engine-api-key"
VOLCANO_ENGINE_API_URL="https://ark.cn-beijing.volces.com/api/v3"
VOLCANO_ENGINE_TEXT_MODEL="doubao-1-5-thinking-pro-250415"OpenAI or OpenAI-Compatible Text API
Required when any primary or fallback text provider is openai:
OPENAI_API_KEY="your-openai-api-key"
OPENAI_BASE_URL="https://api.openai.com/v1"
OPENAI_TEXT_MODEL="gpt-4.1-mini"Creem (Payments)
Required for subscriptions and one-time purchases:
CREEM_API_KEY="your-creem-api-key"
CREEM_WEBHOOK_SECRET="whsec_..."For testing without real payments:
CREEM_SIMULATE="true"Resend (Email)
Required for authentication emails and notifications:
RESEND_API_KEY="re_your_api_key"
RESEND_FROM_EMAIL="Your App <noreply@yourdomain.com>"Google OAuth (Optional)
AUTH_GOOGLE_ID="your-google-client-id"
AUTH_GOOGLE_SECRET="your-google-client-secret"Cron Jobs
CRON_SECRET="your-cron-secret"Optional Analytics
NEXT_PUBLIC_POSTHOG_KEY="phc_..."
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID="G-..."
NEXT_PUBLIC_CLARITY_PROJECT_ID="..."Optional Storage (S3-Compatible)
STORAGE_ENDPOINT="https://..."
STORAGE_BUCKET="your-bucket"
STORAGE_REGION="auto"
STORAGE_ACCESS_KEY_ID="..."
STORAGE_SECRET_ACCESS_KEY="..."
STORAGE_PUBLIC_URL="https://..."