- TypeScript 54.7%
- Rust 30.9%
- CSS 10.8%
- JavaScript 1.8%
- HTML 1.2%
- Other 0.6%
openMyGame is tested with a stubbed server; the review-cache save decision is a pure function; the review request is aborted on timeout and its timer cleared; the page is marked busy while a game opens and ignores repeat clicks. The saved depth is the review's own. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| blog | ||
| docs | ||
| functions/engine | ||
| public | ||
| scripts | ||
| server | ||
| shared | ||
| src | ||
| supabase | ||
| .env | ||
| .env.server | ||
| .env.web | ||
| .envrc | ||
| .gitignore | ||
| .nvmrc | ||
| .oxlintrc.json | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| embed.html | ||
| flake.lock | ||
| flake.nix | ||
| index.html | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||
Rookahead
A chess analysis board running Stockfish 19 in the browser, multi-threaded, with the full NNUE network.
- Live analysis of any position: up to 5 engine lines, best-move arrows, eval bar
- Game review: every move graded with Rookahead's verdicts (Legendary, Clutch, Best, Strong, Solid, Theory, Slip, Mistake, Oversight, Blunder, Forced), accuracy per player, an eval graph marking the key moments, and a step-through mode with commentary
- Paste a PGN / FEN, or import recent games by username
- Play your own moves on the board to explore side variations (promote or delete them later)
- Clocks from the PGN, keyboard navigation, board themes, and the session survives a refresh
- Move sounds (synthesised in the browser, no audio files) and animated pieces, verdicts and summary
Running it
npm install # also copies the Stockfish builds into public/engine/
npm run dev # http://localhost:5173
Requires Node 20+. It starts on the Lite engine, a 2 MB network that loads instantly (still far stronger than any human). Pick Full in Settings for the strongest analysis: that downloads the ~100 MB network once, and the browser caches it after that.
Multi-threading
Multi-threaded WASM needs SharedArrayBuffer, which browsers only allow on cross-origin isolated pages.
The dev and preview servers send the required headers (see vite.config.ts):
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
If you host the built dist/ elsewhere, send those two headers too, or the app falls back to a single thread.
How moves are classified
Rookahead's own rules for every verdict live in docs/rulebook.md; src/lib/classify.ts follows them.
The opening book is Lichess's CC0 opening list (src/data/openings.json).
- Accuracy — Lichess's open formula (volatility-weighted and harmonic means of per-move accuracy)
To rebuild the opening book: node scripts/build-openings.mjs <dir with a.tsv … e.tsv> from
https://github.com/lichess-org/chess-openings.
Keyboard
| Key | Action |
|---|---|
| ← / → | Previous / next move |
| ↑ / Home | Start of the game |
| ↓ / End | End of the current line |
| F | Flip the board |
| L | Toggle the engine |
| Space | Play through the moves |
Scripts
| Command | |
|---|---|
npm run dev |
Dev server |
npm run build |
Type-check and build to dist/ |
npm run preview |
Serve the build (with isolation headers) |
npm test |
Unit tests (Vitest) |
npm run lint |
Lint (oxlint) |
Set localStorage.setItem('rookahead.debug', '1') in the browser console to log all UCI traffic.
Layout
src/
engine/Engine.ts Stockfish worker wrapper: UCI, one-search-at-a-time queue, cancellation
hooks/useAnalysis.ts Live analysis (with per-position cache) and full-game review
hooks/useEngine.ts Engine lifecycle
lib/tree.ts Game tree (main line + variations), PGN import/export
lib/uci.ts UCI "info" line parser
lib/evaluation.ts Score conversion, win %, formatting
lib/chesscom.ts Chess.com public API client
components/ Board (Chessground), eval bar & graph, move list, engine lines, dialogs
Licences
Rookahead is free software under the GNU General Public License v3.0 or later (see LICENSE).
It builds on Stockfish.js (GPL-3.0) and Chessground (GPL-3.0-or-later), so anyone serving the app must also offer its source under the GPL. The opening book comes from Lichess's chess-openings (CC0) and the Geist fonts are under the SIL Open Font License.