Globally Unique ID Generator is a Go library for generating globally unique identifiers that are compact, sortable, and safe to use directly in server-side code. It uses a MongoDB ObjectID-inspired structure with a timestamp, machine identifier, process identifier, and counter. The binary form is 12 bytes, while the string form uses lowercase base32hex encoding to create a 20-character URL-safe representation. This makes xid shorter than standard UUID strings while preserving chronological sortability. It does not require a central generator server or explicit machine and data-center configuration, which makes it convenient for distributed web services. It is well suited for database records, API resources, logs, events, and other systems that need practical unique IDs without the length and randomness tradeoffs of UUIDs.
Features
- Globally unique ID generation
- Compact 20-character string format
- Sortable identifier structure
- MongoDB ObjectID-compatible binary size
- No central generator required
- Go server-side library implementation