Skip to content

@smonn/ids

Public-facing branded IDs for TypeScript apps. Type-safe, sortable, and codec-pluggable.

Each ID looks like usr_06f80z92d2dbsqqg28t5cy4tqg: a three-letter brand, an underscore, then 26 Crockford base32 characters of payload.

Branded & type-safe

Id<"usr"> and Id<"org"> are nominally distinct — the type system catches a UserId passed where an OrgId was needed.

Sortable by time

The payload leads with a 48-bit millisecond timestamp, so ORDER BY id sorts by creation time. No separate created_at column needed.

Six codecs

Plaintext, newest-first, signed (tamper-evident), opaque (encrypted), wrapped-key, and digest (one-way keyed digest) — all sharing one wire shape.

Run it live

The playground runs the real library in your browser — generate, verify, unwrap, and inspect every codec.