Docs
Environment Variables

Environment Variables

Complete reference for every required and optional environment variable.

Environment variables are validated at build time using @t3-oss/env-nextjs. If you add a new variable, you must update both your .env file and the env.mjs schema — otherwise the build will fail.

Core App

VariableRequiredDescription
NEXT_PUBLIC_APP_URLYesThe public base URL. Used in email links and QStash callbacks. E.g. http://localhost:3000
APP_NAMEYesShown in emails and the UI. E.g. My SaaS App

Authentication

VariableRequiredDescription
BETTER_AUTH_SECRETYesRandom secret for token encryption. Generate with openssl rand -base64 32
GOOGLE_CLIENT_IDYesGoogle OAuth client ID from Google Cloud Console
GOOGLE_CLIENT_SECRETYesGoogle OAuth client secret

Database

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string. E.g. postgres://user:pass@host/db

AI

VariableRequiredDescription
OPENAI_API_KEYYesUsed by the orchestrator (gpt-4o-mini), agents (gpt-4o), and image generation
ANTHROPIC_API_KEYOptionalRequired only if using Claude models via resolveModel() in lib/ai/models.ts
TAVILY_API_KEYYesUsed by the web_search and web_extract tools

Email

VariableRequiredDescription
RESEND_API_KEYYesAPI key from Resend for all transactional email
EMAIL_FROMYesSender address. E.g. Ship AI SaaS <noreply@yourdomain.com>

Storage

VariableRequiredDescription
SUPABASE_URLYesYour Supabase project URL
SUPABASE_SERVICE_ROLE_KEYYesServer-side service role key for storage uploads. Never expose this to the browser.

Payments

VariableRequiredDescription
STRIPE_API_KEYYesStripe secret key (starts with sk_)
STRIPE_WEBHOOK_SECRETYesSigning secret from Stripe dashboard or stripe listen
NEXT_PUBLIC_STRIPE_PRO_MONTHLY_PLAN_IDOptionalStripe Price ID for the Pro monthly plan
NEXT_PUBLIC_STRIPE_PRO_YEARLY_PLAN_IDOptionalStripe Price ID for the Pro yearly plan
NEXT_PUBLIC_STRIPE_BUSINESS_MONTHLY_PLAN_IDOptionalStripe Price ID for the Business monthly plan
NEXT_PUBLIC_STRIPE_BUSINESS_YEARLY_PLAN_IDOptionalStripe Price ID for the Business yearly plan

Background Jobs (QStash)

VariableRequiredDescription
QSTASH_TOKENYesUpstash QStash token for publishing messages
QSTASH_URLYesQStash publish URL from Upstash console
QSTASH_CURRENT_SIGNING_KEYYesUsed by verifySignatureAppRouter to authenticate incoming step requests
QSTASH_NEXT_SIGNING_KEYYesRotated signing key for zero-downtime key rotation
WORKFLOW_TOKEN_SECRETYesSigns JWT tokens for workflow plan and step approvals

QSTASH_BASE_URL must be set to your production domain in production (e.g. https://yourdomain.com). QStash will POST step invocations to ${QSTASH_BASE_URL}/api/workflows/step.