Event Sourcing Pattern: How It Works and When to Use It
Event sourcing stores every change as an event instead of overwriting state. Learn how it works, how it differs from CQRS, how to version events and when it pays off.

Event sourcing is a way of storing data in which you keep every change as an immutable event and work out the current state by replaying those events, instead of overwriting a row. It earns its place where history is part of the product: ledgers, bookings, approvals, signed documents. It is a poor fit for simple record-keeping screens. This guide explains how the pattern works, how it relates to CQRS, how to version events safely and how to decide whether your system needs it.
TL;DR
- Event sourcing records each change ("invoice approved", "document signed") as an append-only event, and rebuilds current state by replaying the events.
- You gain a complete audit trail, the ability to reconstruct any past state and flexible read models. You pay with eventual consistency, permanent event versioning and replay cost.
- CQRS and event sourcing are separate patterns that fit together well: events from the write side feed the read models.
- Apply it to the parts of a system where history matters, not to the whole platform.
- Version events from day one: add optional fields, never change a field's meaning, and publish a new event type for breaking changes.
Table of Contents
- What the event sourcing pattern is
- How events are stored and replayed
- Event sourcing versus a conventional database
- Event sourcing and CQRS
- When event sourcing fits
- Design challenges to plan for
- Event versioning: the part most teams underestimate
- A sensible adoption path
- Our perspective
- Building it with LogicBranch
- FAQ
- Sources
What the event sourcing pattern is
Most business software stores the latest state. A customer record has an address; when it changes, the old address is overwritten. Event sourcing flips this. As Martin Fowler describes it, every change to application state is captured as an event object, and the events are stored in the order they were applied. Past states can be rebuilt by replaying the log.
Microsoft's Azure Architecture Center puts it as storing the full series of actions taken on an object in an append-only store, which becomes the system of record, rather than only the current state in a relational database.
A plain-language illustration: a client's trust account in a professional services firm. A conventional table holds one number, the balance. An event-sourced version holds AccountOpened, DepositReceived, FeeCharged, RefundIssued. The balance is the result of applying them in order. Nothing is ever edited, so you can answer "what did this balance look like on 30 June?" by replaying events up to that date.

