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

orion-192

v0.2.2

Published

ORION-192: ordered, resilient, independent, URL-safe 192-bit IDs for distributed systems.

Readme

orion-192 — JavaScript / TypeScript

npm version Types License: MIT Spec: v0

JavaScript / TypeScript reference implementation of ORION-192Ordered, Resilient, Independent, Opaque-ish, Non-coordinated 192-bit identifiers for distributed systems.

ORION-192 produces fixed-width, URL-safe, lexicographically sortable IDs without a central coordinator, worker ID, or machine identity in the wire format. This package is byte-compatible with the Python and Rust reference implementations.

Highlights

  • Zero runtime dependencies. The only requirement at runtime is a CSPRNG (globalThis.crypto.getRandomValues or node:crypto).
  • Dual ESM + CJS entry points with full TypeScript declarations and a types export condition.
  • Universal runtime support: Node.js ≥ 20, Bun, Deno, and modern browsers.
  • Strictly monotonic within a generator instance, including across clock rollback.
  • Wire-compatible with the Python and Rust packages — same 24-byte layout, same 32-character canonical form.

Install

npm install orion-192
# or: pnpm add orion-192
# or: yarn add orion-192

Note: the npm package is published as orion-192 (sibling implementations on PyPI and crates.io are published as o192). The unscoped name o192 is reserved by npm's anti-typosquat policy.

Quick start

import { orionid, OrionIdGenerator, parse, isValid } from 'orion-192';

// 1. One-shot helper
console.log(orionid()); // → "0Pu_iDKVO9012BwIEM28oFojPMWLWeLU"

// 2. Long-lived generator (recommended for sustained throughput)
const gen = new OrionIdGenerator({ epochMs: Date.UTC(2025, 0, 1) });
const a = gen.next();
const b = gen.next();
console.log(a < b); // true — strictly monotonic per generator

// 3. Parse and inspect
if (isValid(a)) {
  const view = parse(a, { epochMs: Date.UTC(2025, 0, 1) });
  console.log(view.unixDate, view.fraction4096, view.counter);
}

API

Top-level helpers

function orionid(): string;
function parse(id: string, options?: { epochMs?: number }): ParsedOrionId;
function isValid(id: string): boolean;
function encodeSortable64(bytes: Uint8Array): string;
function decodeSortable64(id: string): Uint8Array;

OrionIdGenerator

new OrionIdGenerator(options?: {
  epochMs?: number;          // private epoch in ms                    (default: 0)
  randomPoolBytes?: number;  // CSPRNG pool size, 14 .. 16 MiB         (default: 65 536)
  clock?: () => bigint;      // custom Unix-ns clock (test-only)
  randomFill?: RandomFiller; // custom CSPRNG (test-only)
});

generator.next(): string;            // 32-char canonical string
generator.nextBytes(): Uint8Array;   // 24-byte binary form
generator.parse(id: string): ParsedOrionId;

// Read-only telemetry
generator.epochMs: bigint;           // configured epoch as bigint
generator.lastTimeKey: bigint;       // last logical 60-bit time key
generator.counter: number;           // current 20-bit counter value
generator.clockRollbacks: number;    // observed backward jumps
generator.syntheticTicks: number;    // counter-overflow advances

ParsedOrionId

interface ParsedOrionId {
  id: string;            // original canonical string
  bytes: Uint8Array;     // 24-byte binary form
  unixMs: bigint;        // relative_ms + epochMs
  unixDate: Date;        // unixMs as a JS Date
  relativeMs: bigint;    // 48-bit ms field
  fraction4096: number;  // 12-bit sub-ms fraction
  approxSubMs: number;   // fraction4096 / 4096, in ms
  counter: number;       // 20-bit counter
  randomHex: string;     // 14-byte tail as lower-case hex
}

Errors

class OrionIdError extends Error {
  code:
    | 'INVALID_LENGTH'
    | 'INVALID_CHARACTER'
    | 'INVALID_OPTION'
    | 'TIMESTAMP_OVERFLOW'
    | 'COUNTER_OVERFLOW'
    | 'RANDOM_FAILURE';
}

Every error thrown by the package extends OrionIdError. Use error.code for programmatic handling rather than parsing messages.

Browser usage

The package is browser-safe and requires no bundler-specific shims. The single runtime requirement is globalThis.crypto.getRandomValues, which is available in every modern browser, Deno, and Bun.

Performance

A single OrionIdGenerator saturates a modern CPU core at roughly 5–10 M IDs/second depending on the runtime. The dominant cost is Uint8Array allocation; reuse a generator across requests for the highest throughput. Numbers are indicative — run the bundled benchmark on your target hardware:

npm run bench

Status

ORION-192 is at spec v0 — implementation-complete, cross-language conformant, and wire-frozen. See the project status for the full stability statement.

Specification & related

License

Licensed under the MIT License — Copyright © 2026 Lam Hieu and contributors.