Skip to main content
LibreChat uses environment variables for configuration. Copy .env.example to .env and configure the variables below.

Server Configuration

HOST
string
default:"localhost"
Server hostname
PORT
number
default:"3080"
Server port number
MONGO_URI
string
required
MongoDB connection string
MONGO_URI=mongodb://127.0.0.1:27017/LibreChat
DOMAIN_CLIENT
string
default:"http://localhost:3080"
Client-facing domain URL
DOMAIN_SERVER
string
default:"http://localhost:3080"
Server-facing domain URL

MongoDB Connection Pool

MONGO_MAX_POOL_SIZE
number
Maximum number of connections in the connection pool
MONGO_MIN_POOL_SIZE
number
Minimum number of connections in the connection pool
MONGO_MAX_CONNECTING
number
Maximum connections being established concurrently
MONGO_MAX_IDLE_TIME_MS
number
Maximum time a connection can remain idle before being closed (milliseconds)
MONGO_AUTO_INDEX
boolean
Enable automatic index creation for all models. Set to false to disable

Security & Authentication

JWT_SECRET
string
required
Secret key for JWT token generation
Generate a secure random string for production
JWT_SECRET=16f8c0ef4a5d391b26034086c628469d3f9f497f08163ab9b40137092f2909ef
JWT_REFRESH_SECRET
string
required
Secret key for JWT refresh tokens
CREDS_KEY
string
required
Encryption key for credential storage
CREDS_IV
string
required
Initialization vector for credential encryption
SESSION_EXPIRY
number
default:"900000"
Session expiration time in milliseconds (default: 15 minutes)
SESSION_EXPIRY=1000 * 60 * 15
REFRESH_TOKEN_EXPIRY
number
default:"604800000"
Refresh token expiration time in milliseconds (default: 7 days)
REFRESH_TOKEN_EXPIRY=(1000 * 60 * 60 * 24) * 7
MIN_PASSWORD_LENGTH
number
default:"8"
Minimum password length for user authentication
Set to 1 when using LDAP to bypass local password validation

Logging & Debugging

DEBUG_LOGGING
boolean
default:"true"
Enable debug-level logging
DEBUG_CONSOLE
boolean
default:"false"
Enable console debug output
CONSOLE_JSON
boolean
default:"false"
Use JSON format for console logs (recommended for cloud deployments like GCP/AWS)
MEM_DIAG
boolean
Enable memory diagnostics (logs heap/RSS snapshots every 60s, auto-enabled with —inspect)

Node.js Configuration

NODE_OPTIONS
string
Node.js command-line options
NODE_OPTIONS="--max-old-space-size=6144"
NODE_MAX_OLD_SPACE_SIZE
number
default:"6144"
Node.js heap size in MB (used as Docker build argument, not recognized by Node.js directly)
To configure Node.js memory, use NODE_OPTIONS instead

Configuration File

CONFIG_PATH
string
Path to librechat.yaml configuration file (absolute, relative, or URL)
CONFIG_PATH="/alternative/path/to/librechat.yaml"

Search Configuration

Enable MeiliSearch integration
MEILI_HOST
string
default:"http://0.0.0.0:7700"
MeiliSearch server host
MEILI_MASTER_KEY
string
required
MeiliSearch master key
MEILI_NO_ANALYTICS
boolean
default:"true"
Disable MeiliSearch analytics
MEILI_NO_SYNC
boolean
Disable indexing (useful in multi-node setup where only one instance performs index sync)

User Registration & Login

ALLOW_EMAIL_LOGIN
boolean
default:"true"
Enable email/password login
ALLOW_REGISTRATION
boolean
default:"true"
Enable user registration
ALLOW_SOCIAL_LOGIN
boolean
default:"false"
Enable social login (OAuth)
ALLOW_SOCIAL_REGISTRATION
boolean
default:"false"
Enable registration via social providers
ALLOW_PASSWORD_RESET
boolean
default:"false"
Enable password reset functionality
ALLOW_UNVERIFIED_EMAIL_LOGIN
boolean
default:"true"
Allow login with unverified email addresses
ALLOW_ACCOUNT_DELETION
boolean
default:"true"
Allow users to delete their accounts

