Skip to content

Cratis Chronicle event-sourcing concepts

Cratis Chronicle keeps application changes as events, then uses observers to turn those facts into queryable state or actions. A projection builds a view, a reducer computes state in application code, and a reactor performs work in response to a change. Use this overview to understand which part of your application belongs in each role.

For example, an order’s OrderPlaced and OrderShipped events share an event source, the identity that groups its history. A read model might show the order’s current status. That view is derived from the events; it is not a replacement for the history.

Start with how facts are recorded, then how you consume them. Read about consistency before using a derived value to make a business decision.

1. Events, event sources, and the event store

Read events, event sources, and the event store to decide what a fact should contain and which history it belongs to.

3. Consistency

Use consistency to decide when a query may return a view that has not yet processed the latest append, and what a decision can safely rely on.

To put the concepts into practice, follow Get started. Use the full topic table below when you need a particular definition.

Topic Description
Event What constitutes an event
Event Type What is an event type
Modeling events well How to design events that are clear today and still make sense in five years
Event Type Migrations How event schemas evolve without breaking existing events
Event Source What is an event source
Subject The identity an event is about — used to key compliance concerns
Event Store Where your events live — durably persisted in a database
Namespaces What are namespaces within an event store
Event Sequence What is an event sequence
Effect receipts Recover the first committed outcome of retryable occurrence work
Observer What is an observer
Projections, reducers, and reactors The three observer patterns side by side — deriving state from events vs causing side effects
Projection How a projection declaratively maps events onto a read model instance
Designing read models Specialize each read model for the query it serves, not for reuse
Deep dive: consistency Immediate vs eventual consistency, and how to choose
Constraints What are constraints
Event Metadata Tags Metadata tags attached to events
Tagging How to tag events for organization and filtering
Tagging Reactors How to use tags with reactors
Geospatial Types Built-in geospatial types for events and read models
When to use event sourcing Weigh the value of history against modeling and operational work
Glossary One definition for each core Chronicle term

A materialized read model is stored in a database and updated as its observer processes events. Reads are served from that stored view, which can lag behind a new append. A passive read model instead computes state on demand from the relevant event-source history. Projections and reducers can supply these views for queries, validation rules, command handlers, or aggregate roots in Arc.

Reading fresh state does not protect a later append from another writer. If a business rule must still hold when writers race, use a decision-consistent read, which guards the append against relevant changes, or a constraint enforced by the kernel. Follow those guides before treating a query result as a concurrency guarantee.