ULID

A fast, sortable, URL-safe unique identifier generator that beats UUIDs for time-ordered keys.

Library
npm
v3.0.2
3,442stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
45/100Fair
Development Activity4
Maintenance20
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture82
Code Quality78
Innovation87
Learning Curve85

ULID (Universally Unique Lexicographically Sortable Identifier) is a zero-dependency JavaScript/TypeScript library that generates 128-bit unique identifiers encoded as 26-character, case-insensitive, URL-safe strings using Crockford’s Base32. Unlike random UUIDs, ULIDs sort lexicographically by creation time, which keeps database indexes ordered and avoids the write-amplification and page-fragmentation problems that fully random primary keys cause in B-tree indexes.

The library exposes a small, ergonomic API: a single ulid() call for one-off IDs, a monotonicFactory() for strictly increasing IDs within the same millisecond, plus helpers to validate IDs, encode/decode the embedded timestamp, and convert between ULID and UUID representations. It ships as dual ESM/CommonJS builds with full TypeScript types, runs in Node.js, browsers, React Native, web workers, and edge runtimes, and includes a small CLI for generating IDs from the shell.

What You Get

  • ulid() — generate a single sortable, URL-safe ID with automatic PRNG detection (Web Crypto in browsers, Node’s crypto module server-side)
  • monotonicFactory() — a factory that guarantees strictly increasing IDs even when multiple calls happen within the same millisecond
  • isValid(), decodeTime(), encodeTime() — validate ULIDs and extract or encode their embedded timestamp
  • ulidToUUID() / uuidToULID() — lossless conversion between ULID and standard UUID string formats
  • A bundled CLI (npx ulid --count 15) for generating IDs from the command line, plus dual ESM/CJS builds with full TypeScript declarations for Node, browser, React Native, and edge runtimes

Common Use Cases

  • Primary keys for relational or document databases where insert order should match index order, avoiding the fragmentation caused by random UUID v4 keys
  • Distributed ID generation across services or edge functions without a central sequence generator or coordination service
  • Event and log record IDs where chronological sortability by ID alone (without a separate timestamp column) simplifies queries
  • Migrating existing UUID-keyed systems to a sortable scheme via the built-in ULID <-> UUID conversion helpers

Under The Hood

Architecture ULID’s implementation is a small set of tightly-scoped modules: constants.ts defines the Crockford Base32 alphabet and fixed byte lengths, crockford.ts implements bit-level Base32 encode/decode plus a base32 string-increment routine used for monotonic generation, ulid.ts composes these into the public ulid()/monotonicFactory()/decodeTime()/encodeTime()/isValid() functions and handles PRNG auto-detection across Node, browser, web-worker, and React Native globals, uuid.ts layers UUID string conversion on top of the same Crockford codec, and error.ts centralizes a typed ULIDError with a stable ULIDErrorCode enum used consistently across all failure paths. index.ts re-exports the public surface, and cli.ts is a thin argument-parsing wrapper around monotonicFactory() for the bundled CLI. The layering is clean and unidirectional: constants -> crockford codec -> ulid/uuid logic -> public API, with no circular dependencies.

Tech Stack The library is written in TypeScript with zero runtime dependencies, targeting Node 18+ and modern browsers. It builds dual ESM and CommonJS artifacts (plus a browser-specific bundle) via Rollup, generates .d.ts/.d.cts type declarations with tsc, and validates the resulting package exports with @arethetypeswrong/cli to catch ESM/CJS interop mistakes before publish — a level of build rigor uncommon in small utility libraries.

Code Quality The test suite (Vitest, under test/node/) exercises the core surface directly: ulid.spec.ts covers decodeTime, encodeTime, and monotonic-factory behavior across same-millisecond and cross-millisecond calls with a stubbed PRNG for determinism; crockford.spec.ts and uuid.spec.ts cover the Base32 codec and UUID conversion round-trips. Error handling is consistent and typed via ULIDError/ULIDErrorCode rather than generic thrown strings, and Prettier plus a test:format script enforce consistent style. Test coverage is solid for the core encode/decode/monotonic paths though thinner around CLI argument parsing and PRNG-detection edge cases.

API Design The public API is minimal and low-boilerplate: import { ulid } from "ulid"; ulid() is the entire integration for the common case, with JSDoc @example blocks on every exported function showing real input/output pairs. Naming is consistent (encodeTime/decodeTime, ulidToUUID/uuidToULID) and the monotonic-factory pattern keeps the stateful variant explicit and opt-in rather than defaulting to hidden global state.

Used by 10 apps in this directory

Python
68%
Other

Baserow

No Code Platforms · Databases

5,635

Open-source no-code platform to build databases, apps, automations, and AI agents — self-hosted or cloud, with full data ownership.

View details
89
Repo Health
84
Technical
68
Dependency
Built with
Python68%
JavaScript15%
Vue12%
Updated today
TypeScript
100%
MIT

Botpress

AI Assistants · AI Development · Customer Support

14,872

The open-source hub for building and deploying LLM-powered AI agents with TypeScript-first tooling, 40+ integrations, and a revolutionary code-execution agent framework.

View details
95
Repo Health
82
Technical
66
Dependency
Built with
TypeScript100%
Updated yesterday
TypeScript
97%
Apache 2.0

Cline

AI Code Assistants

66,453

An open-source AI coding agent that lives in your editor and terminal — reads and edits your codebase, runs commands, browses the web, and requires human approval for every action by default.

View details
90
Repo Health
74
Technical
67
Dependency
Built with
TypeScript97%
Updated today
TypeScript
99%
Apache 2.0

Colanode

Knowledge Management · Team Chat · Collaboration

5,018

Local-first, self-hosted workspace that combines real-time chat, Notion-style pages, and structured databases — all synced via CRDTs so you work offline without losing a keystroke.

View details
47
Repo Health
73
Technical
73
Dependency
Built with
TypeScript99%
Updated 4 months ago
Vue
50%
GPL 3.0

IT-Tools

Developer Tools

40,279

A unified collection of 88 web-based developer utilities — from JSON formatting to subnet calculation — all self-hostable, keyboard-searchable, and offline-ready.

View details
60
Repo Health
74
Technical
67
Dependency
Built with
Vue50%
TypeScript48%
Updated 3 days ago
TypeScript
98%
MIT

Kimi Code CLI

AI Code Assistants · AI Agents · Developer Tools

6,908

A single-binary, terminal-native coding agent that reads, edits, and runs code end to end, built by Moonshot AI for Kimi models but pluggable with Anthropic, OpenAI, and Google providers too.

View details
81
Repo Health
87
Technical
66
Dependency
Built with
TypeScript98%
Updated today
TypeScript
86%
MIT

medusa

Ecommerce

35,900

The most flexible open-source commerce platform — build B2C, B2B, and marketplace applications with modular, composable commerce primitives.

View details
94
Repo Health
87
Technical
65
Dependency
Built with
TypeScript86%
JavaScript14%
Updated today
TypeScript
53%
MIT

MentraOS

Developer Tools · AI Development

2,314

The open source operating system and SDK that lets developers build one app and run it across smart glasses from Even Realities, Vuzix, Mentra Live, and more.

View details
92
Repo Health
77
Technical
67
Dependency
Built with
TypeScript53%
Java19%
Updated today
TypeScript
76%
MIT

OpenCode

AI Code Assistants

198,979

A fully open-source AI coding agent built for the terminal, with a TUI, desktop app, web client, plugin system, and SDK — one of the most-starred AI coding agents on GitHub.

View details
89
Repo Health
76
Technical
68
Dependency
Built with
TypeScript76%
MDX21%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search