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

@ivan_a_souza/solid-id

v0.0.12

Published

**SOLID ID** (Sortable, Ordered, Legible, Indexed, Distributed) is a unique identifier generator in TypeScript that produces compact, lexicographically ordered, and secure IDs for distributed use.

Downloads

411

Readme

SOLID ID

SOLID ID (Sortable, Ordered, Legible, Indexed, Distributed) is a unique identifier generator with the following features:

  • Sortable by time (embedded timestamp)
  • Highly secure (64 bits of random entropy)
  • Compact (22 Base62 characters)
  • Human-readable and friendly for databases and URLs
  • Built-in checksum for integrity validation

Ideal for distributed systems, tracking, APIs, databases, and more.


Installation

npm install @ivan_a_souza/solid-id

Usage

Basic

import { generateSolidId } from '@ivan_a_souza/solid-id';

const id = generateSolidId();
console.log(id); // e.g., '8Z2pKf21M9sRgXJEyhwVBQ'

Advanced

solid-id exports utilities for validation and parsing:

import { 
  generateSolidId, 
  validateSolidId, 
  getTimestampFromSolidId, 
  parseSolidId 
} from '@ivan_a_souza/solid-id';

// 1. Generate ID
const id = generateSolidId();

// 2. Validate ID (checks format and checksum)
if (validateSolidId(id)) {
  console.log('Valid and healthy ID!');
}

// 3. Extract Timestamp
try {
  const date = getTimestampFromSolidId(id);
  console.log(`Created at: ${date.toISOString()}`);
} catch (err) {
  console.error('Invalid ID');
}

// 4. Detailed Parsing (useful for debugging/logs)
const parsed = parseSolidId(id);
if (parsed.valid) {
  console.log(`Timestamp (ms): ${parsed.timestampMs}`);
  console.log(`Entropy (64-bit): ${parsed.entropy64}`);
} else {
  console.error(`Error: ${parsed.status}`); // e.g., INVALID_CHECKSUM
}

API

generateSolidId(options?)

Generates a 128-bit unique identifier encoded in Base62.

  • options.nowMs: (number) Custom timestamp (useful for testing).
  • options.rng64: (function) Custom entropy source.

validateSolidId(id)

Returns true if the ID is in the correct format and the checksum is valid.

getTimestampFromSolidId(id)

Returns a Date object extracted from the ID. Throws an error if the ID is invalid.

parseSolidId(id)

Returns a ParsedSolidId object with internal details:

  • valid: boolean
  • timestampMs: number (if valid)
  • entropy64: bigint (if valid)
  • status: 'OK' | 'INVALID_LENGTH' | 'INVALID_CHECKSUM' | ...

Features

| Field | Bits | Description | | --------- | ---- | ------------------------------------------------------- | | Timestamp | 48 | Time in milliseconds since 1985-05-17 | | Entropy | 64 | Random bits generated with crypto.getRandomValues | | Checksum | 16 | Integrity verification using the CRC-16-CCITT algorithm | | Total | 128 | Encoded in 22 Base62 characters |


Advantages

  • Zero external dependencies
  • Fast and secure
  • Works in both Node.js and modern browsers
  • URL-safe, database-friendly, JSON-compatible
  • Lexicographically sortable by time (ideal for DB indexes and logs)

Testing

Includes tests powered by Vitest:

npm run test

Tests cover:

  • Basic Generation: ID length (22 characters) and uniqueness.
  • Integrity: Built-in validation and CRC-16 checksum verification.
  • Ordering: Time-based lexicographical sortability.
  • Accuracy: High-precision Base62 encoding/decoding (round-trip).
  • Stress Tests: Proof of uniqueness for 1 million+ IDs generated within the same millisecond (run with STRESS_SOLID=1 npm run test).

License

MIT – Made with love by Ivan Augusto.