Splitwise System Design — Visual Journey
Watch three friends and a shared dinner bill evolve into a production expense-ledger architecture — split math, debt simplification, idempotency, optimistic concurrency, transactional outboxes, balance projections, multi-currency isolation and payment settlement.
30 scenes · 30 narrated steps · interactive, self-paced
Splitwise — Shared Expense Manager
Splitwise — Shared Expense Manager
A long-form engineering design session — watch split math, ledger invariants, debt simplification, idempotency and concurrency evolve into a production expense-sharing architecture.
Maximize to view synchronized narration and navigate between explanation steps.
What You Should Understand Now
- An expense is not a payment — it records who paid and who benefited; a balance is only the arithmetic consequence of recorded expenses and settlements, never a thing moved directly.
- Every split must sum to the expense total exactly, in integer minor currency units — never floating point — with a deterministic, documented rule for any rounding remainder.
- Net balance = amount paid on behalf of others minus allocated personal share, adjusted by settlements; within one closed currency ledger, every participant's net balance always sums to zero.
- Debt simplification preserves everyone's net position but not the original pairwise provenance — it is a suggestion that reduces transaction count, never an automatic transfer or cancellation of obligations.
- Corrections and deletes never silently overwrite financial history — they are reversal-plus-replacement events, so the full audit trail is always reconstructable.
- A transactional outbox plus idempotent, event-ID-keyed consumers make at-least-once event delivery safe — the immutable ledger stays the single source of truth, with balance projections as fast, rebuildable, honestly-versioned views of it.
Concepts in This Visual
Expenses, Splits & Net BalanceEqual / Exact / Percentage / Share SplitsDebt SimplificationImmutable Ledger & Zero-Sum InvariantIdempotent Expense CreationOptimistic Concurrency ControlVersioned Corrections & ReversalsTransactional Outbox & Event BusBalance Projections & Read-Model StalenessMulti-Currency Isolation & Payment Settlement
Go Deeper
Complete Design
The full written walkthrough — problem, requirements, scale estimation, data model, APIs, monolith baseline, split/ledger math, debt simplification, evolved architecture, and the final production recap.
Architecture Deep Dive
Precise ledger math, every split algorithm, the immutable ledger representation, concurrency control, idempotency, the transactional outbox, balance projections, settlement lifecycle and multi-currency handling.
Trade-offs & Decisions
Pairwise vs net-position models, greedy vs optimal simplification, synchronous vs asynchronous balance updates, optimistic vs pessimistic locking, and more — with a recommended baseline and when it changes.
Failure & Scale Scenarios
What actually breaks in production — duplicate writes, concurrent edits, projection drift, outbox relay crashes, payment webhook loss, hot groups, and disaster recovery.
Interview Perspective
How to structure the interview, a large bank of questions with reasoned answers including Staff-level follow-ups, whiteboard exercises, and a quick-reference revision sheet.