Lumea / .env.example
Hetansh Waghela
feat: OpenRouter as primary LLM with Mem0/Graphiti intelligence layer
d6e2b5a
# =============================================================================
# Lumea Health Platform - Docker Environment Variables
# =============================================================================
# This configuration is used by docker-compose for container deployment
# Copy this file to .env in the ROOT directory and fill in your values:
#
# cp .env.example .env
#
# The backend container uses this file to configure all services
# =============================================================================
# =============================================================================
# SECTION 1: DATABASE CONFIGURATION [REQUIRED]
# =============================================================================
# PostgreSQL Database Credentials
# Used by docker-compose to initialize the database
# Default suitable for development; CHANGE in production!
POSTGRES_USER=ggw
POSTGRES_PASSWORD=ggwpassword
POSTGRES_DB=ggwdb
# Alternative: Use cloud database (Neon, etc)
# If using cloud DB, set DATABASE_URL above and leave POSTGRES_* as-is
DATABASE_URL=postgresql+asyncpg://ggw:ggwpassword@db:5432/ggwdb
# =============================================================================
# SECTION 2: AUTHENTICATION & API [REQUIRED]
# =============================================================================
# JWT Secret Key (minimum 32 characters, MUST change in production!)
# Generate with: openssl rand -hex 32
# CRITICAL: Use different key for production
JWT_SECRET=your-super-secret-jwt-key-change-in-production-32-chars-min
# JWT settings
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=60
# Frontend URL (for CORS)
FRONTEND_ORIGIN=http://localhost:5173
# =============================================================================
# SECTION 3: AI/LLM PROVIDERS [AT LEAST ONE REQUIRED]
# =============================================================================
# Provider priority for the chat assistant:
# 1. OpenRouter (pony-alpha) - PRIMARY
# 2. OpenRouter (solar-pro-3:free) - FREE FALLBACK
# 3. Gemini (gemini-flash-latest) - Google fallback
# 4. Ollama (MedGemma GGUF) - Local last resort
#
# Set OPENROUTER_API_KEY to enable the primary chain.
# Gemini & Ollama act as fallbacks if OpenRouter is unavailable.
# ---- OPENROUTER - PRIMARY [RECOMMENDED] ----
# Get from: https://openrouter.ai/settings/keys
# Provides access to hundreds of models via a single endpoint.
# Models: openrouter/pony-alpha (primary), upstage/solar-pro-3:free (fallback)
OPENROUTER_API_KEY=
OPENROUTER_MODEL=openrouter/pony-alpha
OPENROUTER_FALLBACK_MODEL=upstage/solar-pro-3:free
# ---- GROQ API ----
# Used for Mem0 memory layer, Graphiti knowledge graph, and extraction pipeline.
# Get from: https://console.groq.com/
GROQ_API_KEY=
GROK_API_KEY=
# ---- GOOGLE GEMINI - FALLBACK ----
# Get from: https://aistudio.google.com/apikey
# Free tier: 15 requests/min, 1M tokens/day
# Acts as fallback if OpenRouter is not available
USE_GEMINI_FALLBACK=true
GEMINI_API_KEY=
# ---- OPENAI - ALTERNATIVE (PAID) ----
# Get from: https://platform.openai.com/api-keys
OPENAI_API_KEY=
# ---- OLLAMA - LOCAL/SELF-HOSTED (LAST RESORT) ----
# For Docker: Use host.docker.internal:11434
# For Linux: Update extra_hosts in docker-compose.yml
# Ollama is now the LAST fallback in the provider chain.
OLLAMA_BASE_URL=http://host.docker.internal:11434
OLLAMA_MODEL=hf.co/unsloth/medgemma-4b-it-GGUF:Q6_K_XL
# Hugging Face token (for gated models)
HF_TOKEN=
# =============================================================================
# SECTION 4: VOICE AGENT [OPTIONAL] - MULTILINGUAL
# =============================================================================
# Lumea Voice Agent for hands-free health queries
# Supports: English, Hindi, Marathi, Gujarati, Hinglish
# Automatic fallback to browser TTS if ElevenLabs not configured
# ---- TEXT-TO-SPEECH (TTS) ----
# Get from: https://elevenlabs.io/ β†’ Settings β†’ API Keys
# Free tier: 10,000 characters/month
# Required for Voice Agent TTS feature (optional otherwise)
ELEVENLABS_API_KEY=
# Voice ID (default: Rachel - conversational female voice)
# Other options: ErXwobaYiN019PkySvjV (Antoni), EXAVITQu4vr4xnSDxMaL (Bella)
ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM
# =============================================================================
# SECTION 5: OPTIONAL SERVICES
# =============================================================================
# ---- NEO4J (Graph Memory / Graphiti) ----
NEO4J_URI=bolt://neo4j:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=changeme
MEM0_COLLECTION=user_memories
MEM0_EMBED_MODEL=nomic-embed-text
MEM0_GROQ_MODEL=llama-3.1-8b-instant
MEM0_PREFER_GROQ=true
GRAPHITI_GROQ_MODEL=moonshotai/kimi-k2-instruct-0905
GRAPHITI_DATABASE=neo4j
# ---- GOOGLE PLACES API (Pharmacy Locator) ----
# Get from: https://console.cloud.google.com/
GOOGLE_PLACES_API_KEY=
# ---- TWILIO (SMS Reminders) ----
# Mode: "mock" (testing/logging) or "twilio" (real SMS)
SMS_MODE=mock
SMS_TEST_TO_NUMBER=+919876543210
TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
TWILIO_FROM_NUMBER=
# ---- REMINDER SCHEDULER ----
REMINDER_SCHEDULER_ENABLED=true
REMINDER_CHECK_INTERVAL_SECONDS=60
# ---- CHROMA DB (RAG Vector Store) ----
CHROMA_PERSIST_DIR=/app/chroma_db
EMBEDDING_MODEL=all-MiniLM-L6-v2
RAG_TOP_K=5
# =============================================================================
# SECTION 6: HIPAA SECURITY SETTINGS [REQUIRED FOR PRODUCTION]
# =============================================================================
# These settings are REQUIRED for HIPAA compliance when handling medical data
# PHI Encryption Key - REQUIRED for encrypting protected health information
# Generate with: openssl rand -base64 32
# WARNING: Changing this after data is encrypted will make data unreadable!
PHI_ENCRYPTION_KEY=
PHI_ENCRYPTION_SALT=your-unique-deployment-salt
# Cookie Security (set COOKIE_SECURE=false ONLY for local HTTP development)
COOKIE_SECURE=true
COOKIE_SAMESITE=strict
TOKEN_MAX_AGE_SECONDS=3600
# Audit log directory (for HIPAA compliance logging)
AUDIT_LOG_DIR=/app/logs/audit
# =============================================================================
# SECTION 7: FEATURE FLAGS [OPTIONAL]
# =============================================================================
# Allow Voice Agent without complete health profile
REQUIRE_HEALTH_PROFILE=false
# Use Gemini as fallback when primary LLM fails
USE_GEMINI_FALLBACK=true
# Ollama pull models on startup
OLLAMA_PULL_ON_START=false
# =============================================================================
# QUICK START GUIDE
# =============================================================================
#
# MINIMUM SETUP (Development):
# 1. Update JWT_SECRET (generate with: openssl rand -hex 32)
# 2. Add at least one LLM provider:
# - GROK_API_KEY (recommended) OR
# - GEMINI_API_KEY (free tier)
# 3. Run: docker-compose up -d
#
# VOICE AGENT SETUP (Optional):
# 1. Add ELEVENLABS_API_KEY from https://elevenlabs.io/
# 2. Add GEMINI_API_KEY (if using as LLM)
# 3. Voice Agent will work immediately with Speech-to-Text + Text-to-Speech
#
# REMINDERS / SMS SETUP (Optional):
# 1. Keep SMS_MODE=mock for testing
# 2. Or set up Twilio:
# - Add TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, TWILIO_FROM_NUMBER
# - Change SMS_MODE=twilio
#
# PRODUCTION CHECKLIST:
# ☐ Change JWT_SECRET to a secure value (openssl rand -hex 32)
# ☐ Change POSTGRES_PASSWORD to a strong password
# ☐ Change NEO4J_PASSWORD to a strong password
# ☐ Set PHI_ENCRYPTION_KEY (openssl rand -base64 32) - HIPAA REQUIRED
# ☐ Set FRONTEND_ORIGIN to your production domain
# ☐ Use production LLM API keys (Grok/Gemini/OpenAI)
# ☐ Use production ElevenLabs API key
# ☐ Configure SMS_MODE=twilio with Twilio credentials (if using SMS)
# ☐ Enable HTTPS/SSL (set COOKIE_SECURE=true)
# ☐ Set up regular database backups
# ☐ Enable audit logging storage
#
# =============================================================================
# DOCKER COMPOSE NOTES
# =============================================================================
#
# Services included:
# β€’ PostgreSQL (db) - Health data storage
# β€’ Backend (backend) - FastAPI server, processes this .env
# β€’ Neo4j (neo4j) - Knowledge graph & memory
# β€’ Frontend (frontend) - React UI on port 5173
#
# Ports:
# β€’ 5173 - Frontend (React)
# β€’ 8000 - Backend API
# β€’ 5432 - PostgreSQL (internal only)
# β€’ 7687 - Neo4j (Bolt protocol)
#
# To start: docker-compose up -d
# To stop: docker-compose down
# To view logs: docker-compose logs -f backend
#
# =============================================================================