Skip to content

Event

Syntax

event <Name> {
<fieldName>: <TypeName>
...
}

Events represent facts that happened. They are immutable value objects produced by decide clauses and applied by evolve clauses.

Rules

  • Events are never constructed directly by application code.
  • Each field must reference a declared type.
  • Event names should use past tense (e.g., CartOpened, ItemAdded).

Schema Evolution (Planned)

event CartOpened @v1 {
cartId: CartId
customerId: CustomerId
}
event CartOpened @v2 {
cartId: CartId
customerId: CustomerId
openedAt: Timestamp
channel: Channel
}
upcast CartOpened @v1 -> @v2 {
openedAt = epoch
channel = Web
}

Version annotations use @v followed by an integer. The compiler verifies transitive completeness of upcast chains.