uniku
Reference

Entry points

Ten stable generator entry points behind one consistent, type-safe API.

uniku exposes ten ID generation modules. Each module exports a callable generator with attached helpers. The most common public API looks like this:

import { uuidv7 } from 'uniku/uuid/v7'

const id = uuidv7()
// e.g. '019f5732-0342-75f9-9efd-fc3c1f8da7fd'

uuidv7.isValid(id)
// true

const bytes = uuidv7.toBytes(id)
// Uint8Array(16)

uuidv7.fromBytes(bytes)
// the same value as `id`

uuidv7.timestamp(id)
// e.g. 1783874323266

uuidv7.NIL
// '00000000-0000-0000-0000-000000000000'

uuidv7.MAX
// 'ffffffff-ffff-ffff-ffff-ffffffffffff'

Binary modules can also write directly into a caller-owned buffer:

const destination = new Uint8Array(24)
const result = uuidv7(undefined, destination, 8)
// Uint8Array(24), with UUID bytes at offsets 8 through 23

result === destination
// true

How modules differ

ModulesPublic API
uuid/v7, ulid, ksuid, objectid, xidCallable, buffer write, toBytes(), fromBytes(), timestamp(), isValid(), NIL, MAX
uuid/v4Callable, buffer write, toBytes(), fromBytes(), isValid(), NIL, MAX
typeidPrefix-first callable, buffer write, toBytes(), fromBytes(), toUuid(), fromUuid(), timestamp(), prefix(), suffix(), isValid()
tsidbigint primary value, buffer write, toBytes(), fromBytes(), toString(), fromString(), timestamp(), isValid(), NIL, MAX
cuid/v2, nanoidCallable, isValid() only

This table is derived from the generated TypeScript API reference. Open a module's page for complete signatures, options, constants, and examples.

The package root is intentionally not exported, so import a generator or metadata module directly. Two metadata entry points round out the library:

ImportPurpose
uniku/errorsTyped, machine-readable input, parse, and buffer errors.
uniku/generatorsThe canonical ordered list of supported generator kinds.

Generator references

Read the reference for the module you use. Each Public API section is generated from the TypeScript signatures and JSDoc in packages/uniku/src, so it stays aligned with the library source.

On this page