Skip to main content

Environment Variables

This page lists the environment variables read by the current Libre WebUI backend, frontend, and maintenance scripts.

Backend Server

VariableDefaultPurpose
NODE_ENVdevelopmentRuntime mode
PORT3001 in dev, 8080 in productionBackend HTTP port
TRUST_PROXYunsetExpress trust proxy setting
CORS_ORIGINlocal dev originsComma-separated allowed browser origins
SERVE_FRONTENDunsetServe built frontend from backend when true
DOCKER_ENVunsetEnables Docker-oriented behavior when true
DATA_DIRbackend/dataPersistent data directory
BASE_URLhttp://localhost:3001Base URL used for OAuth callback defaults

Authentication and Security

VariableDefaultPurpose
JWT_SECRETgenerated/fallback in developmentJWT signing secret; set explicitly in production
ENCRYPTION_KEYauto-generated64-character hex key for encrypted values
DEBUG_ENCRYPTIONunsetLogs encryption debug output when set
TURNSTILE_SITE_KEYunsetCloudflare Turnstile site key for signup
TURNSTILE_SECRET_KEYunsetCloudflare Turnstile secret key for backend verification

Turnstile is enabled only when both Turnstile keys are present.

OAuth

VariablePurpose
GITHUB_CLIENT_IDGitHub OAuth client ID
GITHUB_CLIENT_SECRETGitHub OAuth client secret
GITHUB_CALLBACK_URLGitHub callback URL override
HUGGINGFACE_CLIENT_IDHugging Face OAuth client ID
HUGGINGFACE_CLIENT_SECRETHugging Face OAuth client secret
HUGGINGFACE_CALLBACK_URLHugging Face callback URL override

If callback URLs are not set, Libre WebUI builds defaults from BASE_URL.

Ollama

VariableDefaultPurpose
OLLAMA_BASE_URLhttp://localhost:11434Ollama API base URL
OLLAMA_TIMEOUT300000Standard Ollama request timeout in milliseconds
OLLAMA_LONG_OPERATION_TIMEOUT900000Long operation timeout for pulls and large requests

Provider Plugin Keys

Provider plugins can use environment keys as deployment-wide defaults:

VariableProvider
OPENAI_API_KEYOpenAI and OpenAI TTS
ANTHROPIC_API_KEYAnthropic
GROQ_API_KEYGroq
GEMINI_API_KEYGoogle Gemini
MISTRAL_API_KEYMistral
OPENROUTER_API_KEYOpenRouter
GITHUB_API_KEYGitHub Models
HUGGINGFACE_API_KEYHugging Face APIs where configured
ELEVENLABS_API_KEYElevenLabs TTS
COMFYUI_API_KEYComfyUI deployments that require an API key

Users can also store provider credentials in the UI when per-user keys are preferred.

Frontend

VariableDefaultPurpose
VITE_API_BASE_URLinferred from host/dev configFrontend API base URL
VITE_WS_BASE_URLinferred from API URLWebSocket base URL
VITE_APP_VERSIONpackage version injected by Vite configDisplayed app version
VITE_DEMO_MODEfalseEnables demo-mode mocks when true
VITE_API_TIMEOUT300000Frontend API timeout in milliseconds
VITE_BACKEND_URLhttp://localhost:3001Used by some auth helper components
VITE_DEBUG_VERBOSEunsetEnables verbose frontend debug logs in development
ELECTRON_BUILDunsetEnables Electron-specific Vite behavior when true

Maintenance Scripts

VariablePurpose
CHANGELOG_AI_MODELOllama model for AI changelog generation
ANALYSIS_AI_MODELOllama model for development analysis

Example:

CHANGELOG_AI_MODEL=gemma3:4b npm run changelog:ai
ANALYSIS_AI_MODEL=qwen3:8b npm run analyze

Production Example

NODE_ENV=production
PORT=3001
SERVE_FRONTEND=true
DATA_DIR=/data/libre-webui
CORS_ORIGIN=https://librewebui.example
BASE_URL=https://librewebui.example

JWT_SECRET=replace-with-a-long-random-secret
ENCRYPTION_KEY=replace-with-64-hex-characters

OLLAMA_BASE_URL=http://ollama:11434
OLLAMA_TIMEOUT=300000
OLLAMA_LONG_OPERATION_TIMEOUT=900000

TURNSTILE_SITE_KEY=...
TURNSTILE_SECRET_KEY=...