Skip to content

ID Strategy

Zeptoz supports:

  • int
  • uuidv4
  • uuidv7
  • ulid
  • nanoid

Set strategy on collection create

bash
zeptoz collection create Task title:string --id-strategy uuidv7

Behavior

  • int: database auto-increment.
  • uuidv4, uuidv7, ulid, nanoid: generated by runtime on insert.
  • Record path ID validation follows collection strategy.

Recommendation: ULID or UUID?

Default recommendation: uuidv7.

  • Choose uuidv7 when you want standards-based UUIDs with good time ordering.
  • Choose ulid when you want shorter, URL-friendly IDs with lexicographic time ordering.

If your team already standardizes on UUIDs, use uuidv7.

Examples

StrategyExample ID
int42
uuidv4550e8400-e29b-41d4-a716-446655440000
uuidv7018f0f3a-7b6c-7f6d-b1de-7c3f6f2b5f21
ulid01J4Z5K6Q7R8S9T0UV1W2X3Y4Z
nanoidV1StGXR8_Z5jdHi6B-myT

Pros and cons

StrategyProsCons
intSmall, simple, fast indexingNot globally unique, easier to enumerate
uuidv4Standard and highly uniqueRandom distribution, weak natural ordering
uuidv7Standard UUID + time orderedLonger than ULID/NanoID
ulidShorter, readable, sortableNot UUID format
nanoidVery compact and URL-friendlyNot time ordered by default