Skip to main content
The backend validates every variable on startup via src/shared/config/env.schema.ts. Missing required fields prevent the server from booting so we never run with half-configured dependencies.

Server & Runtime

VariableRequiredDefaultDescription
NODE_ENVNodevelopmentdevelopment, production, or test
PORTNo8080Bun server port
LOG_LEVELNoinfoLogging verbosity: debug, info, warn, error

Database (MongoDB)

VariableRequiredDefaultDescription
DATABASE_URLYes-MongoDB connection string
MONGODB_URINo-Alternative to DATABASE_URL
MONGODB_DATABASENohandauncleDatabase name override
MONGODB_MAX_POOL_SIZENo10Maximum connection pool size
MONGODB_MIN_POOL_SIZENo2Minimum connection pool size
MONGODB_CONNECT_TIMEOUTNo10000Connection timeout in ms
MONGODB_SERVER_SELECTION_TIMEOUTNo5000Server selection timeout in ms
MONGODB_RETRY_WRITESNotrueEnable retry writes
MONGODB_RETRY_READSNotrueEnable retry reads

Redis / Caching

VariableRequiredDefaultDescription
REDIS_PROVIDERNoredisredis or upstash
REDIS_URLConditional-Standard Redis connection string (when REDIS_PROVIDER=redis)
REDIS_HOSTNo-Redis host (alternative to URL)
REDIS_PORTNo-Redis port
REDIS_PASSWORDNo-Redis password
REDIS_DBNo-Redis database number
UPSTASH_REDIS_REST_URLConditional-Required when REDIS_PROVIDER=upstash
UPSTASH_REDIS_REST_TOKENConditional-Required when REDIS_PROVIDER=upstash

URLs & Security

VariableRequiredDefaultDescription
FRONTEND_URLNo-Frontend application URL
BACKEND_URLNo-Backend API URL (used for generating absolute links)
APP_URLNo-Base URL for shared links
SHARE_BASE_URLNo-Override for share link base URL
BACKEND_SECRETYes-Secret for internal API auth (min 16 chars)
WEBHOOK_SECRETNo-Secret for validating incoming webhooks

Auth0 (Identity)

VariableRequiredDefaultDescription
AUTH0_DOMAINYes-e.g. handauncle.us.auth0.com
AUTH0_CLIENT_IDYes-API client ID for JWT verification
AUTH0_CLIENT_SECRETYes-API client secret
AUTH0_AUDIENCEYes-API identifier that must match Auth0 config
AUTH0_MANAGEMENT_CLIENT_IDYes-Management API client ID
AUTH0_MANAGEMENT_CLIENT_SECRETYes-Management API client secret
AUTH0_MANAGEMENT_API_AUDIENCENo-Management API audience
AUTH0_PHONE_CONNECTIONNo-Database connection for phone OTP users
AUTH0_PHONE_EMAIL_DOMAINNo-Domain for synthetic emails (phone users)

AI Providers

VariableRequiredDefaultDescription
AI_PROVIDERNoopenaiopenai, anthropic, or multi

OpenAI

VariableRequiredDefaultDescription
OPENAI_API_KEYConditional-Required when AI_PROVIDER=openai or multi
OPENAI_DEFAULT_MODELNogpt-4oDefault model name
OPENAI_MAX_TOKENSNo4096Max tokens per request
OPENAI_TEMPERATURENo0.7Temperature for generation

Anthropic

VariableRequiredDefaultDescription
ANTHROPIC_API_KEYConditional-Required when AI_PROVIDER=anthropic or multi
ANTHROPIC_DEFAULT_MODELNoclaude-3-5-sonnet-20241022Default model name
ANTHROPIC_MAX_TOKENSNo4096Max tokens per request
ANTHROPIC_TEMPERATURENo0.7Temperature for generation

Other AI Services

VariableRequiredDefaultDescription
GOOGLE_GENERATIVE_AI_API_KEYNo-Gemini API key
GROQ_API_KEYNo-Groq API key for query generation
TAVILY_API_KEYNo-Tavily search API key

Vector Database (Pinecone)