Rate Limiting & Moderation

BAN_VIOLATIONS
boolean
default:"true"
Enable automatic banning based on violation scores
BAN_DURATION
number
default:"7200000"
Ban duration in milliseconds (default: 2 hours)
BAN_DURATION=1000 * 60 * 60 * 2
BAN_INTERVAL
number
default:"20"
Number of violations before ban

Violation Scores

LOGIN_VIOLATION_SCORE
number
default:"1"
Violation score for failed login attempts
REGISTRATION_VIOLATION_SCORE
number
default:"1"
Violation score for registration attempts
MESSAGE_VIOLATION_SCORE
number
default:"1"
Violation score for message rate limit violations
NON_BROWSER_VIOLATION_SCORE
number
default:"20"
Violation score for non-browser requests

Rate Limits

LOGIN_MAX
number
default:"7"
Maximum login attempts per window
LOGIN_WINDOW
number
default:"5"
Login rate limit window in minutes
REGISTER_MAX
number
default:"5"
Maximum registration attempts per window
REGISTER_WINDOW
number
default:"60"
Registration rate limit window in minutes
LIMIT_CONCURRENT_MESSAGES
boolean
default:"true"
Enable concurrent message limiting
CONCURRENT_MESSAGE_MAX
number
default:"2"
Maximum concurrent messages per user
MESSAGE_IP_MAX
number
default:"40"
Maximum messages per IP per window
MESSAGE_IP_WINDOW
number
default:"1"
Message IP rate limit window in minutes

OpenAI Moderation

OPENAI_MODERATION
boolean
default:"false"
Enable OpenAI content moderation
OPENAI_MODERATION_API_KEY
string
OpenAI API key for moderation endpoint
OPENAI_MODERATION_REVERSE_PROXY
string
Custom reverse proxy for OpenAI moderation API

Redis Configuration

USE_REDIS
boolean
Enable Redis for caching and session storage
USE_REDIS_STREAMS
boolean
Enable Redis for resumable LLM streams (defaults to USE_REDIS value)
Set to false to use in-memory storage for streams while keeping Redis for other caches
REDIS_URI
string
Redis connection URI
REDIS_URI=redis://127.0.0.1:6379
REDIS_USERNAME
string
Redis authentication username
REDIS_PASSWORD
string
Redis authentication password
REDIS_KEY_PREFIX
string
Static prefix for Redis keys
REDIS_KEY_PREFIX_VAR
string
Environment variable name for dynamic Redis key prefix (recommended for cloud deployments)
REDIS_KEY_PREFIX_VAR=K_REVISION
REDIS_PING_INTERVAL
number
default:"0"
Redis ping interval in seconds (0 = disabled)
When set to a positive integer, Redis clients ping the server to keep connections alive

UI Configuration

APP_TITLE
string
default:"LibreChat"
Application title displayed in browser
Custom footer text
CUSTOM_FOOTER="My custom footer"
HELP_AND_FAQ_URL
string
default:"https://librechat.ai"
URL for help and FAQ link
ANALYTICS_GTM_ID
string
Google Tag Manager ID for analytics

Proxy & Network

PROXY
string
HTTP proxy for API requests
TRUST_PROXY
number
default:"1"
Number of hops from Express application to trust for client IP
  • 0 = req.socket.remoteAddress (no reverse proxy)
  • 1 = first hop in X-Forwarded-For header
NO_INDEX
boolean
default:"true"
Add noindex meta tag to prevent search engine indexing

Langfuse Tracing

LANGFUSE_PUBLIC_KEY
string
Langfuse public API key for tracing
LANGFUSE_SECRET_KEY
string
Langfuse secret API key
LANGFUSE_BASE_URL
string
Langfuse API base URL

Error Handling

CONTINUE_ON_UNCAUGHT_EXCEPTION
boolean
default:"false"
Continue running after uncaught exceptions
Not recommended for production unless necessary