About UUID generation
RFC 4122 version 4 identifiers
Version 4 UUIDs are random128-bit identifiers formatted as hyphenated hexadecimal groups. They are popular for primary keys, correlation IDs, and opaque request tokens because collision risk is negligible at typical application scales.
Generating identifiers with a cryptographically strong random source matters more than the exact string layout; weak randomness defeats the purpose of a UUID.
When UUIDs are the wrong tool
Sequential numeric IDs can be simpler for human-facing URLs and small databases. UUIDs trade readability for decentralization: multiple services can mint IDs without a single coordinator.
If you need time-ordered identifiers at high throughput, research time-sortable alternatives and your database's indexing behavior before committing to a format.
Testing workflows
Use fresh UUIDs in automated tests to avoid collisions when suites run in parallel. Pair them with factories or fixtures so failures stay easy to reproduce.
Document whether your API accepts any UUID-shaped string or validates version and variant bits strictly.