Chess Database API is a self-hosted, read-only service for discovering curated games by player, event, rating, date and position. Opening Explorer serves precomputed position statistics, and optional search indexes add paginated game summaries and exact filtered opening statistics. Retrieve individual games as canonical PGN.
The Rust service uses immutable snapshots of separately curated and deduplicated collections.
Availability. Run the service yourself using the Masters OTB R3 and Elite Online R1 releases. Each release contains an indexed dataset and a filtered PGN. Dataset releases explains installation and licenses.
Chess Database API v0.2.0 provides a Linux x86-64 CLI, a Linux x86-64 Docker image archive, source archives and checksums. The CLI requires the x86-64 loader, libgcc_s.so.1 and glibc symbols through GLIBC_2.34. The image is distributed as a Docker archive, not a registry image: verify it, then run docker load -i chess-database-api-v0.2.0-linux-amd64.docker.tar.gz to load chess-database-api:release-v0.2.0.
For a fresh deployment, install the canonical datasets using Dataset releases, then install the matching companions. Existing compatible CPI-only installations do not need to download their canonical data again. Download Elite D30 or Masters D40 part 1 and part 2, together with the manifests, notices and checksum files from their Elite release and Masters release. Follow the verification, installation and rollback instructions. Masters data and its companion are non-commercial with attribution and unresolved upstream-rights disclosures; see licensing.
- Developers building game search, player discovery, or an opening explorer into a chess app.
- Analysts who want exact opening statistics for a player, rating range, or period.
- Researchers who want curated, legal, deduplicated PGN to work with.
Two collections are kept strictly apart. Their ratings and statistics are never pooled.
masters-otb |
elite-online |
|
|---|---|---|
| Games | 3,284,429 | 429,150 |
| Source | Lumbra's Gigabase OTB Complete (publisher-asserted over-the-board) | Lichess rated archive |
| Rating scale | Publisher-supplied Elo (FIDE-style) | Lichess platform rating |
| Selection | Standard legal chess, at least four plies, rating thresholds | Both players 2200+, or one 2400+ and the other 2000+; no bullet; at least six plies |
| Indexed depth | 40 plies | 30 plies |
| Dataset license | CC BY-NC 4.0 (publisher claim); non-commercial, attribution required | CC0 1.0 |
Elite Online covers seven selected monthly archives from September 2015 through March 2017. It is historical data, not a feed of contemporary games. Its player ratings are Lichess Glicko-2 ratings and are not comparable to the Masters collection's FIDE-style Elo values.
Do not compare an OTB Elo with an online rating as if they were one scale. Details: API reference, interpreting statistics.
| Endpoint | Purpose |
|---|---|
GET /v1/explorer/position |
Position statistics from moves= (SAN or UCI) or fen=: total games, W/D/L, next moves, each with W/D/L |
GET /v1/collections |
Loaded collections, snapshot versions and capabilities |
GET /v1/collections/{collection}/games |
Paginated game discovery by metadata, position or continuation |
GET /v1/collections/{collection}/players and /events |
Player and event discovery |
GET /v1/explorer/position/filtered |
Exact opening statistics for a subset of one collection |
GET /v1/collections/{collection}/games/{id} |
Canonical PGN of one stored game (enabled by default) |
GET /health, GET /ready |
Liveness and readiness |
POST /v1/admin/reload |
Token-protected hot reload of a newly published dataset |
See the API reference and search contract.
Build the CLI (chess-database), make a small sample dataset from the bundled synthetic fixture, serve it, and query it:
cargo build --locked --release --package chess-database-cli
./target/release/chess-database build \
--input fixtures/stage_a_validation.pgn --collection elite-online \
--output data/sample/elite-online
./target/release/chess-database build-index \
--dataset data/sample/elite-online --collection elite-online
./target/release/chess-database build-search-index \
--dataset data/sample/elite-online
./target/release/chess-database serve \
--elite-dataset data/sample/elite-online --host 127.0.0.1 --port 8080In another terminal, discover games that reached the board after 1.e4 e5 2.Nf3, then compare opening statistics for a rating range:
API=http://127.0.0.1:8080
curl --fail-with-body --get "$API/v1/collections/elite-online/games" \
--data-urlencode 'moves=e4,e5,Nf3' --data-urlencode 'limit=3'
curl --fail-with-body --get "$API/v1/explorer/position/filtered" \
--data-urlencode 'collection=elite-online' \
--data-urlencode 'moves=e4,e5,Nf3' --data-urlencode 'min_both_ratings=2200'Game search returns stable IDs and matching plies. Use an ID with GET /v1/collections/elite-online/games/{id} to retrieve its PGN. Getting started walks through the synthetic fixture.
cp .env.example .env # point it at your dataset directory
docker compose -f compose.yaml -f compose.debug.yaml up -d --build
curl http://127.0.0.1:8081/readySee Deployment for read-only mounts, resource bounds, and operational settings.
Both collection releases use two products, and the indexed and PGN products for one collection contain the same canonical games. Both indexed releases can be enriched locally with derived search indexes.
| Collection | Indexed dataset | Filtered PGN | Coverage and license |
|---|---|---|---|
| Masters OTB R3 | Published release, 3,284,429 games, CPI depth 40 | Zstandard-compressed PGN in the same release | CC BY-NC 4.0 publisher claim; non-commercial use with attribution. See the current policy. |
| Elite Online R1 | Published release, CPI depth 30 | One complete canonical game per PGN record, Zstandard-compressed | 429,150 games from selected Lichess rated archives in 2015–2017; CC0 1.0. Commercial redistribution is permitted under CC0. |
The indexed package contains the immutable snapshot, position index, release metadata, and checksums. The filtered PGN preserves supported stored metadata and full legal mainlines. Masters R3's indexed package is split into two numbered assets; the Elite package is split only if it exceeds the per-asset limit. See Dataset releases for download links, checksum verification, reconstruction, installation, PGN extraction, and versioning. To reproduce Elite Online from the pinned sources, follow Corpus build.
Worked examples are in docs/USE_CASES.md, with runnable code in examples/ (curl, dependency-free JavaScript, Python):
- Game browser in a chess app. Discover players and find games that reached the current board.
- Opening Explorer in a chess app. Show next moves for the corpus or a rating and date range.
- Masters vs. Elite comparison: query both collections for one position and show them side by side, never merged.
- Next-move frequencies and W/D/L for a position.
- Analysis pipeline: batch positions through the API and export CSV.
- Curated PGN for research: use the filtered PGN download.
A minimal JavaScript client:
import { OpeningExplorerClient } from "./examples/js/opening-explorer.mjs";
const explorer = new OpeningExplorerClient("http://127.0.0.1:8080");
const result = await explorer.position({ collection: "elite-online", moves: ["e4", "e5", "Nf3"] });
console.log(result.total_games, result.moves[0]);| Need | Read |
|---|---|
| First run | Getting started |
| Endpoints, errors, config | API reference |
| Downloading and installing datasets | Dataset releases |
| Running it in production | Deployment |
| Building from source and rebuilding corpora | Corpus build, Contributing |
| Data and licensing | Licensing and attribution |
| Internals and formats | Architecture, Data contracts |
| Benchmarks and research | Benchmarks, research archive |
| Upgrading CLI, image or configuration names | Naming migration |
The complete index is docs/README.md.
./scripts/validate.sh # format, clippy, tests, evidence and documentation gatesContribution rules are in CONTRIBUTING.md; agent workflow notes are in AGENTS.md.
- Software: MIT or Apache-2.0, at your option. These licenses do not apply to the datasets.
- Masters OTB data: games from Lumbra's Gigabase, which the publisher offers under CC BY-NC 4.0. This project filtered, deduplicated, normalized, and indexed them; it claims no authorship of any game and is not endorsed by the publisher. Non-commercial use only, with attribution. Public, non-commercial deployment of the API (position statistics and single-game PGN retrieval) is supported under the maintainer's recorded decisions; commercial use is not covered. The terms for your application, the required acknowledgment, and the open questions are in docs/LICENSING.md.
- Elite Online data: selected standard rated archives from Lichess, licensed under CC0 1.0 Universal. Chess Database API filters, deduplicates, normalizes, and indexes these historical games; the data license is separate from the software license. See LICENSING.md for source periods and details.
Attribution text, changes made, and the open upstream-rights questions: docs/LICENSING.md.