jhlywa/chess.js

A TypeScript chess library for chess move generation/validation, piece placement/movement, and check/checkmate/draw detection

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 52 minutes ago
Type:Library / SDKCategory(s):Game DevelopmentMedia, Graphics & Games
Added to GitGenius on September 15th, 2026
Created on December 29th, 2008
Open Issues & Pull Requests: 45 (+0)
GitHub issues: Enabled
Number of forks: 987
Total Stargazers: 4,407 (+0)
Total Subscribers: 94 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 13.0 days
Mean response time: 533.4 days
90th percentile: 2322.4 days
Tracked items: 120

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 17
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 837 days
Stale 30+ days: 17
Stale 90+ days: 7

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • Type: enhancement (6)
  • investigate (3)
  • Type: bug (2)
  • chore (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

chess.js is a TypeScript chess library that handles move generation and validation, piece placement and movement, and detection of check, checkmate, and draw conditions.

The library solves the problem of implementing chess game logic by providing a complete ruleset engine. It validates moves according to standard chess rules, generates all legal moves from any position, and tracks game state including piece locations, whose turn it is, and whether the game has ended. The approach centers on a board representation that can be queried and modified, with methods to apply moves, undo them, and inspect the resulting position for terminal conditions.

The tool suits projects that need reliable chess rule enforcement without building that logic from scratch, such as chess applications, game servers, or analysis tools. It works well for any context where you need to verify that a move is legal, determine what moves are available, or check if a position represents checkmate or a draw. The library is language-agnostic in principle but implemented in TypeScript, making it natural for JavaScript and TypeScript projects.

The project shows consistent maintenance with regular updates addressing bugs and edge cases in move generation and game state detection. Pull requests receive timely review and integration. The codebase demonstrates attention to correctness in complex areas like en passant handling, castling rights, and threefold repetition detection. Issue reports are addressed promptly, particularly those identifying incorrect legal move generation or state tracking. The project maintains clear documentation through its homepage and README, supporting developers integrating the library into their applications.