global-identifier

Typed (type, payload) → short URL-safe identifiers, with TypeScript and Rust at exact parity.

graduatedLibrariesMIT
Overview
v3.0.0
TypeScript release
~40%
smaller than a JSON envelope
2
languages, interop-tested

A small library that solves an unglamorous problem well: encoding a (type, data) pair into a self-describing, compact, URL-safe string — usr_…, ord_… — and back, with compile-time type safety.

The TypeScript side gives you typed create(type, data) with branded nominal types, Zod-validated constructors, safe tryDecode, and a peekMetadata that reads the type without decoding the payload. The Rust crate is semantically identical, and the claim is enforced: fixtures are round-tripped across both implementations in CI.

Optional ULID strategy makes identifiers lexicographically time-sortable; payload codecs are pluggable (JSON default, CBOR/Protobuf-ready). No crypto in core, deliberately — bring your own signing if you need it.

Related projects