Environment Variables
LibreChat uses environment variables for configuration. Set these in your.env file or system environment.
Copy
.env.example to .env to get started:Server Configuration
Basic Server Settings
Server host address
Server port number
Client-facing domain URL
Server domain URL for backend services
Add noindex meta tag to prevent search engine indexing
Number of hops from the Express application. Set to 0 if no reverse proxy.
Minimum password length for user authentication
Continue running after encountering uncaught exceptions
Node.js Options
Build argument for Docker/CI workflows (NOT used by Node.js directly)To configure Node.js memory at runtime, use NODE_OPTIONS:
Database Configuration
MongoDB
MongoDB connection string
Maximum number of connections in the connection pool
Minimum number of connections in the connection pool
Maximum number of connections being established concurrently
Maximum milliseconds a connection can remain idle before being closed
Maximum time in milliseconds to wait for a connection
Enable automatic index creation for all models
Enable automatic collection creation
Logging
JSON Logging
Use JSON format for console logs (useful for cloud deployments like GCP/AWS)
Debug Logging
Enable debug logging
Output debug logs to console
Enable memory diagnostics (logs heap/RSS snapshots every 60s)Automatically enabled when using
--inspect flagPermissions
User ID for file permissions (Docker)
Group ID for file permissions (Docker)
Configuration Path
Path to librechat.yaml configuration file (absolute, relative, or URL)
Langfuse Tracing
Langfuse secret API key
Langfuse API base URL (optional, for self-hosted)
Proxy
HTTP/HTTPS proxy for outbound requests
Security
JWT Secrets
Secret key for JWT token signing
Secret key for refresh token signing (must be different from JWT_SECRET)
Credential Encryption
Encryption key for stored credentials (32 bytes hex)
Initialization vector for credential encryption (16 bytes hex)
Session Configuration
Session expiry time in milliseconds
Refresh token expiry time in milliseconds
Moderation
Enable OpenAI content moderation
OpenAI API key for moderation (if different from main key)
Reverse proxy URL for OpenAI moderation API
Ban Configuration
Enable automatic banning for violations
Ban duration in milliseconds (default: 2 hours)
Number of violations before ban
Violation Scores
Violation score for failed login attempts
Violation score for registration attempts
Violation score for concurrent message violations
Violation score for message rate limit violations
Violation score for non-browser requests
Violation score for text-to-speech violations
Violation score for speech-to-text violations
Violation score for conversation fork violations
Violation score for import violations
Violation score for file upload violations
Violation score for illegal model requests
Rate Limits
Maximum login attempts per window
Login rate limit window in minutes
Maximum registration attempts per window
Registration rate limit window in minutes
Enable concurrent message limiting
Maximum concurrent messages per user
Enable message rate limiting by IP
Maximum messages per IP per window
Message IP rate limit window in minutes
Enable message rate limiting by user
Maximum messages per user per window
Message user rate limit window in minutes
Balance System
Enable token balance checking
Initial token balance for new users
Registration and Login
Allow email/password login
Allow new user registration
Allow social login (OAuth) for existing users
Allow new user registration via social login
Enable password reset functionality
Requires email service configuration
Allow users to delete their accounts
Allow login with unverified email addresses
Shared Links
Enable conversation sharing via links
Allow public (non-authenticated) access to shared links
Static File Cache Control
Cache max-age for static files in seconds (2 days default)
Only applies when NODE_ENV=production
Cache s-maxage for static files in seconds (1 day default)
Disable Express-based compression (if handled by another service)
Enable serving pre-gzipped image files
UI Configuration
Application title shown in browser
Custom footer text
URL for help and FAQ link
Show birthday icon on special dates
Google Tag Manager ID for analytics
Maximum file size for conversation imports in bytes
Cache Headers
Cache-Control header for index.html
Pragma header for index.html
Expires header for index.html
Next Steps
AI Endpoints
Configure AI endpoint variables
Authentication
Set up OAuth, LDAP, and email auth
File Storage
Configure S3, Firebase, or Azure storage
YAML Configuration
Advanced YAML configuration options