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

ankipack

v0.3.1

Published

Generate, read and edit Anki .apkg decks with full FSRS support. Works in browsers, Node.js, and Bun.

Readme

Generate, read and edit Anki .apkg decks programmatically, with full FSRS support. Works in browsers (including extensions), Node.js, and Bun.

ankipack targets Anki's modern schema (V18, with protobuf-encoded deck configs) and is verified against Anki 26.08.1. As far as I know, it is the only JavaScript or TypeScript package made for creating decks in that format, FSRS deck options included.

Your first deck goes from an empty folder to a deck in Anki in about 15 minutes. Everything else is in the documentation.

What it does

  • Builds decks. Multiple decks per package, four stock note types and custom ones, media, and tags
  • 39 deck options, FSRS included: desired retention, historical retention, custom parameters and easy days
  • Reads and edits existing packages. Review history and scheduling state survive, so editing a shared deck does not reset what its users have studied
  • Three runtime dependencies, none of which has any of its own: fflate, fzstd, @bufbuild/protobuf. About 63 kB gzipped in a browser bundle, with sql.js left external

Installation

bun add ankipack sql.js     # or: npm install ankipack sql.js
bun add -d @types/sql.js    # TypeScript, sql.js ships no types

ankipack is ESM only, which needs Node 20.19 or 22.12 and later. sql.js is an optional peer dependency: you create the instance and pass it in, which is what lets you control how its WASM binary loads. The overview has the size breakdown and the rest of the detail.

Quick start

import initSqlJs from "sql.js";
import { Package, Deck, DeckConfig, Notetype, Note } from "ankipack";

const SQL = await initSqlJs();

const notetype = Notetype.basic();

const deck = new Deck({
  name: "Spanish::Vocabulary", // use :: for subdecks
  config: new DeckConfig({
    name: "Spanish Preset",
    desiredRetention: 0.85,
    newPerDay: 15,
  }),
});

deck.addNote(new Note({ notetype, fields: ["hola", "hello"] }));
deck.addNote(new Note({ notetype, fields: ["gracias", "thank you"] }));

const pkg = new Package();
pkg.addDeck(deck);

// Node.js / Bun: write to file
await pkg.writeToFile("spanish.apkg", SQL);

// Browser: get bytes for download
const bytes = await pkg.toUint8Array(SQL);

Read ship an updated deck before you publish: a rebuilt deck duplicates every note unless you pin its identities, and there is no way to retract a note in a later release. The documentation covers the rest, including the browser, editing an existing file and every option on every class.

Contributing

Issues and pull requests are welcome. The library targets Bun for development:

bun install
bun run test        # unit tests
bun run check       # typecheck
bun run lint
bun run format

src/generated/ is produced by bun run generate from the .proto files in proto/, so it is regenerated rather than edited. The changelog records every change with its reasoning, and ships inside the package, so node_modules/ankipack/CHANGELOG.md matches the version you actually installed.

License

MIT License. See LICENSE for details.