Skip to main content

Environment Variables Reference

Complete reference for all environment variables used in Libre WebUI.

Quick Reference

VariableDefaultRequiredDescription
JWT_SECRET-Yes (prod)JWT signing key
ENCRYPTION_KEYautoNoData encryption key
OLLAMA_BASE_URLhttp://localhost:11434NoOllama API URL
PORT3001NoServer port
SINGLE_USER_MODEfalseNoDisable multi-user

Backend Variables

Server Configuration

VariableDefaultDescription
NODE_ENVdevelopmentEnvironment mode (development, production, test)
PORT3001 (dev), 8080 (prod)HTTP server port
CORS_ORIGINhttp://localhost:5173,http://localhost:3000,http://localhost:8080Allowed CORS origins (comma-separated)
SERVE_FRONTENDfalseServe frontend static files from backend
DOCKER_ENV-Set to true when running in Docker

Authentication & Security

VariableDefaultDescription
JWT_SECRET-Required in production. 64-character hex string for JWT signing. Generate with: openssl rand -hex 64
JWT_EXPIRES_IN7dJWT token expiration (e.g., 7d, 24h, 1w)
ENCRYPTION_KEYauto-generated64-character hex key for encrypting data at rest. Auto-generated if not set.
SESSION_SECRETauto-generatedSession encryption secret
SINGLE_USER_MODEfalseWhen true, disables multi-user authentication

Ollama Integration

VariableDefaultDescription
OLLAMA_BASE_URLhttp://localhost:11434Ollama API endpoint URL
OLLAMA_TIMEOUT300000Standard API timeout in ms (5 minutes)
OLLAMA_LONG_OPERATION_TIMEOUT900000Extended timeout for model loading (15 minutes)

For large models (70B+), increase timeouts:

OLLAMA_TIMEOUT=600000
OLLAMA_LONG_OPERATION_TIMEOUT=1800000

Database & Storage

VariableDefaultDescription
DATA_DIR./backend/dataDirectory for SQLite database and uploads

In Docker, this is typically set to /app/backend/data.

OAuth2 - GitHub

VariableDefaultDescription
GITHUB_CLIENT_ID-GitHub OAuth app client ID
GITHUB_CLIENT_SECRET-GitHub OAuth app client secret
GITHUB_CALLBACK_URLhttp://localhost:3001/api/auth/oauth/github/callbackOAuth callback URL

OAuth2 - Hugging Face

VariableDefaultDescription
HUGGINGFACE_CLIENT_ID-Hugging Face OAuth app client ID
HUGGINGFACE_CLIENT_SECRET-Hugging Face OAuth app client secret
HUGGINGFACE_CALLBACK_URLhttp://localhost:3001/api/auth/oauth/huggingface/callbackOAuth callback URL

Plugin API Keys

These are optional fallback keys. Users can also configure per-user API keys in Settings.

VariableProviderDescription
OPENAI_API_KEYOpenAIGPT-4, GPT-4o, o1, o3 models + TTS
ANTHROPIC_API_KEYAnthropicClaude Opus, Sonnet models
GROQ_API_KEYGroqFast inference (Llama, Gemma)
GEMINI_API_KEYGoogleGemini 2.0/2.5 models
MISTRAL_API_KEYMistralMistral Large, Codestral
OPENROUTER_API_KEYOpenRouter300+ models aggregator
GITHUB_API_KEYGitHub ModelsGitHub-hosted models
ELEVENLABS_API_KEYElevenLabsText-to-speech

Debug

VariableDefaultDescription
DEBUG_ENCRYPTION-Enable encryption service debug logging

Frontend Variables

All frontend variables must be prefixed with VITE_.

API Configuration

VariableDefaultDescription
VITE_API_BASE_URLauto-detectedOverride API base URL
VITE_BACKEND_URLhttp://localhost:3001Backend URL for OAuth flows
VITE_WS_BASE_URLws://localhost:3001WebSocket base URL
VITE_API_TIMEOUT300000API request timeout (5 minutes)

Features

VariableDefaultDescription
VITE_DEMO_MODEfalseEnable demo mode for presentations
VITE_APP_VERSIONauto-detectedApplication version string

Docker Configuration

docker-compose.yml

