Volume 12 · Chapter 4 — Principal Software Architect Interview Mastery & Enterprise System Design Handbook
Banking System Design Case Studies
4.1 Introduction
Banking is the canonical domain for architecture interviews because it forces every hard trade-off at once: strict correctness for money, high availability, complete auditability, regulatory compliance, and scale. This chapter works through the design of a core banking platform as a case study, demonstrating how the framework produces concrete decisions - and how each decision is a defensible trade-off against the banking-specific requirements.
4.2 Requirements and the Core Constraint
The defining requirement is that money must be correct: no double-spend, no lost transaction, and a complete audit trail. This immediately prioritizes consistency and durability over raw availability for the ledger, and auditability drives toward event sourcing. Around that core, reads (balances, statements) are high-volume and can tolerate slight staleness, so they scale differently.
4.3 Core Banking Architecture
flowchart TB
Ch["Customer channels (web/mobile)"] --> GW["API Gateway + BFF\n(auth, rate limit)"]
GW --> Acc["Accounts Service"]
GW --> Pay["Payments Service"]
Pay --> Ledger[("Event-sourced Ledger\n(strong consistency)")]
Ledger -- "events (outbox)" --> Bus["Event Broker"]
Bus --> Proj["Projections"]
Proj --> Read[("Read models: balance, statement\n(eventually consistent)")]
Bus --> Fraud["Fraud Service"]
Bus --> Notif["Notification Service"]
GW --> Read 4.4 Transaction Processing: Correctness First
Transaction processing is where correctness is enforced. The account aggregate validates funds rules atomically within its consistency boundary; every operation is idempotent (keyed by a transaction id) so retries and at-least-once delivery cannot double-post; and every change is an immutable event, giving the audit trail. A transfer spanning two accounts, which cannot be one ACID transaction across services, runs as a saga with compensation.
public async Task Transfer(TransferCommand cmd, CancellationToken ct)
{
// Idempotency: a repeated command (retry, duplicate) is a no-op.
if (await _processed.SeenAsync(cmd.TransferId, ct)) return;
var from = await _accounts.GetAsync(cmd.From, ct);
from.Withdraw(cmd.Amount); // aggregate enforces "no overdraft" atomically
await _uow.SaveChangesAsync(ct); // append events + outbox in one transaction
await _processed.MarkAsync(cmd.TransferId, ct);
// Credit leg proceeds via saga event; compensation refunds on failure.
}
4.5 Fraud, Compliance, and Availability
Fraud detection consumes the transaction event stream for real-time risk scoring (rules plus ML) without slowing the payment path. Compliance is served by the immutable event log, comprehensive audit logging, data classification, and access controls. High availability comes from zone redundancy, a paired DR region with defined RTO/RPO, database replication, and automated failover - because a bank being down is itself a serious failure.
How would you design a highly available, correct banking platform?
I start from the defining requirement - money must be correct, with no double-spend, no lost transaction, and a full audit trail - which prioritizes consistency, durability, and auditability for the core, while high read volume can scale separately. So I split the system: a strongly consistent, event-sourced ledger is the write core (event sourcing gives the immutable audit trail regulators require and enables temporal queries), where command handlers enforce funds rules inside small aggregates atomically, every operation is idempotent keyed by transaction id so retries and at-least-once delivery never double-post, and events publish reliably via the transactional outbox. Cross-account transfers, which cannot be a single ACID transaction across services, run as sagas with compensating actions. The read side - balances, statements, dashboards - is served by denormalized, eventually consistent read models built by projections from the ledger’s events, scaled independently with replicas and caching, with the UX designed around the brief read-after-write gap. Fraud detection consumes the event stream for real-time scoring without slowing the payment path. For availability I deploy zone-redundant with a paired DR region and tested failover meeting a strict RTO/RPO, since a bank being down is a serious failure, and I harden every call with timeouts, retries, circuit breakers, and bulkheads. Security is Zero Trust - strong identity, least privilege, encryption in transit and at rest, vault-managed secrets - and everything is auditable and observable end to end. Throughout I name the trade-off: I chose strong consistency for the ledger, accepting reduced availability under partition, because a wrong balance is unacceptable, while accepting eventual consistency on reads for scale. The result is correctness and auditability where money moves, scalable availability where users read - a concrete synthesis driven by the banking requirements.
Why event-source the ledger rather than store current balances, and what are the downsides?
I event-source the ledger because banking’s requirements align almost perfectly with what event sourcing provides: an immutable, append-only log of every debit and credit is a perfect, tamper-evident audit trail - exactly what regulators and auditors demand - and it enables temporal queries (“what was this balance at midnight on this date?”) that a current-state store cannot answer, plus the ability to rebuild any read model (a new report, a corrected projection) by replaying history without a schema migration. It also naturally records intent and causality, which is invaluable for dispute resolution and forensic analysis in finance. Storing only the current balance would throw away the history that is itself a core deliverable in this domain. The downsides are real and I’d acknowledge them: events are immutable and live forever, so I must handle schema versioning with upcasters or tolerant readers; storage grows unbounded and needs snapshots to keep rehydration fast and archiving to manage size; the read side is eventually consistent with the write side, so balances shown to users may lag a moment; debugging shifts from inspecting a row to replaying a stream, requiring different tooling and team maturity. Because of this cost I reserve full event sourcing for the subdomains where its audit and temporal power genuinely pay off - the ledger and money movement - and use simpler persistence elsewhere in the platform. In an interview the strong move is to justify event sourcing specifically by the banking requirements (audit, temporal, replay) rather than as a default, and to name its costs honestly, showing I’m choosing it deliberately for this context, not applying it reflexively.
How do you handle a money transfer across two account services that cannot share a transaction?
Since no ACID transaction can span the two services, I use a saga: the transfer becomes a sequence of local transactions coordinated by events, with compensating actions to undo prior steps if a later one fails. Concretely, the debit on the source account is one local transaction that, on commit, publishes a “funds withdrawn” event via the transactional outbox (so state and event are atomic); the credit on the destination account is triggered by that event as its own local transaction. If the credit fails - the destination account is closed, say - a compensating transaction refunds the source, restoring correctness. I make every step idempotent, keyed by the transfer id, because at-least-once delivery means events and commands can be redelivered and must not double-apply. For a transfer with multiple steps and the need for clear visibility and timeout/compensation handling, I’d often use an orchestration-style saga with an explicit coordinator that tracks the transfer’s state and drives the steps and compensations, because it makes the workflow observable and easier to reason about than implicit choreography. The user experience is designed around the eventual consistency: the transfer shows as “processing” until both legs complete, rather than pretending it is instantaneous and globally consistent. This trades immediate global consistency for availability and loose coupling, which is the right call across service boundaries - and I’d state that trade-off explicitly. The combination of local transactions, outbox-published events, idempotent steps, compensation, and (for complex flows) an orchestrator is how you get reliable money movement across services without distributed transactions.
4.6 Banking Enterprise Scenario
Putting it together: a bank’s platform routes customers through a gateway and BFFs to an accounts and payments layer backed by a strongly consistent, event-sourced ledger. Transfers run as orchestrated sagas with compensation and idempotency keyed by transaction id; events publish through the outbox and feed eventually consistent balance and statement read models plus a real-time fraud service. The platform is zone-redundant with a paired DR region and tested failover, hardened with resilience patterns, secured under Zero Trust, and fully audited and observable - correctness and auditability at the core, scalable availability at the edges, every trade-off deliberate.
Chapter Revision Notes
- Banking’s core constraint - money must be correct and auditable - prioritizes consistency and event sourcing.
- Enforce correctness with aggregate invariants, idempotency keyed by transaction id, and immutable events.
- Cross-service transfers use sagas with compensation, not distributed transactions.
- Serve high-volume reads from eventually consistent projections; scale them separately.
- Achieve availability with zone/region redundancy, tested failover, and resilience patterns.