
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
Ten ID strategies behind one consistent, type-safe API. The fastest implementation of each in our current CI benchmark.
uniku /uˈniːku/: Maltese for "unique"
Documentation · Getting started · Choosing an ID · API reference · CLI
import { uuidv7 } from 'uniku/uuid/v7'
const id = uuidv7()
// => "018e5e5c-7c8a-7000-8000-000000000000"
uniku?globalThis.crypto.@noble/hashes).npm install uniku
The getting-started guide also covers pnpm, Bun, and Deno.
Every generator has its own entry point and keeps related operations on the generator function:
import { uuidv7 } from 'uniku/uuid/v7'
const id = uuidv7()
const bytes = uuidv7.toBytes(id)
const restored = uuidv7.fromBytes(bytes)
if (uuidv7.isValid(restored)) {
console.log(uuidv7.timestamp(restored))
}
There are no barrel exports:
import { uuidv4 } from 'uniku/uuid/v4'
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'
| Situation | Start with | Why |
|---|---|---|
| Database primary keys | UUID v7 or ULID | Time-ordered values improve index locality |
| Public API resources | TypeID | UUID v7 with a readable, domain-specific prefix |
| Short URLs and invite codes | Nanoid | Compact and URL-safe |
| Values that should resist enumeration | CUID v2 | Non-sequential and secure |
MongoDB _id compatibility | ObjectID | Matches MongoDB's 12-byte ObjectID format |
| Go rs/xid compatibility | XID | Matches rs/xid's text and binary representation |
Native BIGINT storage | TSID | A sortable 64-bit integer rather than a UUID-shaped string |
| Broad standards compatibility | UUID v4 | The conventional random UUID format |
The choosing guide covers ordering, timestamp leakage, storage boundaries, and format-specific trade-offs.
uuid, nanoid, ulid, CUID2, KSUID, BSON, TSID, or XID librariesuniku@1.0.0@uniku/cli generates, validates, and inspects IDs from a terminal or shell pipeline. Install the current standalone binary:
curl -fsSL https://raw.githubusercontent.com/jkomyno/uniku/main/install.sh | sh
uniku uuid -v 7
uniku validate 018e5e5c-7c8a-7000-8000-000000000000
uniku inspect 018e5e5c-7c8a-7000-8000-000000000000
See the CLI documentation for package-manager installs and the complete command reference.
See CONTRIBUTING.md for the development workflow, tests, benchmarks, and preview releases.
MIT © Alberto Schiabel
FAQs
Minimal, tree-shakeable unique ID generators for every JavaScript runtime
The npm package uniku receives a total of 11,191 weekly downloads. As such, uniku popularity was classified as popular.
We found that uniku demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.