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

@nats-io/nuid

v3.0.0

Published

NUID - A highly performant unique identifier generator.

Readme

Nuid.js

License node deno coverage JSDoc

JSR JSR

npm npm npm

A highly performant unique identifier generator for JavaScript.

Installation

Deno (via JSR):

deno add jsr:@nats-io/nuid
import { Nuid, nuid } from "jsr:@nats-io/nuid";

Node / Bun (via npm):

npm install @nats-io/nuid
// `nuid` is a shared global instance — call `next()` on it directly.
// `Nuid` is the class — use `new Nuid()` for an isolated instance.
const { nuid, Nuid } = require("@nats-io/nuid");
// or
import { Nuid, nuid } from "@nats-io/nuid";

Basic Usage

// To generate a bunch of nuids:
let id = nuid.next();
id = nuid.next();
//

// To generate a new prefix:
nuid.reset();
// the prefix is also re-randomized automatically when the sequence
// counter overflows (i.e. reaches 62^10).
id = nuid.next();

Format

A NUID is 22 base-62 ASCII characters from the alphabet 0-9A-Za-z:

  • 12-char prefix — drawn from crypto.getRandomValues (entropy-friendly: one draw per instance, not per id). Per-prefix space is 62^12 ≈ 3.2×10^21.
  • 10-char sequence — starts at a pseudo-random offset and advances by a pseudo-random increment in [33, 332] on each next(). The sequence numerically caps at 62^10; combined with the per-instance increment, that yields roughly 62^10 / inc ids per prefix (~10^15) before the prefix is re-randomized.

Total identifier space is 62^22 ≈ 2.7×10^39.

Output format matches the Go nats-io/nuid reference — same alphabet, same length — so JS-generated nuids look the same as Go-generated ones.

Migration

From 2.x to 3.x: the public API is unchanged, and output is still 22 chars. However, generated ids now use the full base-62 alphabet (0-9A-Za-z) matching the Go nats-io/nuid reference, so any caller that validates, stores, or compares against the old uppercase-only [0-9A-Z]{22} format should update that logic before upgrading.

The 3.x version of the npm module supports both CJS and ESM. An ESM-only version of the module is available via jsr @nats-io/nuid.

Supported Node Versions

Minimum supported Node.js version is set in package.json (engines.node), currently >= 22. The version policy tracks Node.js release support: supported floor moves up as older LTS lines reach end-of-life. CI runs against the latest current release.

License

Unless otherwise noted, the NATS source files are distributed under the Apache Version 2.0 license found in the LICENSE file.