Entry points
Ten stable generator entry points behind one consistent, type-safe API.
uniku exposes ten ID generation strategies with a consistent callable-generator API and format-specific typed helpers. The package root is intentionally not exported, so import a generator or metadata module directly:
import { uuidv4 } from 'uniku/uuid/v4'
import { uuidv7 } from 'uniku/uuid/v7'
import { ulid } from 'uniku/ulid'
import { typeid } from 'uniku/typeid'
import { cuidv2 } from 'uniku/cuid/v2'
import { nanoid } from 'uniku/nanoid'
import { ksuid } from 'uniku/ksuid'
import { objectid } from 'uniku/objectid'
import { xid } from 'uniku/xid'
import { tsid } from 'uniku/tsid'Two metadata entry points round out the library:
| Import | Purpose |
|---|---|
uniku/errors | Typed, machine-readable input, parse, and buffer errors. |
uniku/generators | The canonical ordered list of supported generator kinds. |
Every generator exposes its own methods, such as isValid, toBytes, fromBytes, or a format-specific timestamp accessor where applicable.
Generator references
Read the reference for the strategy you use. The public method sections are generated from the TypeScript signatures and JSDoc in packages/uniku/src, so they stay aligned with the library source.
UUID v4
Random, standards-compatible UUIDs.
UUID v7
Time-ordered UUIDs for primary keys.
ULID
Sortable, URL-safe identifiers.
TypeID
UUID v7 values with readable type prefixes.
CUID v2
Non-sequential identifiers that resist enumeration.
Nanoid
Compact URL-safe identifiers.
KSUID
High-entropy, time-ordered identifiers.
ObjectID
MongoDB-compatible identifiers.
XID
Compact identifiers compatible with rs/xid.
TSID
Time-sorted bigint identifiers.
Errors
Typed errors and the generator list.