Chessalyzer

Installation

Install Chessalyzer and import the modules you need.

Chessalyzer runs on any JavaScript runtime, with Node.js ≥ 22 or Bun being recommended. There are no other requirements, and the library itself has zero dependencies.

npm install chessalyzer

What you can import

The main entry point is chessalyzer, with a few extra subpaths for the parts you only need sometimes:

import { analyzePGN } from 'chessalyzer';
import { tileTracker, printHeatmap } from 'chessalyzer/trackers';
import { parsePGN, streamParsePGN } from 'chessalyzer/pgn';
SubpathWhat you'll find there
chessalyzeranalyzePGN, error helpers, analysis types
chessalyzer/trackersBuilt-in trackers, tracker authoring, heatmaps
chessalyzer/pgnParse-only PGN access (parsePGN, streamParsePGN)
chessalyzer/boardSquare and coordinate helpers, piece-name types
chessalyzer/replayReplay action types (Action, …)

Don't worry about memorizing these — the guides always show the right import at the top of each example.

Basic usage

If you have a PGN file lying around, this is a complete parse + analyze run:

import { analyzePGN } from 'chessalyzer';
import { tileTracker } from 'chessalyzer/trackers';

const tiles = tileTracker();

const result = await analyzePGN('games.pgn', { trackers: [tiles] });

console.log(result.gameCount, result.moveCount);
console.log(tiles.state.movesTotal);

No PGN file yet? The next page comes with a tiny one you can copy — let's run your first real analysis.

On this page