My contribution
Solo build: realtime server, game-state handling, and the React client.
The problem
Multiplayer board games look simple until two clients disagree. Castling rights, en passant, promotion, threefold repetition — and both players need to see the same board within the span of a thought.
The approach
An Express + Socket.IO server owns the game state. Clients send intent, not state: a move is emitted, validated server-side through chess.js against the full rule set, and the resulting position is broadcast to both players. The React client renders from that broadcast, so the two boards cannot drift.
Decisions
- Server-authoritative moves
- Validating on the client is a race and an invitation to cheat. The client proposes; the server decides and broadcasts. Every board is a projection of one state.
- Use a proven rules engine
- chess.js covers the rule set — including the edge cases that take longer to get right than the rest of the app combined. Reimplementing it would have been effort spent on a solved problem.
- Tune the event path, not the renderer
- Move synchronisation latency was reduced to under 200 ms in local testing by optimising Socket.IO event handling rather than by making the board redraw faster.