A two-player chess game with a TypeScript backend and a React frontend.
How it works
- Matchmaking. A Node.js WebSocket server pairs players as they ask for a game, and assigns white and black.
- The server is the referee. Every move goes through chess.js (opens in a new tab) on the server. It rejects moves made out of turn or against the rules before anything is broadcast.
- One source of truth. After each valid move, the server sends the new board position to both players, so the two boards can’t drift apart.
- Frontend. React with Vite and Tailwind CSS, with a custom hook that manages the socket connection.