How events are stored and replayed
Three ideas carry the pattern.
Event streams. Each entity, such as an order, a contract or an account, has its own stream of events. The Azure guidance calls the process of replaying a stream to get current state rehydration.
Events are facts. An event describes something that happened, in the past tense, with the data needed to understand it. Good events capture intent ("delivery address corrected by customer") rather than just the changed field, which is a large part of the audit value.
Projections. Replaying a long stream on every read is expensive, so applications keep materialized views: read-only projections built from the events and tuned for the screens and reports that need them. The Azure guidance notes that this is typical in event-sourced systems.
Snapshots keep replay fast
A snapshot is a saved copy of an entity's state at a point in the stream, so reconstruction only replays events since that snapshot. The microservices.io pattern description covers this, and Confluent's introduction lists growing event logs, replay complexity and snapshot management among the costs to plan for. Treat a snapshot as a cache you can delete and rebuild, never as the source of truth. Teams commonly snapshot every few hundred or few thousand events; the right number depends on how long your streams get and how quickly they must load.
Event sourcing versus a conventional database
A conventional create-read-update-delete (CRUD) design reads a row, modifies it and writes it back, often with row-level locking. That causes write contention under load and loses history unless you bolt on audit tables. Microsoft's guidance lists what event sourcing gives you instead: immutability, an audit trail, decoupled producers and consumers, optimistic concurrency and flexible read models.
| Concern | Conventional CRUD | Event sourcing |
|---|---|---|
| What is stored | Latest state | Every change, in order |
| History | Separate audit tables, if built | Built in, by design |
| Past state at a date | Hard to reconstruct | Replay to that point |
| Reads | Direct, immediately consistent | Via projections, eventually consistent |
| Schema change | Migrate tables | Version events permanently |
| Best for | Reference data, simple forms | Ledgers, approvals, lifecycles |
The audit angle matters in Australia. The ATO says you generally need to keep most business records for five years, and other obligations can be longer depending on your industry. We cover how to think about retention periods in our guide to audit trail requirements in Australia. An append-only event store gives you a defensible record of who did what and when without a second system.
Event sourcing and CQRS
Command Query Responsibility Segregation (CQRS) separates the model that handles writes (commands) from the models that serve reads (queries). The two patterns are independent, but they pair naturally: the write side emits events, and each read model is a projection that subscribes to them. That is why searches for one so often turn up the other.
You can use CQRS without event sourcing, for example with replicas or a search index fed by change data capture. You can technically event-source without CQRS, but reading directly from event streams is rarely practical, so most teams end up with projections anyway.
A useful rule: reach for CQRS when reads and writes have very different shapes or scaling needs, or when you need several views of the same data. Add event sourcing when the history itself has value.
When event sourcing fits
Microsoft's guidance is specific about when to use it: when you need to capture intent, avoid conflicting updates, replay or roll back state, decouple data input from downstream tasks, or change read-model formats freely and can accept eventual consistency. In practice that means:
- Financial and accounting workflows, where every adjustment must be traceable.
- Document and e-signature flows, where a document moves through drafted, sent, viewed, signed and countersigned states and each transition must be provable.
- Order and booking lifecycles in e-commerce, where support agents and AI assistants need the full story of what happened to an order.
- Approvals in legal, real estate and healthcare administration, where the question "who approved this, and on what version?" has to be answerable years later.
- Multi-tenant SaaS products whose customers demand an activity timeline as a feature.
The same guidance says to avoid it for straightforward CRUD, short-lived prototypes, systems needing real-time consistency, static reference data, or teams new to the approach. It also advises applying the pattern selectively, such as to a payment ledger, rather than system-wide. For a startup, that means you can ship an MVP on a simple model and event-source only the one workflow where history is the value. For an SMB, it means a booking calendar may not need it while the invoicing and job-approval trail does.
Design challenges to plan for
Eventual consistency
Projections lag the event store. Usually that is milliseconds, but under load it can stretch. Decide up front which screens can tolerate stale data and which cannot. A production account from one engineering team describes a 30-second projection lag that led to a customer being charged for a cancelled order, fixed by sending money-related reads through a synchronous path. The lesson is general: anything that moves money or commits a legal position should read from a source that is up to date.
Reliable publishing
Writing an event and notifying other systems must not drift apart. If you save the event but the message to downstream services is lost, your systems disagree. The outbox pattern solves this by recording the message in the same transaction as the change and publishing it afterwards.
Rebuild time
Rebuilding a projection means reprocessing the log. Plan for it: run rebuilds on a dedicated read replica, snapshot long streams, and make projections idempotent so a replay produces the same result every time.
Concurrency
Optimistic concurrency works well within a single entity's stream: a write fails if the stream has moved on since you read it. Conflicts that span several entities need explicit design, such as a process that coordinates them.
Event versioning: the part most teams underestimate
Because events are never edited, an event written in 2026 must still be readable by code written years later. Microsoft's guidance flags permanent schema versioning as one of the main costs of the pattern. A practical set of rules:
- Add, don't change. New fields are optional and have a default. A backward-compatible change like this needs no migration.
- Never change the meaning of an existing field. If "amount" was GST-inclusive, it stays that way forever.
- Never reuse a field name or identifier, even after you stop using it.
- Version the event type for breaking changes. Publish
OrderSubmitted.v2alongsidev1during a migration window rather than rewriting history. - Upcast on read. A small translation step converts old events to the newest shape as they are loaded, so business code only deals with the current version.
- Keep events small and factual. The less an event contains, the less there is to break.
- Use a schema registry with transitive compatibility where many consumers read long-retained events, since a replay can reach an event written under any earlier version.
The cheapest time to adopt these habits is before the first event is stored. Retrofitting them across years of data is where the cost of the pattern shows up.
A sensible adoption path
- Identify the single workflow where history is the product: payments, approvals, signing, order lifecycle.
- Model its events with the business, using the vocabulary people already use ("quote accepted", not "row updated").
- Build one event stream per entity, with optimistic concurrency.
- Build projections for each screen or report, and mark which reads must be strongly consistent.
- Add the outbox for downstream integration and snapshots once streams grow.
- Write the versioning rules into your engineering standards before launch.
- Leave the rest of the platform conventional until a second workflow earns the same treatment.
Our perspective
We treat event sourcing as an engineering decision, not a badge. The question we ask first is whether the business needs to prove what happened, when and by whom. If the answer is yes, as it is in document and e-signature workflows like those behind our product ksign.co, the pattern pays for itself. If the answer is no, a well-built conventional model is the right call.
What we have found matters most is applying the pattern to one bounded part of the domain, with clean modular boundaries, rather than spreading it across everything. That keeps the audit-grade core strict and the rest of the system simple. It fits how we work: strict software engineering standards, zero-trust security and domain-driven architecture, built for longevity rather than complexity for its own sake.
The same discipline applies to AI. Agents that act on a customer's behalf are far easier to trust when every action they take lands in an immutable log you can read back.
Josh
Building it with LogicBranch
If you are an enterprise team, an Australian business digitising a workflow, a startup shaping an MVP or an agency that wants agentic AI capability under your own brand, the hard part is not the idea of events. It is the modelling, the versioning discipline and the operations around projections. We build custom software, AI agent solutions, system integration and cloud architecture for exactly these teams, and event-sourced cores are one of the designs we deliver when the domain calls for it.

See our custom software and AI development services or start from the LogicBranch home page to talk about your workflow.
FAQ
Is event sourcing the same as CQRS?
No. CQRS separates the write model from the read models, while event sourcing stores changes as a sequence of events. They work well together because events from the write side can feed read-model projections, but each can be used alone.
Does event sourcing replace my database?
Not usually. Events need a durable, append-only store, which can be a relational database table or a dedicated event store. Projections are often kept in ordinary databases or search indexes tuned for reading.
How do I change an event after it has been stored?
You don't edit it. Add optional fields for compatible changes, or publish a new version of the event type for breaking ones, and upcast old events to the new shape when they are loaded. This keeps the history intact.
Do small businesses need event sourcing?
Only for the part of the system where history has real value, such as invoicing, approvals or signed documents. Microsoft advises applying the pattern selectively, so most of a small business tool can stay conventional.
Sources
- Event Sourcing pattern, Azure Architecture Center
- Event Sourcing, Martin Fowler
- Pattern: Event sourcing, microservices.io
- Event Sourcing: An Introduction, Confluent
- Overview of record-keeping rules for business, ATO
- Event Sourcing in Production: Three Years of Append-Only Storage
Recommended

B2B SaaS Pricing Models: How to Choose and Build the Right One
Flat-rate, per-user, tiered, usage-based and hybrid B2B SaaS pricing models compared, with Australian examples in AUD, GST notes and how pricing shapes your build.

Salesforce Integration Patterns: Choosing the Right One
Six core Salesforce integration patterns explained: when to use each, how Platform Events fit, and the design rules that keep integrations reliable at scale.