Fintech Lab
Lesson 81Engineering deeperAdvanced
Event sourcing vs CQRS for the ledger
Your journal IS an event log. Don't fight that fact.

A double-entry ledger is naturally an EVENT-SOURCED system: every change is recorded as an immutable journal entry; the current state (wallet balance, account totals) is a PROJECTION derived from the entries. CQRS (Command Query Responsibility Segregation) takes the next step: separate the WRITE path (post entries, validate balance, enforce idempotency) from the READ path (precomputed projections like wallet.balance, statement, trial balance). This lesson posts an entry that updates BOTH the event log (journal_line) AND the projection (wallet.balance, materialised summary row), and shows why splitting them into write/read responsibilities scales better than trying to query the journal directly on every read.

Fintech Lab is a free, interactive lab for fintech engineers. Real ledger, your own sandbox, engineering patterns from production. See all 85 lessons.

Search lessons

Type to find any of the 85 lessons. Press Enter to open.