UUID Use Case

UUID Event ID

In event sourcing, events are the source of truth. A UUID event ID makes each immutable fact addressable and replayable.

Event-sourcedReplayablev7 for order

Generated locally with the Web Crypto API — nothing leaves your browser.

What Is UUID Event ID?

How to generate

  1. Mint a v7 UUID per emitted event.
  2. Append to the stream keyed by aggregate.
  3. Use the id to skip duplicates on replay.

Use Cases

Code Examples

JavaScript
import { v7 as uuidv7 } from 'uuid';
const id = uuidv7(); // time-ordered
Python
import uuid
id = uuid.uuid7()  # RFC 9562 time-ordered

Frequently Asked Questions

v4 or v7 for events?
v7 if you want time-ordering for free (great for replay); v4 if order comes from a separate sequence.
Can I use the event ID as a key?
Yes — it is unique per event, ideal as the stream row's primary key.

Related tools