npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@marianmeres/chessboard

v0.3.0

Published

[![NPM](https://img.shields.io/npm/v/@marianmeres/chessboard)](https://www.npmjs.com/package/@marianmeres/chessboard) [![JSR](https://jsr.io/badges/@marianmeres/chessboard)](https://jsr.io/@marianmeres/chessboard)

Readme

@marianmeres/chessboard

NPM JSR

A dependency-light, pure-TS description of a chess board — its geometry, positions, rules, and notation. No rendering, no engine, no I/O.

Status: 0.x work in progress. API may change without ceremony until 1.0.

Four layered subpath exports — import only what you need (the root export re-exports everything):

| Subpath | Layer | Concern | | ---------------------------------- | ----- | -------------------------------------------------------------------- | | @marianmeres/chessboard/geometry | L0 | squares, files/ranks, piece vocabulary, distances, rays, orientation | | @marianmeres/chessboard/position | L1 | piece placement (Board), FEN | | @marianmeres/chessboard/rules | L2 | legal moves, make/unmake, SAN/UCI, perft | | @marianmeres/chessboard/game | L3 | PGN, variations, replay cursor |

Works in Deno, Node and browsers. The only runtime dependency is @marianmeres/clog (injectable logging). The rules layer is verified against the full published Chess Programming Wiki perft table.

Install

npm i @marianmeres/chessboard
deno add jsr:@marianmeres/chessboard

Basic Usage

Geometry — coordinates and orientation for a board UI

import {
	formatSquare,
	renderOrder,
	squareAtCell,
	squareColor,
} from "@marianmeres/chessboard/geometry";

// the 64 squares in display order (row-major from the screen's top-left),
// White at the bottom — everything a dumb grid renderer needs
for (const sq of renderOrder("white")) {
	console.log(formatSquare(sq), squareColor(sq)); // "a8 light", "b8 dark", ...
}

// hit-test a tap at grid cell col 4, row 4
squareAtCell(4, 4, "white"); // 28 — e4

Position — FEN in and out

import { formatFen, parseFen } from "@marianmeres/chessboard/position";

// parsing is permissive: never throws, collects diagnostics into `errors`
const { setup, errors } = parseFen(
	"r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1",
);
errors; // [] — clean parse
setup.turn; // "w"
formatFen(setup); // round-trips

Rules — legal moves and SAN

import { createPosition } from "@marianmeres/chessboard/rules";

const pos = createPosition(); // standard initial position
pos.makeMove(pos.parseSan("e4")!);
pos.makeMove(pos.parseSan("c5")!);
pos.moves().length; // 30
pos.fen(); // "rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2"

Game — PGN and replay

import { parsePgn } from "@marianmeres/chessboard/game";

const pgn = `[Event "Casual"]

1. e4 e5 2. Nf3 Nc6 *`;

const { games, errors } = parsePgn(pgn); // never throws, whatever the input
const cursor = games[0].cursor();
while (cursor.next()) {
	console.log(cursor.node()!.san, cursor.fen());
}

API Reference

See API.md for the complete API documentation, and docs/DESIGN.md for the design rationale.

License

MIT