Abstract Timeline Background

Don't Overwrite.
Record the History.

Event Sourcing is an architectural pattern where the state of your application is determined by a sequence of events, rather than just the current values.

Interactive Demo: The Event-Sourced Bank Account

In a traditional system (CRUD), a deposit simply updates the balance column. Here, we append an event. The balance is calculated by replaying history.

settings_remote Actions (Commands)

history_edu Event Store (The Ledger)
Append Only
inbox

No events recorded yet.

account_balance_wallet

Current State (Projection)

$0.00 No Account
Account ID: -
Owner: -
Status: Inactive
history

Time Travel Debugger

Drag the slider to replay history. The state above is derived only from events up to the selected point.

Genisis Events applied: 0 / 0

How It Works

Instead of saving the "Current State" (e.g., Balance: $500), we save the verb (the action) that happened.

  • 1

    Command

    User requests an action (e.g., "Deposit $100"). The system validates business rules here.

  • 2

    Event Store

    If valid, an immutable event (`MoneyDeposited`) is appended to the ledger. This is the write-side.

  • 3

    Projection (Read Model)

    To show the balance on screen, we replay events or update a cached view. This is the read-side.

Event Sourcing Architecture Diagram

Why use it in practice?

receipt_long

Perfect Audit Trails

In banking, healthcare, or legal systems, knowing who did what and when is mandatory. Event sourcing gives you this for free.

bug_report

Time-Travel Debugging

A user reports a bug that happened last Tuesday? Copy the production event stream to your local machine and replay it to the exact moment of failure.

analytics

Business Analytics

Want to know how many users withdrew money 5 minutes after depositing? With CRUD, that data is overwritten. With events, you can answer questions you haven't even asked yet.

CRUD vs. Event Sourcing

delete_forever

Traditional CRUD

When data changes, the old data is lost.

UPDATE accounts
SET balance = 150
WHERE id = 123;
// Previous balance of 100 is gone forever.
playlist_add

Event Sourcing

Data is never deleted, only appended.

INSERT INTO events
(type, amount, date)
VALUES ('DEPOSIT', 50, NOW());
// History includes 100 AND 50.