TypeID — screenshot of github.com

TypeID

TypeID is a robust, type-safe UUIDv7 extension. It offers K-sortability and embedded type prefixes, making it a superior alternative to standard UUIDs for database primary keys and overall system clarity.

Visit github.com →

Questions & Answers

What is TypeID?
TypeID is a modern, type-safe, and K-sortable globally unique identifier. It extends the upcoming UUIDv7 standard by adding a descriptive type prefix, similar to identifiers used by Stripe.
Who should use TypeIDs?
TypeIDs are for developers and organizations who need globally unique identifiers with improved type safety, better debugging capabilities, and K-sortability for efficient database indexing and locality.
How do TypeIDs improve upon standard UUIDs or other alternatives?
TypeIDs are type-safe due to their embedded prefixes, preventing accidental misuse across different entity types. Unlike UUIDv4, they are K-sortable, which provides better database locality, and their modified base32 encoding is more compact and URL-safe than traditional hex UUIDs.
When is it beneficial to use TypeIDs in a project?
Use TypeIDs when you require identifiers that clearly indicate their entity type for easier debugging and code clarity. They are particularly beneficial as primary keys in databases where K-sortability can improve performance and data locality.
What is the structure of a TypeID?
A TypeID consists of a lowercase snake_case ASCII type prefix, an underscore separator, and a 128-bit UUIDv7 encoded as a 26-character string using a modified base32 encoding. For example, user_2x4y6z8a0b1c2d3e4f5g6h7j8k.