Logo
Logo

Events and Subjects

Events are immutable CloudEvents records organized in a hierarchical subject tree.

Events

An event is an immutable fact: something that happened at a specific moment. GenesisDB never updates or deletes an event, it only appends new ones. Every event is a CloudEvents 1.0 record:

json
{
  "source": "io.genesisdb.app",
  "subject": "/customer/42",
  "type": "io.genesisdb.app.customer-added",
  "specversion": "1.0",
  "id": "0199c0e0-5a3c-7d2e-9f10-3b4a5c6d7e8f",
  "time": "2026-10-24T10:00:00.123456789Z",
  "datacontenttype": "application/json",
  "predecessorhash": "6f1c…",
  "hash": "a9b1…",
  "hashversion": 3,
  "data": { "name": "Bruce Wayne" }
}

You send source, subject, type and data. GenesisDB assigns id, time, the hashes and the remaining attributes, and returns the stored events from the commit.

  • source identifies the producing system, typically a reverse DNS name.
  • type names what happened, for example io.genesisdb.app.customer-added.
  • data is a JSON object of up to about 64 KB.

Subjects

Subjects are paths. They organize events in a tree:

text
/customer
/customer/42
/customer/42/address
/customer/42/orders/7

Fetching /customer/42 returns the events of /customer/42 and of every subject below it, in commit order. Queries select direct children with UNDER and the whole subtree with DESCENDANTS. A subject with a single segment, such as /customer, gets a generated ID appended on commit, which is handy for new aggregates.

Do not put personal data into subjects, types or sources: they are immutable metadata and cannot be erased. Use reference payloads for that.

Order

Events are returned in commit order, the physical order of the log. Timestamps do not influence the order, so a clock correction never reorders a subject's history.