# ============================================================================= # AI Stack FastAPI - Environment Configuration # ============================================================================= # Copy this file to .env and fill in your values # DO NOT commit .env to version control # ============================================================================= # ----------------------------------------------------------------------------- # Application Settings # ----------------------------------------------------------------------------- APP_NAME=ai-stack-fastapi APP_ENV=development DEBUG=true SECRET_KEY=your-super-secret-key-change-in-production # API Settings API_V1_PREFIX=/api/v1 CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000 # ----------------------------------------------------------------------------- # Database Configuration # ----------------------------------------------------------------------------- DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/ai_stack DATABASE_POOL_SIZE=20 DATABASE_MAX_OVERFLOW=10 # ----------------------------------------------------------------------------- # Redis Configuration # ----------------------------------------------------------------------------- REDIS_URL=redis://localhost:6379/0 REDIS_CACHE_TTL=3600 # ----------------------------------------------------------------------------- # LLM Provider Configuration # ----------------------------------------------------------------------------- # Options: openai, anthropic, gemini, ollama LLM_PROVIDER=openai # OpenAI OPENAI_API_KEY=sk-your-openai-api-key OPENAI_MODEL=gpt-4-turbo-preview OPENAI_EMBEDDING_MODEL=text-embedding-3-large # Anthropic ANTHROPIC_API_KEY=sk-ant-your-anthropic-api-key ANTHROPIC_MODEL=claude-3-opus-20240229 # Google Gemini GOOGLE_API_KEY=your-google-api-key GEMINI_MODEL=gemini-1.5-pro # Ollama (local) OLLAMA_BASE_URL=http://localhost:11434 OLLAMA_MODEL=llama3.2 # ----------------------------------------------------------------------------- # Vector Database Configuration # ----------------------------------------------------------------------------- # Options: qdrant, weaviate, pgvector, milvus VECTOR_DB_PROVIDER=qdrant # Qdrant QDRANT_URL=http://localhost:6333 QDRANT_API_KEY= QDRANT_COLLECTION_NAME=documents # Weaviate WEAVIATE_URL=http://localhost:8080 WEAVIATE_API_KEY= # pgvector (uses DATABASE_URL) PGVECTOR_COLLECTION_NAME=embeddings # Milvus MILVUS_HOST=localhost MILVUS_PORT=19530 # ----------------------------------------------------------------------------- # Authentication (Dual Strategy: Clerk + Custom JWT) # ----------------------------------------------------------------------------- # Options: clerk, jwt (default: clerk) AUTH_PROVIDER=clerk # Clerk Configuration (required when AUTH_PROVIDER=clerk) # Get these from https://dashboard.clerk.com CLERK_SECRET_KEY=sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx CLERK_DOMAIN=your-app.clerk.accounts.dev # Frontend Clerk Keys (for Next.js) NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/dashboard # Custom JWT Configuration (fallback when AUTH_PROVIDER=jwt) JWT_SECRET_KEY=your-jwt-secret-key-change-in-production-min-32-chars JWT_ALGORITHM=HS256 JWT_ACCESS_TOKEN_EXPIRE_MINUTES=30 JWT_REFRESH_TOKEN_EXPIRE_DAYS=7 # ----------------------------------------------------------------------------- # Celery / Background Tasks # ----------------------------------------------------------------------------- CELERY_BROKER_URL=redis://localhost:6379/1 CELERY_RESULT_BACKEND=redis://localhost:6379/2 # ----------------------------------------------------------------------------- # Observability # ----------------------------------------------------------------------------- # Langfuse LANGFUSE_PUBLIC_KEY=your-langfuse-public-key LANGFUSE_SECRET_KEY=your-langfuse-secret-key LANGFUSE_HOST=https://cloud.langfuse.com # Sentry (optional) SENTRY_DSN= # ----------------------------------------------------------------------------- # RAG Configuration # ----------------------------------------------------------------------------- RAG_CHUNK_SIZE=1000 RAG_CHUNK_OVERLAP=200 RAG_TOP_K=10 RAG_MAX_CONTEXT_TOKENS=4000 RAG_RERANKING_ENABLED=false # ----------------------------------------------------------------------------- # Rate Limiting # ----------------------------------------------------------------------------- RATE_LIMIT_REQUESTS=100 RATE_LIMIT_WINDOW_SECONDS=60 # ----------------------------------------------------------------------------- # File Upload # ----------------------------------------------------------------------------- MAX_UPLOAD_SIZE_MB=50 ALLOWED_EXTENSIONS=pdf,txt,md,docx,py,js,ts,jsx,tsx,json,yaml,yml