Enterprise-Grade Distributed Banking Architecture
Built using Spring Boot β’ Spring Cloud β’ Eureka β’ Gateway β’ Docker β’ Observability Stack
CentralBank is a production-style, cloud-native distributed banking platform built using Spring Boot and Spring Cloud.
The system simulates a real-world banking ecosystem using:
- Event-Driven Architecture (Kafka)
- API Gateway Pattern
- Service Discovery (Eureka)
- Centralized Configuration (Config Server)
- OAuth2 Security (Keycloak + JWT)
- Distributed Tracing (OpenTelemetry + Tempo)
- Metrics Monitoring (Prometheus)
- Centralized Logging (Loki)
- Dockerized Multi-Service Deployment
This project demonstrates enterprise-grade system design principles, not just CRUD microservices.
This platform follows a layered cloud-native architecture:
The system is organized into layered architectural components:
- External clients interact only with the API Gateway.
- Config Server
- Eureka Server
- Kafka
- RabbitMQ
- Accounts Service
- Cards Service
- Loans Service
- Prometheus
- Loki
- Tempo
- Grafana
- Alloy
This diagram illustrates system boundaries, container responsibilities, and inter-service relationships.
| Service | Port | Responsibility |
|---|---|---|
| Config Server | 8071 | Centralized configuration management |
| Eureka Server | 8072 | Service registry & discovery |
| Gateway Server | 8081 | API routing, security enforcement |
| Accounts Service | 8080 | Customer & Account domain |
| Loans Service | 8090 | Loan domain |
| Cards Service | 9000 | Card domain |
| Kafka | 9092 | Event streaming |
| Keycloak | 8180 | OAuth2 Identity Provider |
Handles:
- Customer creation
- Account creation
- Publishing
AccountCreateEvent - Composite customer details aggregation
- Feign calls to Loans & Cards
- DTO mapping
- Transaction management
- Audit support
Implements:
- AccountsController
- CustomerController
- AccountsServiceImpl
- KafkaTemplate publisher
- Feign clients
Pattern Used: Layered Architecture + Event Publisher + API Composition
Handles:
- Card creation (event-driven)
- Fetch / Update / Delete operations
- Kafka consumer (
account-created-topic) - Domain validation
- Independent persistence
Implements:
- CardsController
- CardsServiceImpl
- AccountEventListener
Handles:
- Loan creation (event-driven)
- Fetch / Update / Delete operations
- Kafka consumer (
account-created-topic) - Domain validation
- Independent persistence
Implements:
- LoansController
- LoansServiceImpl
- AccountEventListener
When a new account is created:
- Accounts Service saves Customer + Account.
- Publishes
AccountCreateEvent. - Kafka distributes event to:
- Cards Service (creates credit card)
- Loans Service (creates home loan)
Kafka consumer groups:
cards-grouploans-group
Pattern: Event-Driven Microservices (Fan-out)
Accounts Service acts as an API Composition layer.
Flow: Client β Gateway β Accounts β (Feign) β Cards & Loans β Aggregated Response
Patterns Used:
- API Composition
- Client-side Load Balancing
- Service Discovery via Eureka
Security Model:
- OAuth2 Authorization Server β Keycloak
- Gateway acts as Resource Server
- JWT validation via issuer-uri
- Stateless authentication
- Zero-trust internal communication
Only Gateway is exposed externally.
Implements the Three Pillars of Observability:
Micrometer β Prometheus β Grafana
Application Logs β Alloy β Loki β Grafana
OpenTelemetry β Tempo β Grafana
Provides:
- Distributed tracing
- Performance monitoring
- Centralized log aggregation
- Production diagnostics capability
Deployment includes:
- Containerized microservices
- Central bridge network
- Health checks & dependency sequencing
- Kafka cluster (Zookeeper + Broker)
- Observability stack
- Profile-based environment segregation (default / qa / prod)
Navigate to: docker-compose/default Start services: docker compose up -d
Startup Order:
- RabbitMQ
- Config Server
- Eureka Server
- Kafka + Zookeeper
- Business Services
- Gateway
- Observability Stack
| Component | URL |
|---|---|
| Gateway | http://localhost:8081 |
| Eureka Dashboard | http://localhost:8072 |
| Config Server | http://localhost:8071 |
| Grafana | http://localhost:3000 |
| Keycloak | http://localhost:8180 |
sarthakverse-centralbank/ βββ Accounts/ βββ Cards/ βββ Loan/ βββ configServer/ βββ eurekaServer/ βββ gatewayserver/ βββ docker-compose/
Each microservice follows clean layered architecture:
- controller
- service
- repository
- dto
- entity
- mapper
- exception
- config
- audit
- Microservices Architecture
- Event-Driven Architecture
- API Gateway Pattern
- Service Registry Pattern
- Database per Service Pattern
- Centralized Configuration Pattern
- OAuth2 Security Pattern
- Distributed Tracing Pattern
- Observability Pattern
- Containerized Deployment Strategy
β Stateless services
β Independent scaling
β Fault isolation
β Event-based decoupling
β Full telemetry pipeline
β Health probes
β Profile-based configuration
β Dockerized deployment
Sarthak Rastogi
Designed and engineered as a production-style distributed banking architecture to demonstrate advanced system design, cloud-native architecture, and enterprise microservices patterns.