Banking System Design
A system design case study for a banking platform covering accounts, ledgers, transactions, compliance, fraud controls, and reliability.
Introduction
Banking systems are among the most critical software systems in the world. Every second, millions of customers transfer money, check balances, pay bills, withdraw cash, and make online purchases. These operations require high availability, strong consistency, security, compliance, fault tolerance, and auditability.
Unlike a typical CRUD application, a banking platform cannot afford data loss or inconsistent balances. Every transaction must be traceable, recoverable, and compliant with financial regulations.
In this case study, we will design a modern Core Banking System capable of supporting millions of customers while maintaining security, scalability, and reliability.
Learning Objectives
By the end of this article, you will understand how to:
- Gather business requirements
- Identify functional and non-functional requirements
- Estimate system capacity
- Design scalable banking architectures
- Decompose a monolith into microservices
- Design secure banking APIs
- Handle financial transactions safely
- Prepare for System Design interviews
Problem Statement
Design a Core Banking Platform that allows customers to:
- Register and complete KYC
- Open bank accounts
- Deposit money
- Withdraw money
- Transfer funds
- View account balances
- Download statements
- Pay utility bills
- Receive notifications
- Manage beneficiaries
The platform should support:
- Mobile Banking
- Internet Banking
- ATM Transactions
- Branch Banking
- Third-party integrations
Business Requirements
The banking platform must support day-to-day retail banking operations while ensuring financial integrity and regulatory compliance.
Primary business goals include:
- Secure customer onboarding
- Real-time account management
- Accurate financial transactions
- Instant balance updates
- Fraud prevention
- Regulatory reporting
- High customer availability
- 24×7 operation
Functional Requirements
Customer Management
The system should allow users to:
- Register online
- Verify identity (KYC)
- Update profile
- Reset password
- Manage contact information
- View customer details
Account Management
Customers should be able to:
- Open savings accounts
- Open current accounts
- View balances
- Freeze or close accounts
- View account history
Fund Transfer
Support:
- Own account transfer
- Internal transfers
- External bank transfers
- Scheduled transfers
- Recurring transfers
Transaction Processing
Support:
- Cash deposits
- Cash withdrawals
- ATM transactions
- UPI payments
- Card payments
- Wire transfers
- Bill payments
Statement Management
Generate:
- Mini statements
- Monthly statements
- Annual statements
- Downloadable PDF reports
Beneficiary Management
Customers can:
- Add beneficiaries
- Remove beneficiaries
- Modify beneficiaries
- Verify beneficiaries
Notifications
Notify customers through:
- SMS
- Push notifications
- In-app notifications
Examples:
- Debit alerts
- Credit alerts
- Login alerts
- Password changes
Fraud Detection
Detect:
- Unusual login activity
- Large transfers
- Multiple failed logins
- Suspicious locations
- Velocity attacks
Non-Functional Requirements
A banking system is evaluated as much on its operational qualities as on its business features.
| Requirement | Target |
|---|---|
| Availability | 99.99% or higher |
| Scalability | Millions of customers |
| Consistency | Strong consistency for financial transactions |
| Reliability | Zero transaction loss |
| Security | Enterprise-grade |
| Performance | Sub-second balance lookup |
| Durability | Permanent transaction records |
| Auditability | Complete audit trail |
| Disaster Recovery | Multi-region support |
| Maintainability | Independent service deployments |
Assumptions
To estimate system size, we'll assume the following.
| Metric | Value |
|---|---|
| Registered customers | 50 Million |
| Daily active users | 10 Million |
| Daily logins | 40 Million |
| Bank accounts | 70 Million |
| Daily transactions | 120 Million |
| Peak TPS | 15,000 |
| Monthly statements | 50 Million |
| Mobile users | 85% |
| Internet banking users | 15% |
Capacity Estimation
Daily Transactions
120 Million transactions/day
Average:
120,000,000 / 86,400
≈ 1,389 TPS
Peak traffic is usually much higher.
Assume:
Peak TPS = 15,000
Storage Estimation
Assume:
Each transaction record
- Metadata
- Amount
- Account IDs
- Status
- Audit information
Average size
1 KB
Daily storage:
120 Million × 1 KB
≈ 120 GB/day
Yearly storage:
120 × 365
≈ 43.8 TB/year
This excludes:
- Audit logs
- Images
- Statements
- KYC documents
- Backups
Customer Data
Assume
50 Million customers
Average profile
5 KB
Storage:
250 GB
Statement Storage
PDF statements
Average
300 KB
Monthly
50 Million × 300 KB
≈ 15 TB/month
Core Banking Concepts
Before designing the architecture, it's important to understand the key banking entities.
Customer
Represents an individual or business that owns one or more bank accounts.
Account
Represents a financial account.
Examples:
- Savings
- Current
- Salary
- Loan
- Credit Card
Transaction
Represents movement of money.
Examples:
- Deposit
- Withdrawal
- Transfer
- Payment
Ledger
The ledger is the financial source of truth.
It records every debit and credit permanently.
Money is never edited—it is recorded as accounting entries.
Beneficiary
A trusted recipient who can receive transfers.
KYC
Know Your Customer verification includes:
- Identity verification
- Address verification
- PAN/Tax ID
- Passport
- Driver License
AML
Anti-Money Laundering processes monitor suspicious financial activities.
High-Level Architecture
A modern banking system is typically built using a microservices architecture.
flowchart TD
Customer
Customer --> Mobile
Customer --> Web
Customer --> ATM
Mobile --> Gateway
Web --> Gateway
ATM --> Gateway
Gateway --> Auth
Gateway --> CustomerService
Gateway --> AccountService
Gateway --> TransactionService
Gateway --> NotificationService
Why Microservices?
Each banking capability evolves independently.
Benefits include:
- Independent deployment
- Independent scaling
- Better fault isolation
- Team ownership
- Faster releases
- Technology flexibility
Core Services
API Gateway
Responsibilities
- Authentication
- Routing
- Rate limiting
- Logging
- Request validation
Authentication Service
Responsibilities
- Login
- MFA
- JWT
- Session management
- Password reset
Customer Service
Responsibilities
- Customer profiles
- KYC
- Contact information
- Identity verification
Account Service
Responsibilities
- Open account
- Close account
- Balance inquiry
- Account status
Transaction Service
Responsibilities
- Deposits
- Withdrawals
- Transfers
- Balance updates
- Transaction history
Notification Service
Responsibilities
- SMS
- Push notifications
- Transaction alerts
Service Decomposition
flowchart LR
Gateway
Gateway --> Auth
Gateway --> Customer
Gateway --> Account
Gateway --> Transaction
Gateway --> Notification
Gateway --> Fraud
Gateway --> Reporting
Banking Channels
A single banking platform serves multiple channels.
| Channel | Examples |
|---|---|
| Mobile Banking | Android, iOS |
| Internet Banking | Web Portal |
| ATM | Cash withdrawal, balance inquiry |
| Branch | Teller operations |
| Customer Care | Assisted banking |
| Partner APIs | Payment gateways, fintech integrations |
All channels communicate through the same backend services to ensure consistency and centralized business rules.
Design Considerations
When designing a banking platform, prioritize:
- Data consistency over availability for financial transactions
- Immutable transaction history
- Strong authentication and authorization
- Idempotent transaction processing
- End-to-end encryption
- Comprehensive audit logging
- Horizontal scalability
- Regulatory compliance
- Fault isolation
- High observability
Low-Level Architecture
The banking platform consists of multiple independently deployable microservices.
Each service owns its own database and communicates using synchronous REST APIs and asynchronous events.
flowchart LR
Client
Client --> Gateway
Gateway --> Auth
Gateway --> Customer
Gateway --> Account
Gateway --> Transaction
Gateway --> Ledger
Gateway --> Notification
Gateway --> Fraud
Transaction --> Ledger
Transaction --> Kafka
Kafka --> Notification
Kafka --> Reporting
Kafka --> Fraud
Why Separate Services?
Each service has different characteristics.
| Service | Responsibility |
|---|---|
| Auth | Login & Security |
| Customer | Customer Profile |
| Account | Bank Accounts |
| Transaction | Money Movement |
| Ledger | Accounting Entries |
| Fraud | Fraud Detection |
| Notification | Email/SMS |
| Reporting | Statements & Reports |
Benefits:
- Independent deployment
- Independent scaling
- Fault isolation
- Better ownership
- Easier maintenance
Database Design
Each microservice owns its own schema.
Customer DB
Account DB
Transaction DB
Ledger DB
Notification DB
No database is shared across services.
Database Architecture
flowchart TD
CustomerService
AccountService
TransactionService
LedgerService
CustomerService --> CustomerDB
AccountService --> AccountDB
TransactionService --> TransactionDB
LedgerService --> LedgerDB
Customer Database
Customer Table
| Column | Type |
|---|---|
| customer_id | UUID |
| first_name | VARCHAR |
| last_name | VARCHAR |
| VARCHAR | |
| phone | VARCHAR |
| date_of_birth | DATE |
| kyc_status | VARCHAR |
| status | VARCHAR |
| created_at | TIMESTAMP |
Address Table
| Column | Type |
|---|---|
| address_id | UUID |
| customer_id | UUID |
| city | VARCHAR |
| state | VARCHAR |
| country | VARCHAR |
| postal_code | VARCHAR |
Account Database
Account Table
| Column | Type |
|---|---|
| account_id | UUID |
| customer_id | UUID |
| account_number | VARCHAR |
| account_type | VARCHAR |
| currency | VARCHAR |
| available_balance | DECIMAL |
| ledger_balance | DECIMAL |
| status | VARCHAR |
| created_at | TIMESTAMP |
Beneficiary Table
| Column | Type |
|---|---|
| beneficiary_id | UUID |
| customer_id | UUID |
| beneficiary_account | VARCHAR |
| bank_name | VARCHAR |
| nickname | VARCHAR |
Transaction Database
Transaction Table
| Column | Type |
|---|---|
| transaction_id | UUID |
| from_account | UUID |
| to_account | UUID |
| amount | DECIMAL |
| currency | VARCHAR |
| transaction_type | VARCHAR |
| status | VARCHAR |
| created_at | TIMESTAMP |
Transaction Status
Possible values
- Pending
- Processing
- Completed
- Failed
- Reversed
Ledger Database
The ledger is the financial source of truth.
Balances can be recalculated from ledger entries.
Money is never edited.
Instead,
new accounting entries are created.
Ledger Table
| Column | Type |
|---|---|
| ledger_id | UUID |
| transaction_id | UUID |
| account_id | UUID |
| entry_type | Debit/Credit |
| amount | DECIMAL |
| balance_after | DECIMAL |
| created_at | TIMESTAMP |
Audit Table
Every important operation is audited.
| Column | Type |
|---|---|
| audit_id | UUID |
| entity | VARCHAR |
| entity_id | UUID |
| action | VARCHAR |
| user | VARCHAR |
| timestamp | TIMESTAMP |
Entity Relationship
flowchart TD
Customer
Account
Beneficiary
Transaction
Ledger
Customer --> Account
Customer --> Beneficiary
Account --> Transaction
Transaction --> Ledger
Why Use UUID?
Benefits
- Globally unique
- Easy distributed generation
- No database bottleneck
- Safer public identifiers
Ledger Design
The ledger maintains complete accounting history.
Example
Customer A transfers $500 to Customer B.
Instead of updating balances directly,
the system records accounting entries.
Double Entry Accounting
Every transaction creates two entries.
Example
Transfer $500
| Account | Entry |
|---|---|
| Sender | Debit $500 |
| Receiver | Credit $500 |
Total Debit = Total Credit
Accounting remains balanced.
Ledger Flow
flowchart LR
Transfer
Transfer --> Debit
Transfer --> Credit
Debit --> Ledger
Credit --> Ledger
Why Double Entry?
Advantages
- Prevents imbalance
- Easy reconciliation
- Audit friendly
- Regulatory compliant
- Error detection
Money Transfer Flow
Customer transfers $250.
Steps
- Authenticate customer
- Validate account
- Check balance
- Reserve amount
- Create transaction
- Write ledger entries
- Update balances
- Publish event
- Send notification
Transfer Sequence
sequenceDiagram
participant User
participant Gateway
participant Transaction
participant Ledger
participant Account
User->>Gateway: Transfer Money
Gateway->>Transaction: Validate
Transaction->>Account: Check Balance
Account-->>Transaction: OK
Transaction->>Ledger: Debit
Ledger-->>Transaction: Success
Transaction->>Ledger: Credit
Ledger-->>Transaction: Success
Transaction-->>Gateway: Completed
Gateway-->>User: Success
REST API Design
Customer APIs
Register Customer
POST /customers
Get Customer
GET /customers/{id}
Update Customer
PUT /customers/{id}
Account APIs
Open Account
POST /accounts
Get Account
GET /accounts/{id}
Get Balance
GET /accounts/{id}/balance
Freeze Account
PUT /accounts/{id}/freeze
Transaction APIs
Transfer Money
POST /transactions/transfer
Request
{
"fromAccount":"1001",
"toAccount":"2001",
"amount":250,
"currency":"USD"
}
Response
{
"transactionId":"TX10001",
"status":"SUCCESS"
}
Deposit
POST /transactions/deposit
Withdraw
POST /transactions/withdraw
Transaction History
GET /transactions?accountId=1001
API Design Principles
- RESTful endpoints
- Versioned APIs
- Idempotency support
- Pagination
- Filtering
- Correlation IDs
- Standard error responses
Idempotency
Financial APIs must avoid duplicate processing.
Example
Idempotency-Key
A123XYZ
If client retries,
same response is returned.
Money isn't transferred twice.
Event-Driven Architecture
Every completed transaction generates events.
Consumers subscribe independently.
flowchart LR
Transaction
Transaction --> Kafka
Kafka --> Notification
Kafka --> Fraud
Kafka --> Analytics
Kafka --> Reporting
Why Kafka?
Benefits
- Loose coupling
- High throughput
- Retry support
- Durable events
- Event replay
- Independent consumers
Kafka Topics
| Topic | Producer | Consumer |
|---|---|---|
| customer-created | Customer Service | Notification |
| account-created | Account Service | Reporting |
| transaction-created | Transaction Service | Ledger |
| transaction-completed | Transaction Service | Notification |
| transaction-failed | Transaction Service | Fraud |
| account-frozen | Account Service | Notification |
| fraud-detected | Fraud Service | Compliance |
| statement-generated | Reporting | Notification |
Event Example
Transaction Completed
{
"event":"TRANSACTION_COMPLETED",
"transactionId":"TX10001",
"fromAccount":"1001",
"toAccount":"2001",
"amount":250,
"currency":"USD",
"timestamp":"2026-07-28T10:00:00Z"
}
Service Communication
Use synchronous communication when:
- Immediate response is required
- Authentication
- Balance validation
- Customer lookup
Use asynchronous communication when:
- Notifications
- Reporting
- Analytics
- Fraud detection
- Audit logging
Data Consistency
Financial transactions require strong consistency.
Approach
- ACID database transactions
- Immutable ledger
- Double-entry accounting
- Idempotent APIs
- Retry with safeguards
Error Handling
Examples
| Error | Action |
|---|---|
| Insufficient Balance | Reject Transfer |
| Invalid Account | Return Validation Error |
| Duplicate Request | Return Previous Response |
| Database Failure | Rollback Transaction |
| Ledger Failure | Mark Transaction Failed |
Best Practices
- One database per microservice
- Immutable financial records
- Double-entry accounting
- UUID identifiers
- Idempotent APIs
- Event-driven communication
- Audit every financial operation
- Never delete transaction history
- Encrypt sensitive customer data
- Use correlation IDs for traceability
Why Banking Systems Need Advanced Patterns
Unlike ordinary CRUD applications, banking platforms must guarantee:
- No duplicate money transfers
- No inconsistent balances
- High availability
- Regulatory compliance
- Complete audit history
- Extremely low failure rates
To achieve these goals, modern banking systems combine several distributed system patterns.
Banking Architecture Evolution
flowchart LR
Monolith
Monolith --> Microservices
Microservices --> EventDriven
EventDriven --> CQRS
CQRS --> Saga
Command Query Responsibility Segregation (CQRS)
CQRS separates write operations from read operations.
Instead of one service handling everything, commands and queries are optimized independently.
Why CQRS?
Without CQRS:
Read
↓
Database
↑
Write
Heavy reporting queries can slow down transaction processing.
With CQRS:
flowchart LR
User
User --> CommandAPI
User --> QueryAPI
CommandAPI --> WriteDB
WriteDB --> Events
Events --> ReadDB
ReadDB --> QueryAPI
Banking Commands
Commands modify data.
Examples:
- Open Account
- Deposit Money
- Withdraw Money
- Transfer Funds
- Close Account
- Add Beneficiary
Banking Queries
Queries only retrieve data.
Examples:
- Balance Inquiry
- Mini Statement
- Monthly Statement
- Customer Profile
- Transaction History
CQRS Benefits
| Traditional | CQRS |
|---|---|
| Same database for reads/writes | Separate models |
| Limited scalability | Independent scaling |
| Slow reporting | Optimized read models |
| High contention | Reduced locking |
| Difficult optimization | Specialized databases |
Read Model Synchronization
Updates to the write database generate domain events.
flowchart LR
WriteDB
WriteDB --> Kafka
Kafka --> ReadProjection
ReadProjection --> ReadDB
Eventually, the read database becomes consistent with the write database.
Event Sourcing Overview
Traditional systems store only the latest state.
Example
Balance = $5,000
We don't know how it reached that value.
With Event Sourcing
Every state change becomes an immutable event.
Account Opened
↓
Deposit $1,000
↓
Deposit $2,000
↓
Withdraw $500
↓
Transfer $300
↓
Deposit $2,800
Current balance is derived from replaying events.
Benefits of Event Sourcing
- Complete audit history
- Easy replay
- Regulatory compliance
- Time travel debugging
- Immutable records
When NOT to Use Event Sourcing
Avoid it for:
- Simple CRUD systems
- Small applications
- Systems without auditing requirements
Distributed Transactions
A bank transfer involves multiple services.
Example:
Transfer $500
Services involved:
- Transaction Service
- Account Service
- Ledger Service
- Notification Service
- Fraud Service
A traditional database transaction cannot span multiple microservices.
Transfer Workflow
flowchart TD
Transfer
Transfer --> Validate
Validate --> Debit
Debit --> Credit
Credit --> Ledger
Ledger --> Notification
Why Two-Phase Commit (2PC) Is Rare
Problems
- Slow
- Blocking
- Difficult recovery
- Poor scalability
- Tight coupling
Large banking platforms generally avoid distributed database transactions across microservices.
Saga Pattern
Saga coordinates a distributed transaction using a sequence of local transactions.
Each step commits independently.
If something fails,
compensating actions are executed.
Money Transfer Saga
Example:
Transfer $1,000
Steps
- Validate accounts
- Debit sender
- Credit receiver
- Update ledger
- Publish transaction event
- Send notification
Saga Flow
flowchart TD
Start
Start --> Validate
Validate --> Debit
Debit --> Credit
Credit --> Ledger
Ledger --> Notify
Notify --> Complete
Compensation Flow
Suppose credit fails.
flowchart TD
Debit
Debit --> Credit
Credit --> Failed
Failed --> ReverseDebit
Money is automatically returned.
Saga Benefits
- No distributed locks
- High scalability
- Independent services
- Better fault tolerance
- Cloud friendly
Saga Challenges
- Eventual consistency
- Compensation logic
- More complex debugging
- Event ordering
Caching Strategy
Not every request should hit the database.
Frequently accessed data should be cached.
What to Cache
- Customer profile
- Branch list
- Currency exchange rates
- Account summary
- Product catalog
- Interest rates
- Configuration
What NOT to Cache
Never cache:
- Authentication tokens
- Pending transactions
- Financial ledger entries
- Payment authorization state
- Highly sensitive customer information
Redis Architecture
flowchart LR
Application
Application --> Redis
Redis --> Database
Cache Strategy
| Data | TTL |
|---|---|
| Customer Profile | 15 minutes |
| Branches | 24 hours |
| Currency Rates | 5 minutes |
| Configuration | 1 hour |
| Interest Rates | 1 hour |
Cache Patterns
Cache Aside
Application
↓
Redis
↓
Database
Read Through
Application accesses Redis.
Redis retrieves missing data automatically.
Write Through
Database updates automatically update cache.
Fraud Detection System
Fraud detection protects customers against unauthorized activity.
Typical checks include:
- Large transfer amounts
- New device login
- Unusual country
- Rapid consecutive transfers
- Multiple failed logins
- Velocity checks
Fraud Detection Flow
flowchart LR
Transaction
Transaction --> FraudEngine
FraudEngine --> RiskScore
RiskScore --> Approve
RiskScore --> Reject
RiskScore --> ManualReview
Risk Levels
| Score | Action |
|---|---|
| Low | Approve |
| Medium | Additional Verification |
| High | Block Transaction |
| Critical | Freeze Account |
Machine Learning in Fraud Detection
Common features:
- Login location
- Device fingerprint
- IP address
- Historical spending
- Time of day
- Transaction frequency
- Merchant category
- Transfer amount
Notification Architecture
Every important event generates notifications.
Examples:
- Login
- Password changed
- Transfer completed
- Debit alert
- Credit alert
- Failed transaction
- Account locked
Notification Flow
flowchart LR
Transaction
Transaction --> Kafka
Kafka --> Notification
Notification --> Email
Notification --> SMS
Notification --> Push
Why Asynchronous Notifications?
Advantages
- Faster transaction processing
- Independent scaling
- Retry support
- Better reliability
- Loose coupling
Security Architecture
Security is the highest priority.
Authentication
Support:
- Username/Password
- Multi-Factor Authentication (MFA)
- Biometric Login
- Device Registration
Authorization
Role examples:
- Customer
- Branch Employee
- Auditor
- Administrator
- Support Engineer
Authentication Flow
flowchart LR
User
User --> Login
Login --> MFA
MFA --> JWT
JWT --> API
JWT Usage
JWT contains:
- User ID
- Roles
- Permissions
- Expiration Time
Never store sensitive financial data inside the token.
API Security
Every API should support:
- HTTPS
- OAuth2
- JWT Validation
- Rate Limiting
- Request Validation
- Correlation IDs
Encryption
Encrypt:
- Customer data
- Personally identifiable information (PII)
- Account numbers
- Card information
- KYC documents
Encryption methods:
- TLS for data in transit
- AES-256 for data at rest
Secrets Management
Never store secrets inside source code.
Store:
- Database passwords
- API keys
- Certificates
- Encryption keys
Using:
- Vault
- AWS Secrets Manager
- Azure Key Vault
- Kubernetes Secrets
Regulatory Compliance
A banking platform must satisfy multiple regulations.
KYC
Know Your Customer
Verify:
- Identity
- Address
- Government ID
- Date of Birth
AML
Anti-Money Laundering
Monitor:
- Suspicious transfers
- Large cash deposits
- Structured transactions
- Sanction lists
PCI DSS
Applicable when processing payment card data.
Requirements include:
- Secure networks
- Encryption
- Access controls
- Vulnerability management
- Logging
- Regular audits
Audit Logging
Every sensitive action must be logged.
Examples
- Login
- Logout
- Password changes
- Account creation
- Money transfers
- Failed authentication
- Administrative actions
Logs should be immutable and retained according to regulatory policies.
Multi-Region Architecture
Modern banks operate across multiple geographic regions.
Goals
- Disaster recovery
- Low latency
- Regulatory compliance
- Business continuity
Multi-Region Deployment
flowchart LR
Users
Users --> RegionA
Users --> RegionB
RegionA --> DatabaseA
RegionB --> DatabaseB
DatabaseA --> Replication
Replication --> DatabaseB
Active-Active vs Active-Passive
| Strategy | Characteristics |
|---|---|
| Active-Active | Multiple regions serve traffic simultaneously |
| Active-Passive | Secondary region activated during failures |
High Availability
Target availability:
99.99%
Achieved using:
- Load balancers
- Multiple application instances
- Database replication
- Auto scaling
- Health checks
- Automatic failover
Reliability Patterns
Use:
- Retry
- Timeout
- Circuit Breaker
- Bulkhead
- Rate Limiting
- Dead Letter Queue
These patterns improve resilience without compromising financial consistency.
Best Practices
- Separate read and write workloads using CQRS.
- Use immutable ledger records.
- Prefer Saga over distributed database transactions.
- Cache only safe, non-sensitive data.
- Secure every API with OAuth2 and JWT.
- Encrypt sensitive data at rest and in transit.
- Perform fraud analysis before completing high-risk transactions.
- Publish domain events for downstream services.
- Maintain immutable audit logs.
- Design for regional failures and disaster recovery.
Production Deployment Goals
A banking platform must achieve:
- 99.99% availability
- Zero downtime deployments
- Automatic recovery
- High scalability
- Strong security
- Continuous monitoring
- Fast incident response
Production Deployment Architecture
flowchart TD
Customer
Customer --> DNS
DNS --> CDN
CDN --> WAF
WAF --> LoadBalancer
LoadBalancer --> APIGateway
APIGateway --> Kubernetes
Kubernetes --> Auth
Kubernetes --> Customer
Kubernetes --> Account
Kubernetes --> Transaction
Kubernetes --> Ledger
Kubernetes --> Notification
Kubernetes --> Fraud
Infrastructure Overview
| Layer | Technology |
|---|---|
| DNS | Route53 / Cloud DNS |
| CDN | CloudFront / Azure CDN |
| Web Security | WAF |
| Load Balancer | ALB / NGINX |
| API Gateway | Kong / Spring Cloud Gateway |
| Container Runtime | Docker |
| Container Orchestration | Kubernetes |
| Monitoring | Prometheus |
| Dashboards | Grafana |
| Logging | ELK / OpenSearch |
| Tracing | Jaeger / Zipkin |
| Messaging | Kafka |
| Cache | Redis |
Docker Architecture
Each service runs inside an independent container.
Benefits:
- Consistent deployment
- Environment isolation
- Faster releases
- Better scalability
- Simplified rollback
Container Architecture
flowchart LR
DockerHost
DockerHost --> Auth
DockerHost --> Customer
DockerHost --> Account
DockerHost --> Transaction
DockerHost --> Ledger
DockerHost --> Notification
Sample Dockerfile
FROM eclipse-temurin:21-jre
WORKDIR /app
COPY target/account-service.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","app.jar"]
Why Kubernetes?
Running containers manually becomes difficult as systems grow.
Kubernetes provides:
- Self-healing
- Auto scaling
- Rolling updates
- Load balancing
- Service discovery
- Resource management
Kubernetes Cluster
flowchart TD
Users
Users --> Ingress
Ingress --> Service
Service --> Pod1
Service --> Pod2
Service --> Pod3
Kubernetes Components
| Component | Responsibility |
|---|---|
| Pod | Runs application containers |
| Deployment | Manages replicas |
| Service | Internal networking |
| Ingress | External routing |
| ConfigMap | Configuration |
| Secret | Sensitive credentials |
| StatefulSet | Stateful applications |
| Horizontal Pod Autoscaler | Automatic scaling |
Banking Kubernetes Deployment
flowchart TD
Ingress
Ingress --> Gateway
Gateway --> Auth
Gateway --> Customer
Gateway --> Account
Gateway --> Transaction
Gateway --> Ledger
Gateway --> Notification
Service Discovery
Instead of hardcoded IP addresses, services communicate using service names.
Example:
http://account-service
http://transaction-service
http://ledger-service
Advantages:
- Dynamic scaling
- Easier deployments
- Fault tolerance
Internal Communication
flowchart LR
Transaction
Transaction --> Account
Transaction --> Ledger
Transaction --> Notification
Load Balancing
Traffic is distributed across multiple instances.
flowchart TD
Users
Users --> LoadBalancer
LoadBalancer --> Instance1
LoadBalancer --> Instance2
LoadBalancer --> Instance3
Benefits:
- High availability
- Better utilization
- Improved performance
Horizontal Scaling
When traffic increases:
2 Pods
↓
5 Pods
↓
10 Pods
Scaling occurs automatically based on CPU, memory, or custom metrics.
Vertical Scaling
Increase:
- CPU
- Memory
- Storage
Suitable for databases or legacy workloads, but horizontal scaling is preferred for stateless services.
Auto Scaling Strategy
| Metric | Action |
|---|---|
| CPU > 70% | Add Pods |
| Memory > 75% | Add Pods |
| Request Rate High | Scale Out |
| Traffic Drops | Scale In |
High Availability Strategy
Every critical service runs multiple replicas.
flowchart LR
Gateway
Gateway --> Transaction1
Gateway --> Transaction2
Gateway --> Transaction3
If one instance fails, traffic is routed to healthy instances.
CI/CD Pipeline
Modern banking systems use automated pipelines.
flowchart LR
Developer
Developer --> Git
Git --> Build
Build --> Test
Test --> SecurityScan
SecurityScan --> Docker
Docker --> Kubernetes
CI Pipeline
Typical steps:
- Pull source code
- Compile
- Run unit tests
- Run integration tests
- Static code analysis
- Security scan
- Build Docker image
- Publish artifact
CD Pipeline
Deployment steps:
- Deploy to Development
- Smoke Tests
- Deploy to QA
- Integration Tests
- User Acceptance Testing
- Production Approval
- Production Deployment
- Health Verification
Deployment Strategies
Rolling Deployment
Replace application instances gradually.
flowchart LR
Old
Old --> Mixed
Mixed --> New
Advantages:
- No downtime
- Controlled rollout
- Easy monitoring
Blue-Green Deployment
Maintain two identical production environments.
flowchart LR
Users
Users --> Blue
Blue --> Green
Only one environment serves traffic at a time.
Benefits:
- Instant rollback
- Zero downtime
- Safe deployments
Canary Deployment
Deploy to a small percentage of users first.
5%
↓
20%
↓
50%
↓
100%
Useful for reducing deployment risk.
Monitoring Architecture
Monitoring answers:
- Is the application healthy?
- Is performance degrading?
- Are customers impacted?
Monitoring Pipeline
flowchart LR
Application
Application --> Metrics
Application --> Logs
Application --> Traces
Metrics --> Prometheus
Prometheus --> Grafana
Logs --> ELK
Traces --> Jaeger
Metrics Collection
Track:
- Request count
- Response time
- Error rate
- Throughput
- CPU
- Memory
- Disk
- JVM Heap
- Kafka lag
- Database latency
Golden Signals
| Signal | Description |
|---|---|
| Latency | Request duration |
| Traffic | Requests per second |
| Errors | Failed requests |
| Saturation | Resource utilization |
Banking Business Metrics
Besides technical metrics, monitor business KPIs.
Examples:
- Transfers per minute
- Successful payments
- Failed transactions
- Login success rate
- New account openings
- Fraud detection rate
- Settlement completion time
Logging Strategy
Every request generates structured logs.
Log fields:
- Timestamp
- Trace ID
- Correlation ID
- Service
- User ID
- Request ID
- API
- Response Time
- Status Code
Structured Log Example
{
"traceId":"12345",
"service":"transaction-service",
"accountId":"ACC10001",
"transactionId":"TX2001",
"status":"SUCCESS",
"responseTime":125
}
Log Levels
| Level | Usage |
|---|---|
| INFO | Normal operations |
| WARN | Recoverable issues |
| ERROR | Failures |
| DEBUG | Development only |
Never enable verbose DEBUG logging in production unless troubleshooting a specific issue.
Distributed Tracing
A single banking request travels through multiple services.
Tracing connects all service calls using a Trace ID.
flowchart LR
Gateway
Gateway --> Auth
Auth --> Transaction
Transaction --> Ledger
Ledger --> Notification
Correlation IDs
Every incoming request receives a unique Correlation ID.
Example:
X-Correlation-ID
BANK-REQ-987654
This identifier is propagated across all downstream services and logs.
Health Checks
Each service exposes health endpoints.
Examples:
GET /actuator/health
GET /actuator/readiness
GET /actuator/liveness
Kubernetes uses these endpoints to determine pod health.
Alerting Strategy
Alerts should notify engineers before customers notice issues.
Examples:
| Condition | Alert |
|---|---|
| Error Rate > 5% | Critical |
| API Latency > 2 seconds | Warning |
| Kafka Consumer Lag | Warning |
| Database CPU > 90% | Critical |
| Pod CrashLoop | Critical |
| Disk Space Low | Warning |
Backup Strategy
Critical databases require regular backups.
Typical policy:
- Hourly incremental backups
- Daily full backups
- Weekly archive
- Cross-region replication
Backups must be encrypted and regularly tested for restoration.
Disaster Recovery
A banking platform must survive regional failures.
Objectives:
- Business continuity
- Minimal downtime
- No financial data loss
Disaster Recovery Architecture
flowchart TD
PrimaryRegion
PrimaryRegion --> DatabasePrimary
PrimaryRegion --> KafkaPrimary
DatabasePrimary --> Replication
KafkaPrimary --> Replication
Replication --> SecondaryRegion
SecondaryRegion --> DatabaseSecondary
SecondaryRegion --> KafkaSecondary
Recovery Objectives
| Objective | Target |
|---|---|
| RPO (Recovery Point Objective) | Near Zero |
| RTO (Recovery Time Objective) | Less than 15 Minutes |
Failure Scenarios
Database Failure
Recovery:
- Failover to replica
- Restore transactions
- Resume services
Kafka Failure
Recovery:
- Producer retries
- Consumer retries
- Dead Letter Queue
- Cluster replication
Service Failure
Recovery:
- Kubernetes restarts failed pods
- Traffic routed to healthy replicas
- Alerts generated
Region Failure
Recovery:
- Route traffic to secondary region
- Promote standby databases
- Restore messaging services
- Resume customer traffic
Performance Optimization
Improve performance using:
- Redis caching
- Connection pooling
- Asynchronous processing
- Batch operations
- Read replicas
- Database indexing
- Compression
- CDN for static assets
Production Security
Operational security includes:
- Network segmentation
- Mutual TLS between services
- Secret rotation
- Vulnerability scanning
- Image signing
- Least-privilege IAM
- Audit logging
- Runtime security monitoring
Production Readiness Checklist
| Area | Status |
|---|---|
| Automated Testing | ✓ |
| Security Scanning | ✓ |
| Container Images | ✓ |
| Health Checks | ✓ |
| Monitoring | ✓ |
| Logging | ✓ |
| Distributed Tracing | ✓ |
| Auto Scaling | ✓ |
| Disaster Recovery | ✓ |
| Backup Strategy | ✓ |
| Alerting | ✓ |
| Rollback Plan | ✓ |
Best Practices
- Containerize every microservice.
- Use Kubernetes for orchestration.
- Automate CI/CD pipelines.
- Prefer rolling or canary deployments.
- Implement centralized logging and monitoring.
- Propagate Correlation IDs and Trace IDs.
- Configure proactive alerts.
- Test backups and disaster recovery regularly.
- Encrypt all sensitive data.
- Continuously validate production health.
Production Challenges, Trade-offs, Interview Questions & Architecture Cheat Sheet
Real Production Challenges
Enterprise banking platforms rarely fail because of algorithms.
Most incidents occur because of:
- Unexpected traffic spikes
- Database bottlenecks
- Third-party failures
- Infrastructure issues
- Deployment mistakes
- Network latency
- Security incidents
- Human error
Challenge 1 — Salary Day Traffic Spike
Every month, millions of customers log in simultaneously.
Typical increase:
- Login traffic ×10
- Balance inquiries ×15
- Fund transfers ×8
Solution:
- Auto scaling
- Redis caching
- Read replicas
- CDN
- Queue buffering
Challenge 2 — Payment Gateway Downtime
External payment providers may become unavailable.
Impact:
- Failed transfers
- Delayed settlements
- Customer complaints
Solution:
- Retry policies
- Circuit Breaker
- Queue pending requests
- Fallback providers
- Customer notifications
Challenge 3 — Database Hotspots
Some accounts receive extremely high transaction volumes.
Examples:
- Merchant accounts
- Government collections
- Payroll accounts
Solutions:
- Read replicas
- Partitioning
- Optimized indexes
- Caching
- Horizontal scaling
Challenge 4 — Duplicate Requests
A customer presses the Transfer button multiple times.
Without protection:
Transfer
↓
Transfer
↓
Transfer
Money may be transferred multiple times.
Solution:
- Idempotency Keys
- Request deduplication
- Distributed locking
- Transaction validation
Duplicate Request Protection
flowchart LR
Client
Client --> API
API --> Idempotency
Idempotency --> Transaction
Challenge 5 — Regional Failure
Entire cloud regions can become unavailable.
Recovery:
- Global load balancing
- Multi-region deployment
- Database replication
- Automatic failover
Scalability Strategy
Scale different services independently.
flowchart TD
Gateway
Gateway --> Auth
Gateway --> Customer
Gateway --> Account
Gateway --> Transaction
Gateway --> Notification
Transaction --> Kafka
Example:
Notification Service may require 50 instances while Ledger Service requires only 5.
Scaling by Service
| Service | Scaling Requirement |
|---|---|
| API Gateway | Very High |
| Authentication | High |
| Customer | Medium |
| Account | High |
| Transaction | Very High |
| Ledger | High |
| Notification | Very High |
| Fraud Detection | Medium |
| Reporting | Medium |
Database Scaling
Strategies:
- Read Replicas
- Sharding
- Partitioning
- Connection Pooling
- Query Optimization
Example Database Architecture
flowchart LR
Application
Application --> PrimaryDB
PrimaryDB --> Replica1
PrimaryDB --> Replica2
Kafka Scaling
As transaction volume increases:
Topic
↓
Partitions
↓
Consumers
More partitions allow greater parallelism.
Redis Scaling
Cache cluster
flowchart LR
Application
Application --> RedisCluster
RedisCluster --> Node1
RedisCluster --> Node2
RedisCluster --> Node3
Cost Optimization
Enterprise systems must balance performance and operational cost.
Optimization techniques:
- Auto scaling
- Spot instances (where appropriate)
- Storage lifecycle policies
- Compression
- Archive historical data
- Efficient caching
- Database tuning
Storage Optimization
Keep frequently accessed data in fast storage.
Archive:
- Old statements
- Historical logs
- Audit records
- Reports
Move archived data to lower-cost storage.
Performance Optimization
Improve performance through:
- Query optimization
- Database indexing
- Connection pooling
- Redis caching
- CDN
- Batch processing
- Asynchronous processing
- Compression
High Availability Strategy
flowchart TD
Users
Users --> LoadBalancer
LoadBalancer --> RegionA
LoadBalancer --> RegionB
RegionA --> DatabaseA
RegionB --> DatabaseB
Fault Tolerance
Use:
- Retry
- Timeout
- Circuit Breaker
- Bulkhead
- Rate Limiting
- Dead Letter Queue
These patterns prevent cascading failures across services.
Architecture Trade-offs
Every architectural decision involves compromises.
Monolith vs Microservices
| Monolith | Microservices |
|---|---|
| Simpler deployment | Independent deployment |
| Easier development | Better scalability |
| Single database | Independent databases |
| Difficult scaling | Independent scaling |
| Lower operational overhead | Higher operational complexity |
SQL vs NoSQL
| SQL | NoSQL |
|---|---|
| ACID transactions | Horizontal scalability |
| Strong consistency | Flexible schema |
| Ideal for ledgers | Ideal for logs, events, sessions |
Banking transactions typically rely on SQL databases, while NoSQL may be used for caching, logs, or analytics.
REST vs Messaging
| REST | Messaging |
|---|---|
| Immediate response | Asynchronous |
| Request/Response | Event-driven |
| Client waits | Loose coupling |
| Simpler debugging | Better scalability |
Synchronous vs Asynchronous
Use synchronous communication for:
- Authentication
- Balance checks
- Customer validation
Use asynchronous communication for:
- Notifications
- Reporting
- Analytics
- Fraud analysis
- Audit logging
Architecture Decision Records (ADR)
Documenting architectural decisions helps teams understand why specific technologies or patterns were chosen.
ADR-001
Decision
Use Microservices Architecture.
Reason:
Independent deployment and scalability.
ADR-002
Decision
Use Kafka for event streaming.
Reason:
Loose coupling and high throughput.
ADR-003
Decision
Use Redis for caching.
Reason:
Reduce database load and improve latency.
ADR-004
Decision
Use Saga Pattern.
Reason:
Manage distributed transactions without two-phase commit.
ADR-005
Decision
Use Kubernetes.
Reason:
Container orchestration, self-healing, and auto scaling.
Common Production Issues
| Issue | Solution |
|---|---|
| High CPU Usage | Horizontal Scaling |
| Slow Queries | Index Optimization |
| Duplicate Transactions | Idempotency |
| Kafka Consumer Lag | Increase Consumers |
| Memory Leaks | Heap Analysis |
| High Latency | Redis Cache |
| Pod Crashes | Restart & Investigation |
| Network Failure | Retry + Circuit Breaker |
| Database Failure | Failover |
| Region Failure | Disaster Recovery |
Production Readiness Checklist
| Item | Ready |
|---|---|
| Security Review | ✓ |
| API Validation | ✓ |
| Load Testing | ✓ |
| Disaster Recovery | ✓ |
| Monitoring | ✓ |
| Logging | ✓ |
| Alerts | ✓ |
| Auto Scaling | ✓ |
| Backup Strategy | ✓ |
| Rollback Plan | ✓ |
| Capacity Planning | ✓ |
| Compliance Review | ✓ |
Best Practices
- Design for failure, not perfection.
- Keep services loosely coupled.
- Make financial operations idempotent.
- Use immutable ledgers.
- Encrypt sensitive information.
- Implement centralized monitoring.
- Prefer event-driven communication for non-critical workflows.
- Test disaster recovery regularly.
- Document architecture decisions.
- Continuously monitor business metrics alongside technical metrics.
Common Mistakes
Using One Database for Every Service
Creates tight coupling and deployment challenges.
Ignoring Idempotency
Can result in duplicate financial transactions.
Storing Mutable Ledger Entries
Financial records should be immutable.
Missing Monitoring
Without observability, diagnosing production issues becomes difficult.
Not Planning for Failures
Assume services, databases, and networks will eventually fail and design accordingly.
Banking System Design Interview Questions
1. How would you design a core banking platform?
Use a microservices architecture with services for authentication, customers, accounts, transactions, ledger, fraud detection, notifications, and reporting. Ensure strong consistency for financial operations and event-driven communication for asynchronous workflows.
2. Why is the ledger considered the source of truth?
Because it stores immutable debit and credit entries that allow balances to be recalculated and audited.
3. Why use Double-Entry Accounting?
Every debit has a corresponding credit, ensuring accounting integrity and simplifying reconciliation.
4. Why should financial APIs be idempotent?
To prevent duplicate processing when clients retry requests due to network failures or timeouts.
5. How do you prevent duplicate money transfers?
Use idempotency keys, request validation, unique transaction identifiers, and transaction status checks.
6. How would you scale a banking platform?
Scale stateless services horizontally, partition messaging systems, add database read replicas, cache safe data, and use auto scaling.
7. How would you design a highly available banking platform?
Deploy multiple instances across multiple availability zones or regions, replicate databases, implement automatic failover, and continuously monitor system health.
8. Why use Kafka in banking systems?
Kafka enables reliable event-driven communication for notifications, reporting, fraud detection, and audit processing without tightly coupling services.
9. How do you secure banking APIs?
Use HTTPS, OAuth2, JWT, MFA, encryption at rest and in transit, rate limiting, RBAC, audit logging, and secret management.
10. Why avoid Two-Phase Commit in microservices?
It introduces blocking behavior, increases latency, reduces scalability, and complicates failure recovery. Saga-based orchestration is generally a better fit.
11. Explain CQRS in banking.
Separate write operations (commands) from read operations (queries) to optimize scalability and reporting without affecting transaction processing.
12. What should never be cached?
Sensitive financial data, pending transactions, authentication tokens, and immutable ledger records.
13. How do you handle regional outages?
Use active-active or active-passive deployments with replication, automated failover, and DNS-based traffic routing.
14. What metrics would you monitor?
API latency, throughput, error rate, transaction success rate, CPU, memory, Kafka lag, database performance, and business KPIs.
15. What are the biggest challenges in banking system design?
Maintaining consistency, ensuring security, achieving high availability, meeting compliance requirements, preventing fraud, and scaling without compromising reliability.
16. What is eventual consistency, and where is it acceptable?
It means data may not be immediately synchronized across systems. It is acceptable for notifications, reporting, analytics, and dashboards—but generally not for account balances or ledger updates.
17. Why use a separate Ledger Service?
To isolate financial accounting logic, maintain immutable records, simplify audits, and provide a single source of truth for reconciliation.
18. How would you design transaction reconciliation?
Compare transaction records, ledger entries, settlement files, and external payment confirmations. Detect mismatches and trigger reconciliation workflows.
19. How do you protect against fraud?
Use real-time risk scoring, anomaly detection, device fingerprinting, behavioral analysis, velocity checks, geolocation validation, and manual review for high-risk transactions.
20. What deployment strategy would you choose for banking applications?
Prefer rolling, blue-green, or canary deployments combined with automated testing, health checks, monitoring, and rollback capabilities.
21. How would you design audit logging?
Create immutable audit records with timestamps, user IDs, trace IDs, actions, and affected entities. Store logs securely with retention policies.
22. How do you handle transaction failures?
Rollback local operations where appropriate, execute Saga compensating actions, record failures, notify users, and preserve audit history.
23. Why separate synchronous and asynchronous communication?
Critical validation requires immediate responses, while notifications, reporting, and analytics benefit from asynchronous event processing.
24. How do you improve database performance?
Use indexing, partitioning, read replicas, optimized queries, connection pooling, and caching where appropriate.
25. How would you secure sensitive customer information?
Encrypt data at rest and in transit, implement least-privilege access, rotate secrets regularly, and avoid exposing sensitive information in logs.
26. How do you ensure disaster recovery readiness?
Test backups, simulate failovers, monitor replication, define RPO/RTO objectives, and regularly perform disaster recovery drills.
27. How would you reduce operational costs?
Use auto scaling, optimize storage tiers, archive historical data, right-size infrastructure, and improve application efficiency.
28. Why is observability important?
It enables engineers to detect issues quickly, troubleshoot distributed systems, understand system behavior, and reduce incident resolution time.
29. What are the key business KPIs?
Successful transfers, transaction volume, settlement completion, customer logins, fraud detection rate, failed payments, and account openings.
30. What is the most important principle in banking system design?
Protect financial integrity while ensuring security, reliability, compliance, scalability, and an excellent customer experience.
Banking System Design Cheat Sheet
| Area | Recommended Solution |
|---|---|
| Architecture | Microservices |
| API Style | REST + Event-Driven |
| Authentication | OAuth2 + JWT + MFA |
| Transactions | Saga Pattern |
| Consistency | Strong Consistency |
| Ledger | Double-Entry Accounting |
| Messaging | Kafka |
| Cache | Redis |
| Database | PostgreSQL / Oracle |
| Read Optimization | CQRS |
| Deployment | Kubernetes |
| Monitoring | Prometheus + Grafana |
| Logging | ELK / OpenSearch |
| Tracing | Jaeger / Zipkin |
| Security | TLS + Encryption + RBAC |
| Compliance | KYC, AML, PCI DSS |
| High Availability | Multi-Region |
| Disaster Recovery | Active-Active or Active-Passive |
| Scalability | Horizontal Scaling |
| Observability | Metrics + Logs + Traces |
Complete Banking System Architecture
flowchart TD
Customer
Customer --> Mobile
Customer --> Web
Mobile --> Gateway
Web --> Gateway
Gateway --> Auth
Gateway --> CustomerService
Gateway --> AccountService
Gateway --> TransactionService
TransactionService --> LedgerService
TransactionService --> Kafka
Kafka --> FraudService
Kafka --> NotificationService
Kafka --> ReportingService
AccountService --> PostgreSQL
LedgerService --> PostgreSQL
NotificationService --> Email
NotificationService --> SMS
Final Summary
Designing a modern banking platform requires much more than creating REST APIs and databases. Enterprise banking systems must guarantee financial accuracy, security, compliance, scalability, resilience, and operational excellence. Throughout this five-part case study, we progressed from understanding business requirements to designing high-level and low-level architectures, implementing distributed systems patterns such as CQRS and Saga, planning production deployments, and preparing for real-world operational challenges.
A successful banking architecture combines:
- Well-defined microservices
- Immutable double-entry ledgers
- Strong consistency for financial operations
- Event-driven communication
- Robust security and compliance
- High availability and disaster recovery
- Comprehensive observability
- Thoughtful architectural trade-offs
These principles not only help build production-ready banking platforms but also provide the depth expected in senior software engineering and solution architecture interviews.
Key Takeaways
- ✅ Start with business requirements before selecting technologies.
- ✅ Treat the ledger as the immutable financial source of truth.
- ✅ Use double-entry accounting for every financial transaction.
- ✅ Apply CQRS and Saga where they solve real architectural problems.
- ✅ Design APIs to be idempotent and secure.
- ✅ Use event-driven communication for asynchronous workflows.
- ✅ Build for observability with metrics, logs, and traces.
- ✅ Design for failures using retries, circuit breakers, and disaster recovery.
- ✅ Understand and communicate architectural trade-offs clearly.
- ✅ Always prioritize financial integrity, security, and regulatory compliance over convenience.
Next Case Study
➡️ 02-Insurance-System-Design.md