VariableRequiredDefaultDescription
PINECONE_API_KEYYes-Pinecone API key
PINECONE_INDEX_NAMENohandauncle-sparseIndex name for vector storage
RERANK_MODELNobge-reranker-v2-m3Reranking model for RAG

Supermemory (Conversation Memory)

VariableRequiredDefaultDescription
SUPERMEMORY_API_KEYYes-Supermemory API key
SUPERMEMORY_BASE_URLNo-Custom base URL
SUPERMEMORY_PROVIDER_NAMENo-Provider name override
SUPERMEMORY_PROVIDER_API_KEYNo-Provider API key override
SUPERMEMORY_PROVIDER_BASE_URLNo-Provider base URL override
SUPERMEMORY_MEMORY_WINDOW_SIZENo-Memory window size
SUPERMEMORY_ENABLE_SEMANTIC_SEARCHNotrueEnable semantic search
SUPERMEMORY_ENABLE_CROSS_CONVERSATIONNotrueEnable cross-conversation memory
SUPERMEMORY_ENABLE_PROFILE_APINotrueEnable profile API
SUPERMEMORY_RETRIEVAL_LIMITNo-Limit for memory retrieval
SUPERMEMORY_CACHE_TTLNo-Cache TTL in seconds
SUPERMEMORY_BATCH_SIZENo-Batch size for operations
SUPERMEMORY_USE_ROUTERNofalseEnable memory router
SUPERMEMORY_USE_APINotrueEnable memory API

RAG Configuration

VariableRequiredDefaultDescription
RAG_ENABLEDNofalseEnable retrieval augmented generation
RAG_NAMESPACENoknowledge-baseNamespace for RAG documents

LangFuse (Observability)

VariableRequiredDefaultDescription
LANGFUSE_PUBLIC_KEYNo-Public key for tracing
LANGFUSE_SECRET_KEYNo-Secret key for tracing
LANGFUSE_HOSTNo-Custom host URL
LANGFUSE_SYSTEM_PROMPT_NAMENofinancial-advisor-systemSystem prompt name
LANGFUSE_PROMPT_LABELNoproductionPrompt label for runs
LANGFUSE_CACHE_TTL_SECONDSNo60Prompt cache duration
LANGFUSE_WEBHOOK_SECRETNo-Secret for validating Langfuse webhooks

Messaging (SMS/Email)

Exotel (OTP via SMS)

VariableRequiredDefaultDescription
EXOTEL_API_KEYNo-API Key from Exotel Dashboard
EXOTEL_API_TOKENNo-API Token from Exotel Dashboard
EXOTEL_SIDNo-Account SID (used in URL path)
EXOTEL_FROM_NUMBERNo-Sender ID
EXOTEL_SUBDOMAINNoapi.exotel.comapi.exotel.com (Singapore) or api.in.exotel.com (Mumbai)
OTP_EXPIRY_SECONDSNo300OTP expiry time (5 minutes)
OTP_RESEND_COOLDOWN_SECONDSNo60Cooldown between resends
OTP_MAX_ATTEMPTSNo5Max verification attempts per OTP

Twilio & SendGrid (Fallback)

VariableRequiredDefaultDescription
TWILIO_ACCOUNT_SIDNo-Twilio Account SID
TWILIO_AUTH_TOKENNo-Twilio Auth Token
SENDGRID_API_KEYNo-SendGrid API key for emails

Google Cloud Storage

VariableRequiredDefaultDescription
GCS_PROJECT_IDNo-GCP Project ID
GCS_BUCKET_NAMENo-Storage bucket name
GCS_KEY_FILENAMENo-Path to service account key file
GCS_PUBLIC_ACCESSNofalseWhether generated URLs are public

Usage & Billing

VariableRequiredDefaultDescription
FREE_MESSAGE_THRESHOLDNo100Number of free AI messages returned by /app/launch

Tips

  • Keep secrets in .env.development.local; Bun loads it automatically.
  • When switching Redis providers, only set the fields relevant to that provider to satisfy the schema refinements.
  • If validation fails on boot, Bun logs every missing field—fix them before retrying.
  • For AI_PROVIDER=multi, both OpenAI and Anthropic keys are required.