Skip to main content

Classic design · Mid

Online chess (matchmaking and real-time state)

Classic interview design. Key points: WebSocket and presence and rating-based matchmaking.

14 min read · Content reviewed on October 23, 2026

Short answer

Classic interview design. Key points: WebSocket and presence and rating-based matchmaking. An online chess platform does three things: finds an opponent of a similar level, hosts a real-time game with a clock for each player, and maintains a global rating ranking. This involves real-time communication between browser and server.

01 · CONTEXT

What an online chess platform needs to do

An online chess platform does three things: finds an opponent of a similar level, hosts a real-time game with a clock for each player, and maintains a global rating ranking. This involves real-time communication between browser and server.

The point that organizes the design appears right in the source's prompt: the server validates every move and owns both clocks, so a player cannot claim that an illegal move is valid or that they still have more time.

02 · REQUIREMENTS AND SCALE

A single format and reference numbers

The prompt fixes a single format, the three-minute blitz: each player has three minutes in total and their clock only runs on their own turn. With that, all games follow the same matchmaking and clock rules.

There are three core requirements: find an opponent through level-based matchmaking and start the game; play in real time; and see the global ranking and your own position, updated shortly after each game ends.

The reference scale is 10 million registered players and 500 thousand simultaneous games at peak. Since each game has two players, each on their own connection, that is 1 million simultaneous connections, plus the capacity to validate every move and run two clocks per game.

03 · BASE DESIGN

First, just one game

The source proposes building a single game first and only then tackling, in the deep dives, the parts that get hard at scale. This teaching diagram follows that order.

  1. The browser sends each move to the game server. The design has a single server to focus on the flow of one game.

    Architecture diagram: Online chess: one game
    CLPlayer's browser
    CPGame server
    DBPlayer and game database
  2. The game server validates the move and owns both clocks: the player cannot claim that an illegal move is valid or that they have more time.

    Architecture diagram: Online chess: one game
    CLPlayer's browser
    CPGame serverautoridade
    DBPlayer and game database
  3. Each player's clock runs only during their turn, and it is controlled by the server, not the browser.

    Architecture diagram: Online chess: one game
    CLPlayer's browser
    CPGame serverclock
    DBPlayer and game database
  4. At the end of the game, the server writes the result to the database, from which the ratings and the ranking come.

    Architecture diagram: Online chess: one game
    CLPlayer's browser
    CPGame server
    DBPlayer and game databasenew

04 · DEEP DIVES

Where the problem gets hard

According to the source, the parts that get hard at scale are matchmaking, the fleet of game servers, a fair clock under different latencies, and fast reads of the ranking.

TemaQuestion the source lists
MatchmakingHow do you prevent a player from being paired into two games?
Game serversHow do you scale the game servers to 500 thousand simultaneous games?
ClockHow do you keep the clock fair despite unequal latencies?
RankingHow do you keep the ranking correct and fast with 10 million players?

05 · REAL REFERENCE

What Lichess documents

Lichess's README describes part of the architecture. WebSocket connections live on a separate server, which communicates through Redis; the pure chess logic lives in its own submodule; and the games are stored in MongoDB, indexed by Elasticsearch, totaling more than 12 billion.

  1. Real-time connections go through a load balancer and reach connection-only servers, separate from the game logic, as in Lichess.

    Architecture diagram: Online chess: full platform
    CLPlayer's browser
    NWConnection load balancer
    CPConnection serverconnections only
    CHMessage Redis
    CPMatchmaking service
    CPGame server
    DBPlayer and game database
    QResults queue
    CPRanking updater
    CHCached ranking
  2. The connection server talks to the rest of the system over a Redis channel, as Lichess's README describes.

    Architecture diagram: Online chess: full platform
    CLPlayer's browser
    NWConnection load balancer
    CPConnection server
    CHMessage Redisnew
    CPMatchmaking service
    CPGame server
    DBPlayer and game database
    QResults queue
    CPRanking updater
    CHCached ranking
  3. The game request goes to matchmaking, which looks for an opponent of a similar level and triggers a game server.

    Architecture diagram: Online chess: full platform
    CLPlayer's browser
    NWConnection load balancer
    CPConnection server
    CHMessage Redis
    CPMatchmaking service
    CPGame servernew
    DBPlayer and game database
    QResults queue
    CPRanking updater
    CHCached ranking
  4. During the game, the game server validates each move and controls the clocks, receiving and returning messages over the Redis channel.

    Architecture diagram: Online chess: full platform
    CLPlayer's browser
    NWConnection load balancer
    CPConnection server
    CHMessage Redis
    CPMatchmaking service
    CPGame serverautoridade
    DBPlayer and game database
    QResults queue
    CPRanking updater
    CHCached ranking
  5. When the game ends, the result goes to a queue and a consumer updates the ratings and the ranking, which lets the ranking change shortly after games finish.

    Architecture diagram: Online chess: full platform
    CLPlayer's browser
    NWConnection load balancer
    CPConnection server
    CHMessage Redis
    CPMatchmaking service
    CPGame server
    DBPlayer and game database
    QResults queuenew
    CPRanking updaternew
    CHCached ranking
  6. Ranking queries read from a dedicated cache instead of hitting the database on every request.

    Architecture diagram: Online chess: full platform
    CLPlayer's browser
    NWConnection load balancer
    CPConnection server
    CHMessage Redis
    CPMatchmaking service
    CPGame server
    DBPlayer and game database
    QResults queue
    CPRanking updater
    CHCached rankingfast read

Ratings on Lichess use the Glicko-2 method. The documentation also records two rules: games lost to lag or disconnection do not give points back, but when Lichess itself restarts and someone loses on time because of it, the game is aborted.

Frequently asked questions

What is Online chess (matchmaking and real-time state)?

Classic interview design. Key points: WebSocket and presence and rating-based matchmaking.

What does the Online chess (matchmaking and real-time state) design cover?

It is organized in these sections: What an online chess platform needs to do, A single format and reference numbers, First, just one game, Where the problem gets hard, and What Lichess documents.

How long is Online chess (matchmaking and real-time state) and what level is it?

It takes about 14 minutes to read and is rated Mid level.

Now design it yourself

Run this case as an interview in the System Design school: you make the decisions, the tutor challenges them and you see how your design scores.