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

@pech/chess-core

v1.0.2

Published

A fast, type-safe chess library with immutable state and bitboard representation

Readme

chess-core

A fast, type-safe chess library for JavaScript and TypeScript. Immutable state, bitboard representation, and a pure functional API.

Documentation — visit for guides, examples, and the full API reference.

Interactive example — see chess-core combined with chess-board for a draggable board with legal moves and position updates.

Features

  • Bitboard-based move generation for high performance
  • Immutable positions -- every move returns a new state
  • Pure functions -- no hidden state, fully tree-shakeable
  • Type-safe -- branded types for squares, files, and ranks
  • Perft-tested -- verified against known node counts

Install

npm install @pech/chess-core
# or
bun add @pech/chess-core

Quick Start

import { fromFen, getLegalMoves, makeMove, toSan, isCheckmate, STARTING_FEN } from '@pech/chess-core';

const pos = fromFen(STARTING_FEN);
const moves = getLegalMoves(pos);
const newPos = makeMove(pos, moves[0]);

console.log(toSan(pos, moves[0]));   // "e4"
console.log(isCheckmate(newPos));     // false

API

Position

fromFen(fen: string): Position
toFen(pos: Position): string

Move Generation

getLegalMoves(pos: Position): Move[]
getPseudoLegalMoves(pos: Position): Move[]

Making Moves

makeMove(pos: Position, move: Move): Position

Validation

isCheck(pos: Position): boolean
isCheckmate(pos: Position): boolean
isStalemate(pos: Position): boolean
isInsufficientMaterial(pos: Position): boolean
isFiftyMoveRule(pos: Position): boolean
isSquareAttacked(pos: Position, sq: Square, byColor: Color): boolean

Notation

toSan(pos: Position, move: Move): string
toUci(move: Move): string
fromUci(pos: Position, uci: string): Move | null
fromSan(pos: Position, san: string): Move | null

Perft

perft(pos: Position, depth: number): number
divide(pos: Position, depth: number): DivideResult[]

Development

bun install          # install dependencies
bun run test         # run tests
bun run test:watch   # run tests in watch mode
bun run build        # build with tsup
bun run typecheck    # type-check without emitting

License

MIT