Skip to main content

uniku

TypeScript ID generator for every JavaScript runtime

/uˈniːku/ — Maltese for “unique”

Why uniku?

Universal Runtime Support

Works everywhere: Node.js, Deno, Bun, Cloudflare Workers, Vercel Edge, and browsers using Web Crypto API

Six ID Formats

UUID v4/v7, ULID, CUID2, Nanoid, and KSUID — all in one library

Tree-Shakeable

Separate entry points mean you only bundle what you import. No barrel exports.

Byte-Level Access

Convert between ID strings and Uint8Array with built-in toBytes() and fromBytes()

Time-Ordered IDs

UUID v7, ULID, and KSUID provide sortable identifiers with monotonic sequencing

Modern Standards

Includes UUID v7 (RFC 9562) for time-ordered, sortable identifiers

Quick Example

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

const id = uuidv7()
// => "018e5e5c-7c8a-7000-8000-000000000000"

// Time-ordered: IDs sort by creation time
const [first, second, third] = [uuidv7(), uuidv7(), uuidv7()]
console.log(first < second && second < third) // true

Performance

Benchmarks comparing uniku string ID generation with equivalent npm packages:
Generatoruniku vs npm
ULID85× faster
CUID28× faster
KSUID1.5× faster
UUID v71.1× faster
Nanoid~comparable speed

Choose Your ID Generator

UUID v4

Random UUID with maximum compatibility

UUID v7

Time-ordered UUID for database keys

ULID

Sortable, 26-character identifier

CUID2

Secure, collision-resistant IDs

Nanoid

Compact, URL-friendly IDs

KSUID

K-Sortable with high entropy

Get Started

Installation

Install uniku using your favorite package manager

Quickstart

Generate your first ID in under 2 minutes

CLI Tool

Command-line tool for generating and validating IDs

API Reference

Complete API documentation for all generators

Build docs developers (and LLMs) love