Lila is the backend codebase powering Lichess, a free, open-source online chess server with millions of users. The architecture handles real-time games, puzzles, tournaments, correspondence chess, streaming, and user profiles, scaling to thousands of simultaneous matches. The system uses functional programming principles (in Scala) to maintain reliability—state transitions, clock management, game rules, and move validation are deterministic, reducing synchronization errors. Lila also integrates rating systems (e.g. Glicko), puzzles generation, AI opponents, and cheat detection systems. A real-time socket layer (WebSocket) streams move updates, chat, and broadcast events, while REST APIs support client and bot integrations. Supporting features like database schema migrations, analytics, moderation tools, and backups are woven into the platform so the community can contribute and host clubs/variants (Chess960, King of the Hill, etc.).
Features
- Supports many chess variants (Standard, Blitz, Bullet, Rapid, Classical, Correspondence; plus variants like Crazyhouse, Chess960, King of the Hill, Three-check, Horde, etc.)
- Free account access to everything: puzzles, analysis, opening explorer, studies, etc., with no advertisements or paywalls
- Deep engine analysis: e.g. Stockfish integration, both in browser (client side) and server side, with unlimited or generous use in many features
- Tournaments, arena/swiss style, live play, correspondence play; ability to challenge friends or random players
- Studies and learning tools: shareable analysis boards, lessons, opening explorer, puzzles, board editor etc.
- Mobile apps (Android and iOS), web front-end, multiple languages, responsive and accessible UI, including features for visually impaired players etc.