Play chess against a friend on a shared laptop without any account or internet connection.
Learn how to build a browser-based board game with a TypeScript backend and a REST API.
Use the built-in Swagger docs page to explore and test the chess game API endpoints interactively.
Requires pnpm, one install and one start command to run locally in the browser.
Local Chess is a two-player chess game for two people sharing one laptop. You open it in a browser, play a game, and the board flips automatically after each move so each player sees their own side facing them. All the standard chess rules are covered: legal move highlighting, check detection, checkmate, stalemate, and automatic pawn promotion to queen. Three rules from the official rulebook are not yet implemented: castling, en passant, and choosing a promotion piece other than queen. The project is built with TypeScript and runs a small local web server using the Express framework. The browser communicates with the server through three API endpoints: one to read the current game state, one to handle a board click, and one to reset the board. Game state lives in memory on the server, so restarting the server clears the current match. The visual side is more elaborate than a basic board. Piece movement is animated with smooth travel between squares, captures play a collapse animation, and a victory overlay appears at checkmate with a restart button. The pieces are styled to look three-dimensional rather than flat symbols, and the board sits against a moving background in a red, black, and orange color scheme. Because the API follows the OpenAPI 3.0 standard, the project includes a Swagger documentation page available at a local URL. You can read endpoint descriptions and try out API calls directly from the docs page without writing any extra code. The source is organized into four TypeScript files covering game rules, the server, the API specification, and piece movement logic, plus a single HTML file for the entire frontend. Starting the project requires one install command and one start command using the pnpm package manager.
← hurapanda on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.