Prerequisites
Before you begin, ensure you have the following installed on your system:Java Development Kit (JDK)
Install JDK 21 or later. Lichess requires a full JDK, not just a JRE.
Make sure
JAVA_HOME is set correctly and points to a JDK installation with the compiler module.MongoDB
Install MongoDB for game data storage. Lichess expects MongoDB running on
mongodb://127.0.0.1:27017.Quick Setup
Get Lichess running locally in just a few commands:Configure Default Settings
The
lila.sh script automatically creates default configuration files if they don’t exist:.sbtopts- SBT memory and GC settingsconf/application.conf- Application configuration
.default templates on first run.View default memory settings
View default memory settings
The default
.sbtopts file configures:- Initial heap: 2GB (
-Xms2g) - Maximum heap: 8GB (
-Xmx8g) - Stack size: 2MB (
-Xss2m) - G1 garbage collector
.sbtopts file if needed.Start the SBT Console
Run the This starts the Scala Build Tool (SBT) console. You’ll see the Lichess ASCII banner and the SBT prompt.
lila.sh wrapper script to start SBT:The first run will download all dependencies, which may take several minutes.
Compile and Run
Inside the SBT console, compile and run the application:This compiles all Scala modules and starts the Play Framework server.
Access Your Local Instance
Once the server is running:- Web Interface: Open http://localhost:9663 in your browser
- WebSocket Server: Runs on port 9664 (configured in
conf/base.conf) - API Endpoints: Available at
http://localhost:9663/api/
The default development ports are:
- HTTP: 9663
- WebSocket: 9664
conf/base.conf or conf/application.conf.Development Workflow
Making Changes
Running Tests
Code Formatting
Linting
Configuration
Application Configuration
Key configuration files:conf/application.conf: Your local overrides (gitignored)conf/base.conf: Base configuration with defaultsconf/application.conf.default: Template for local config
Example: Change the HTTP port
Example: Change the HTTP port
Edit Then restart the server.
conf/application.conf:Database Configuration
MongoDB URI is configured inconf/base.conf:
conf/application.conf if you need different settings.
Common Issues
OutOfMemoryError during compilation
OutOfMemoryError during compilation
Increase heap size in
.sbtopts:MongoDB connection refused
MongoDB connection refused
Ensure MongoDB is running:
Frontend assets not loading
Frontend assets not loading
Build the frontend assets:Make sure the build completes successfully and generates files in
/public/compiled.Port already in use
Port already in use
Change the port in Or kill the process using the port:
conf/application.conf:Next Steps
Architecture
Learn about Lichess system design and components
Contributing Guide
Read the full contributing guidelines
Development Wiki
Detailed setup instructions and tips
Discord Community
Ask questions and get help from developers
Additional Resources
- Module Structure: Explore the 83 modules in
/modulesdirectory - Frontend Packages: TypeScript packages in
/uiuse pnpm workspace - Chess Logic: Pure chess implementation in scalachess submodule
- API Documentation: https://lichess.org/api

