Design an Online Banking System
Understanding the Problem
🏦 What is an online banking system? It's the set of systems that lets a bank's customers see and move their money: checking and savings accounts, credit cards, transfers to other people and other banks, card payments at stores, and monthly statements. Behind the app sits a core banking system (the bank's ledger of record), a card authorization system that answers "approve or decline?" for every card swipe in real time, and batch systems for statements, interest and settlement.
Interviewers phrase this a few ways: "design a bank," "design the core entities of a banking system," "design credit card authorization with limits," or "design bank statements." They overlap heavily, so we'll treat them as one problem. The entity model comes first, card authorization is the hardest real-time piece, and statements are the batch piece.
Functional Requirements
Core Requirements
- Customers should be able to view their accounts (checking, savings, credit card), balances and transactions, including pending ones.
- Customers should be able to transfer money between their own accounts, to other customers of the bank, and to other banks.
- The bank should be able to authorize card transactions in real time against the account's available balance or credit limit, and any controls the customer sets.
- Customers should be able to get a monthly statement for each account.
Below the line (out of scope)
- Loans, mortgages and investment accounts.
- Account opening and KYC.
- Branch and call-center tooling.
- The fraud model itself (we'll call it; see /system-design/fraud-detection).
Non-Functional Requirements
Ask about scale. For our design: a mid-to-large bank with 20 million customers, 5 million daily active users on the app, and 30 million card authorizations a day, spiking around the holidays.
Core Requirements
- Balances and postings must be correct and durable. Money is never created or lost, and every change is auditable.
- Card authorization must be fast and extremely available: respond in well under a second (target p99 < 150 ms in our systems), 99.99%+ availability. Card networks will decline or stand in for us if we don't answer in time.
- A customer must never be able to spend past their available balance or credit limit through concurrent transactions (with narrow, deliberate exceptions like offline transactions).
- The app should show balances and recent activity in under 500 ms, including pending card transactions within seconds.
- Statements must be complete and immutable once issued.
Below the line (out of scope)
- Active-active writes across regions for the same account.
- Replacing the core banking system. Many banks run cores that are decades old; we'll design around one.
Back of the envelope. 30M authorizations a day is about 350/s average. Holiday peaks run several times higher; plan for ~3,000/s. That's small in raw throughput. The hard parts are latency and availability: every one of those requests has a customer standing at a register.
The app: 5M daily users opening it a few times each is ~20M sessions and maybe 100M API calls a day, around 1,200/s average and a few thousand at peak, nearly all reads.
Statements: 20M customers with ~1.5 accounts each is 30M statements a month. If every statement were generated on the 1st, we'd have a nightly batch of 30M. If cycle dates are spread across the month, it's about 1 million a day, which changes the batch design completely.
Banks rarely design from a blank page. Saying "I'd keep the existing core as the ledger of record and build fast, available services around it" is usually closer to reality, and to what your interviewer wants, than proposing to rewrite the core in Kafka.