Games (chess & draughts)
Domain, services, and UI packages for the chess and draughts games — plus their local type shims and a Blind 75 algorithms package.
These packages split the two board games into per-concern layers (domain
schemas, Effect services, React UI, rules engines) so chess-services and
chess-ui — or draughts-rules and draughts-ui — can be tested and
versioned independently. @repo/algorithms and the two @types/* shims are
grouped here because they only exist to support this games code.
@repo/chess-domain
Schema-first domain types shared between the chess server and client: no UI,
no I/O. Everything is effect Schema classes/unions, so decoded values are
the only shapes the rest of the chess code is allowed to see.
ChessError— taggedChessErrorand its reason union (illegal move, not your turn, game not found, game over, join code not found, game already full, cannot join own game, not a participant)ChessGame—Side,Outcome,GameStatus,Variant,Move,GameState, and theGameEventunion (GameCreated,PlayerJoined,MoveMade,GameEnded)ChessId— brandedGameId,PlayerId,JoinCodeschemasChessRpc— theOnlineRpcRpcGroup,Unauthorizederror, and theGuestSession/GuestSessionMiddlewareRPC middlewareChessSignal—SignalKindandSignalEventschemas for WebRTC signalingChessEvent— a smalldefine/registeredevent-registry helper used to build the tagged events above
@repo/chess-services
Effect services that implement chess gameplay: the engine integration and the
game/matchmaking logic, backed by @repo/db and @repo/realtime.
EngineService— aContext.Servicewrapping thestockfishUCI engine (via@repo/stockfish-types) for move analysis/best-move requestsGameService— aContext.Servicefor creating, joining, and advancing chess games (row ⇄GameStatemapping, side resolution, event ids)detectOutcome/rulesForVariant(fromrules-adapter) — adaptschess.jsinto the sharedGameRules/MoveApplicationshape and detects checkmate/stalemate/draw outcomes
@repo/chess-ui
React components and hooks for rendering a chess board and its game-end
celebration, built on @repo/chess-domain types.
Board— the chess board componentisWin,outcomeLabel,type Outcome— outcome-to-label helpersfireConfetti,fireOutcomeConfetti—canvas-confettiwrappersuseOutcomeConfetti— fires confetti on a win outcomeuseDialogCloseHandlers— shared close-handling for game-end dialogs
@repo/draughts-rules
Effect-based rules engines for draughts, covering three variants behind one
DraughtsRules interface.
rulesFor(variant)— picks the rules implementation for"international" | "english" | "russian"internationalRules— wraps@jortvl/draughts(via@repo/jortvl-draughts-types) as the authoritative rules oracle for international draughtsenglishRules,russianRules— hand-rolled rules implementations (handrolled.ts)board—squareToCell,squareToAlgebraic,algebraicToSquare,cellToSquare,buildFen,parsePositionsquare/FEN helpersvariant—Variant,Player,Outcome,DraughtsMoveschemasrules— the sharedDraughtsRules/MoveResulttypes
@repo/draughts-ui
A single React board component for draughts, mirroring @repo/chess-ui's
role for the chess game.
DraughtsBoard,type DraughtsBoardProps— the draughts board component, built on@repo/draughts-rulestypes
@repo/algorithms
A standalone learning/reference package of Blind 75 algorithm solutions and
generic data structures (TypeScript, with parallel Go/Kotlin/Python/Rust
solutions); it isn't imported by the games code and isn't published as
@repo/* (its package name is bare algorithms).
Heap<T>— generic min/max heap backed by an array and a comparatorListNode,TreeNode,TrieNode— linked-list, binary-tree, and trie node types used across the solutionssrc/blind-75-solutions/typescript/**— the 65 Blind 75 solutions grouped by category (array, binary, dynamic-programming, graph, heap, interval, linked-list, matrix, strings, tree)
@repo/stockfish-types
A local @types/stockfish shim for the stockfish npm package, which ships
no published types. Declares only the surface EngineService relies on.
StockfishEngine— the UCI engine handle type (listener,sendCommand,terminate)initEngine(flavor?)— default export, initializes an engine instance
@repo/jortvl-draughts-types
A local @types/jortvl__draughts shim for @jortvl/draughts, which also
ships no published types. Declares only the surface @repo/draughts-rules'
international adapter uses.
JortvlMove— one legal move (from,jumps,takes,to)Draughts— default-exported class:moves(),move(),fen(),turn(),gameOver()
Both @types/* packages are private, workspace-only shims for libraries that ship no types of
their own — they exist purely so the declarations resolve wherever the consuming package is
type-checked, not just locally.
See the packages overview and the architecture guide.