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

sparkid

v1.2.0

Published

Fast, time-sortable, 22-char Base58 unique ID generator

Readme

sparkid

Fast, monotonic, time-sortable, 22-char Base58 unique ID generator. Zero dependencies.

1ocmpHE1bFnygEBAPTzMK4
1ocmpHE1bFnygFv4Wp4dL2
1ocmpHE1bFnygGoUXUL7Xo

Install

npm install sparkid

Usage

import { generateId } from "sparkid";

const id = generateId();
// => "1ocmpHE1bFnygEBAPTzMK4"

Properties

| Property | Value | |---|---| | Length | 22 characters, fixed | | Alphabet | Base58 (no 0, O, I, l) | | Sortable | Lexicographically, by creation time | | Monotonic | Strictly increasing within the process | | URL-safe | Yes | | Collision resistance | ~58^14 (~1.8 x 10^24) combinations per millisecond | | Randomness | Cryptographically secure (crypto.getRandomValues) |

How it works

Each ID is composed of two parts:

[8-char timestamp][14-char suffix]
  • Timestamp (8 chars): Current time in milliseconds, Base58-encoded. IDs generated in a later millisecond always sort after earlier ones.
  • Suffix (14 chars): Seeded from crypto.getRandomValues (rejection-sampled, no modulo bias) at the start of each millisecond, then monotonically incremented for each subsequent ID within that millisecond. This guarantees strict ordering even when multiple IDs share a timestamp.

Ordering guarantees

All IDs generated by generateId() within a single process are strictly monotonically increasing — every ID is lexicographically greater than the one before it. Since JavaScript is single-threaded, this means process-wide monotonicity with no additional coordination needed.

Performance

~22 million IDs/sec on Node.js (~0.05 µs/call):

npm run bench

Platform support

Works in any environment with crypto.getRandomValues:

  • Node.js >= 19
  • All modern browsers
  • Deno
  • Bun
  • Cloudflare Workers

License

MIT