Design a Double-Entry Ledger for Checking, Savings, and Card Spend
Last updated: November 29, 2026
Quick Overview
Design the core ledger service behind a consumer money app that records every movement (card purchases, P2P transfers, direct deposits, savings sweeps) as balanced double-entry postings, serves real-time available balances, and stays correct under retries and partner bank reconciliation.
Onepay
November 29, 20260
0
0 solved
Design the core ledger service behind a consumer money app that records every movement (card purchases, P2P transfers, direct deposits, savings sweeps) as balanced double-entry postings, serves real-time available balances, and stays correct under retries and partner bank reconciliation.
The ledger is the source of truth for OnePay's checking, savings, card, and P2P products, and a staff-level system design round would expect you to defend correctness before scale. The interviewer probes balanced postings, pending versus posted state, idempotency, and how balances stay fast without ever drifting from the journal.
What the Interviewer Expects
- Model accounts, journal entries, and postings with debits equal to credits enforced
- Separate pending (authorized) and posted balances, and define available balance
- Make every write idempotent with an external id
- Serve balances from a maintained projection, not by summing history on every read
- Explain concurrency control for two spends racing on one account
- Describe reconciliation against partner bank and card processor files
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you correct a posting that was wrong without editing history?
- How would you shard the ledger, and what happens to a transfer between accounts on different shards?
- How do you support multiple currencies for international P2P?
- How would you prove to an auditor that balances match the journal at any point in time?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: record transactions as balanced postings; holds for card authorizations; release or post holds on capture or reversal; read available and posted balance with low latency; full history per ...
High-Level Design
Producers (card auth service, P2P service, ACH ingest, savings sweeps) call a Ledger API with external_id, a list of postings, and a type. The ledger validates that postings sum to zero per currency...