What is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit number represented as 32 hexadecimal digits grouped as 8-4-4-4-12 with hyphens. The format is standardized in RFC 4122 and used wherever systems need identifiers without a central allocation authority.
Unlike auto-increment integers, UUIDs can be generated independently on any machine without coordination. That makes them ideal for microservices, offline-first mobile apps, and client-side record creation.
UUID v4 Random Identifiers
Version 4 UUIDs set the version nibble to 4 and the variant bits to the RFC pattern, filling the remaining bits with random data. Roughly 5.3 × 10³⁶ possible v4 UUIDs exist — collision risk in any practical deployment is negligible.
Vertex Solutions generates v4 UUIDs using the browser's cryptographic random number generator when available, falling back to a compliant random template only in legacy environments.
Generating IDs for Development
Database seeds — Populate test tables with realistic primary keys without conflicting with production sequences.
API mocking — Return plausible id fields in stub responses during frontend development.
Correlation IDs — Assign a unique trace identifier to each request in distributed logging.
File naming — Create collision-resistant filenames for uploads and temporary artifacts.
Generate multiple UUIDs when bulk-inserting fixtures or stress-testing uniqueness constraints.
UUID vs Sequential IDs
| Approach | Pros | Cons | |----------|------|------| | UUID v4 | No coordination, opaque, merge-friendly | Larger storage, random insert patterns in B-trees | | Auto-increment | Compact, sequential, human-friendly | Requires central authority, exposes row counts |
Choose UUIDs when clients create records before syncing to a server, or when merging data from multiple sources. Choose integers when storage efficiency and sequential locality matter most.