LibreChat offers multiple installation methods to suit different needs, from quick Docker deployments to full local development setups. This guide covers all installation options in detail.
Docker (Recommended)
Fastest and most reliable method for production use
LibreChat uses the packageManager field in package.json to specify npm@11.10.0. Modern Node.js installations will automatically use the correct version.
Edit .env with your preferred editor. Required configuration:
.env
# Server ConfigurationHOST=localhostPORT=3080MONGO_URI=mongodb://mongodb:27017/LibreChat# Domain ConfigurationDOMAIN_CLIENT=http://localhost:3080DOMAIN_SERVER=http://localhost:3080# Meilisearch (for conversation search)MEILI_HOST=http://meilisearch:7700MEILI_MASTER_KEY=DrhYf7zENyR6AlUCKmnz0eYASOQdl6zxH7s7MKFSfFCt# Security Keys (generate new ones for production!)JWT_SECRET=16f8c0ef4a5d391b26034086c628469d3f9f497f08163ab9b40137092f2909efJWT_REFRESH_SECRET=eaa5191f2914e30b9387fd84e254e4ba6fc51b4654968a9b0803b456a54b8418CREDS_KEY=f34be427ebb29de8d88c107a71546019685ed8b241d8f2ed00c3df97ad2566f0CREDS_IV=e2341419ec3dd3d19b13a1a87fafcbfb# AI Provider API Keys (at least one required)OPENAI_API_KEY=user_providedANTHROPIC_API_KEY=user_providedGOOGLE_KEY=user_provided# Registration SettingsALLOW_REGISTRATION=trueALLOW_EMAIL_LOGIN=trueALLOW_UNVERIFIED_EMAIL_LOGIN=true
Security: The example security keys are for development only. Generate new random keys for production:
# Generate secure random keysopenssl rand -hex 32 # For JWT_SECRETopenssl rand -hex 32 # For JWT_REFRESH_SECRETopenssl rand -hex 32 # For CREDS_KEYopenssl rand -hex 16 # For CREDS_IVopenssl rand -hex 32 # For MEILI_MASTER_KEY
4
Set File Permissions
Configure user and group IDs for proper file permissions:
# Linux/macOS: Add to .envecho "UID=$(id -u)" >> .envecho "GID=$(id -g)" >> .env# Windows WSL2: Use defaultecho "UID=1000" >> .envecho "GID=1000" >> .env
# Install Node.js from https://nodejs.org/# Install MongoDB from https://www.mongodb.com/try/download/community# Install Meilisearch from https://www.meilisearch.com/docs/learn/getting_started/installation# Or use Chocolatey:choco install nodejs mongodb meilisearch
Verify installations:
node --version # Should be v20.19.0+npm --version # Should be 11.10.0+mongod --version
# Use local MongoDBMONGO_URI=mongodb://127.0.0.1:27017/LibreChat# Local MeilisearchMEILI_HOST=http://127.0.0.1:7700MEILI_MASTER_KEY=your_secure_master_key# Server configurationHOST=localhostPORT=3080DOMAIN_CLIENT=http://localhost:3080DOMAIN_SERVER=http://localhost:3080# Add your AI provider keysOPENAI_API_KEY=sk-your-key-here
3
Install Dependencies
LibreChat uses npm workspaces. Install all dependencies:
# Smart install (only if package-lock.json changed)npm run smart-reinstall# Or full clean installnpm run reinstall
This installs dependencies for:
Root workspace
/api - Backend server
/client - Frontend React app
/packages/* - Shared libraries
4
Build the Application
# Build all packages (uses Turborepo for speed)npm run build
This compiles:
packages/data-provider - Shared API types
packages/data-schemas - Database schemas
packages/api - TypeScript backend code
packages/client - Frontend utilities
client - React frontend build
5
Start Meilisearch
In a separate terminal:
# Linux/macOSmeilisearch --master-key="your_secure_master_key" --db-path ./meili_data# Or run as background servicemeilisearch --master-key="your_secure_master_key" --db-path ./meili_data &
6
Start the Backend
In the main terminal:
# Production modenpm run backend# Development mode (with file watching)npm run backend:dev
The backend runs on http://localhost:3080
7
Start the Frontend (Development)
For development with hot module reloading, in another terminal:
npm run frontend:dev
The dev server runs on http://localhost:3090 and proxies API requests to :3080
# Install/Update dependenciesnpm run smart-reinstall # Install only if lockfile changednpm run reinstall # Clean install from scratch# Build commandsnpm run build # Build all packages (Turborepo)npm run build:data-provider # Rebuild data-provider onlynpm run build:client # Build frontend only# Run backendnpm run backend # Production modenpm run backend:dev # Development with file watchingnpm run backend:inspect # With Node.js debugger# Run frontendnpm run frontend:dev # Development server (port 3090)# User managementnpm run create-user # Create a new usernpm run list-users # List all usersnpm run reset-password # Reset user passwordnpm run ban-user # Ban a usernpm run delete-user # Delete a user# Balance management (if CHECK_BALANCE enabled)npm run add-balance # Add token balance to usernpm run set-balance # Set user token balancenpm run list-balances # List user balances# Testingnpm run test:api # Run API testsnpm run test:client # Run frontend testsnpm run test:all # Run all tests# Linting and formattingnpm run lint # Check for lint errorsnpm run lint:fix # Auto-fix lint errorsnpm run format # Format code with Prettier
# Clear caches and rebuildnpm run reinstallnpm run build# If still failing, check Node.js versionnode --version # Must be v20.19.0+# Install specific Node version with nvm:nvm install 20nvm use 20
MongoDB not connecting
# Check MongoDB is runningsudo systemctl status mongod# Start MongoDBsudo systemctl start mongod# Check connectionmongosh mongodb://127.0.0.1:27017/LibreChat# If connection refused, check MONGO_URI in .env
Meilisearch not working
# Start Meilisearch with correct keymeilisearch --master-key="DrhYf7zENyR6AlUCKmnz0eYASOQdl6zxH7s7MKFSfFCt" --db-path ./meili_data# Verify it's runningcurl http://127.0.0.1:7700/health# Check MEILI_HOST and MEILI_MASTER_KEY match in .env