services:
libre-webui:
environment:
- NODE_ENV=production
- DOCKER_ENV=true
- PORT=3001
- OLLAMA_BASE_URL=http://ollama:11434
- CORS_ORIGIN=http://localhost:8080
- SINGLE_USER_MODE=false
- JWT_SECRET=${JWT_SECRET:-}
- JWT_EXPIRES_IN=7d
- ENCRYPTION_KEY=${ENCRYPTION_KEY:-}
- OLLAMA_TIMEOUT=${OLLAMA_TIMEOUT:-300000}
- OLLAMA_LONG_OPERATION_TIMEOUT=${OLLAMA_LONG_OPERATION_TIMEOUT:-900000}
- DATA_DIR=/app/backend/data
# OAuth (optional)
- GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID:-}
- GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET:-}
- HUGGINGFACE_CLIENT_ID=${HUGGINGFACE_CLIENT_ID:-}
- HUGGINGFACE_CLIENT_SECRET=${HUGGINGFACE_CLIENT_SECRET:-}

External Ollama

When using Ollama outside Docker:

# docker-compose.external-ollama.yml
environment:
- OLLAMA_BASE_URL=http://host.docker.internal:11434 # Mac/Windows
# - OLLAMA_BASE_URL=http://172.17.0.1:11434 # Linux

Kubernetes Configuration

Helm Values

# values.yaml
env:
NODE_ENV: production
DOCKER_ENV: "true"
PORT: "3001"
CORS_ORIGIN: "http://localhost:8080"
SINGLE_USER_MODE: "false"
JWT_EXPIRES_IN: "7d"
OLLAMA_TIMEOUT: "300000"
OLLAMA_LONG_OPERATION_TIMEOUT: "900000"
DATA_DIR: "/app/backend/data"

# Sensitive values stored as K8s Secrets
secrets:
jwtSecret: ""
encryptionKey: ""
sessionSecret: ""
githubClientId: ""
githubClientSecret: ""
huggingfaceClientId: ""
huggingfaceClientSecret: ""

Setting Secrets

helm install libre-webui oci://ghcr.io/libre-webui/charts/libre-webui \
--set secrets.jwtSecret=$(openssl rand -hex 64) \
--set secrets.encryptionKey=$(openssl rand -hex 32)

Or create a Secret manually:

apiVersion: v1
kind: Secret
metadata:
name: libre-webui-secrets
type: Opaque
stringData:
jwt-secret: "your-64-char-hex-string"
encryption-key: "your-32-char-hex-string"

Example Configurations

Development (.env)

# backend/.env
NODE_ENV=development
PORT=3001
OLLAMA_BASE_URL=http://localhost:11434

# Optional: API keys for testing plugins
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...

Production (.env)

# Production - generate secure keys!
NODE_ENV=production
PORT=8080
JWT_SECRET=<generated-64-char-hex>
ENCRYPTION_KEY=<generated-32-char-hex>

# Ollama
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_TIMEOUT=600000
OLLAMA_LONG_OPERATION_TIMEOUT=1800000

# OAuth (optional)
GITHUB_CLIENT_ID=your_client_id
GITHUB_CLIENT_SECRET=your_client_secret

# CORS for your domain
CORS_ORIGIN=https://chat.example.com

Self-Hosted Multi-User

NODE_ENV=production
SINGLE_USER_MODE=false
JWT_SECRET=<generated-64-char-hex>
JWT_EXPIRES_IN=7d

# Enable SSO
GITHUB_CLIENT_ID=your_client_id
GITHUB_CLIENT_SECRET=your_client_secret
GITHUB_CALLBACK_URL=https://chat.example.com/api/auth/oauth/github/callback

Security Best Practices

  1. Never commit secrets - Use environment variables or secret management
  2. Generate secure keys - Use openssl rand -hex 64 for JWT_SECRET
  3. Rotate secrets periodically - Especially in production
  4. Use HTTPS - Set CORS_ORIGIN to HTTPS URLs in production
  5. Limit CORS origins - Only allow necessary domains
  6. Encrypt API keys - Keys stored in database are encrypted with ENCRYPTION_KEY

Troubleshooting

Variables Not Loading

# Check if .env file is being read
cat backend/.env

# Verify environment in running process
docker exec libre-webui env | grep OLLAMA

OAuth Callback Errors

Ensure callback URLs match exactly:

  • Development: http://localhost:3001/api/auth/oauth/github/callback
  • Docker: http://localhost:8080/api/auth/oauth/github/callback
  • Production: https://your-domain.com/api/auth/oauth/github/callback

Timeout Errors

For large models, increase all timeouts:

OLLAMA_TIMEOUT=600000
OLLAMA_LONG_OPERATION_TIMEOUT=1800000
VITE_API_TIMEOUT=600000