Sangkan · Building the Source
Wiji — time-ordered identifiers
ꦮꦶꦗꦶ
128-bit identifier with microsecond timestamp, monotonic sequence, and multi-format output (Base32 26-char, 16-byte binary, uuid-like, hex). Built for tidy ordering in databases and event streams.
Packages
128-bit layout
Sortable by raw 16-byte comparison and by Crockford Base32 string. Version nibble separates future formats.
Timestamp-first
56-bit microsecond timestamp (big-endian) for natural time order.
Monotonic generator
16-bit sequence counter for bursts inside the same microsecond.
Multi-format
Base32 (26), binary, uuid-like, and hex views of the same 16 bytes.
When Wiji fits
- Primary keys and event IDs where time locality helps indexing and debugging.
- Streams and logs where IDs must sort without decoding (lexical Base32 or raw bytes).
- Systems that want one binary form and multiple string appearances (e.g. ULID-style text + UUID wire).
Quickstart (JS/TS)
npm install @sangkan-dev/wiji
import wiji from '@sangkan-dev/wiji';
const id = wiji(); // Base32 (26)
const bin = wiji.binary(); // Uint8Array(16)
const p = wiji.parse(id); // timestamp_us (bigint), sequence, version, random