8000 GitHub - Sarthakverse/CentralBank: CentralBank is a production-style, cloud-native distributed banking platform built using Spring Boot and Spring Cloud. Β· GitHub
[go: up one dir, main page]

Skip to content

Sarthakverse/CentralBank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏦CentralBank Microservices Platform

Enterprise-Grade Distributed Banking Architecture
Built using Spring Boot β€’ Spring Cloud β€’ Eureka β€’ Gateway β€’ Docker β€’ Observability Stack



✨ Overview

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.


πŸ—System Architecture

Screenshot 2026-02-16 214022 This platform follows a layered cloud-native architecture:

The system is organized into layered architectural components:

πŸ”Ή Client Layer

  • External clients interact only with the API Gateway.

πŸ”Ή Platform Layer

  • Config Server
  • Eureka Server
  • Kafka
  • RabbitMQ

πŸ”Ή Business Services Layer

  • Accounts Service
  • Cards Service
  • Loans Service

πŸ”Ή Observability Layer

  • Prometheus
  • Loki
  • Tempo
  • Grafana
  • Alloy

🧠 C4 Container Architecture

image

This diagram illustrates system boundaries, container responsibilities, and inter-service relationships.


βš™ Microservices Overview

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

🏦 Accounts Service (Core Domain)

image

Handles:

  • Customer creation
  • Account creation
  • Publishing AccountCreateEvent
  • Composite customer details aggregation
  • Feign calls to Loans & Cards
  • DTO mapping
  • Exception handling
  • Transaction management
  • Audit support

Implements:

  • AccountsController
  • CustomerController
  • AccountsServiceImpl
  • KafkaTemplate publisher
  • Feign clients

Pattern Used: Layered Architecture + Event Publisher + API Composition


πŸ’³ Cards Service

Handles:

  • Card creation (event-driven)
  • Fetch / Update / Delete operations
  • Kafka consumer (account-created-topic)
  • Domain validation
  • Independent persistence

Implements:

  • CardsController
  • CardsServiceImpl
  • AccountEventListener

πŸ’° Loans Service

Handles:

  • Loan creation (event-driven)
  • Fetch / Update / Delete operations
  • Kafka consumer (account-created-topic)
  • Domain validation
  • Independent persistence

Implements:

  • LoansController
  • LoansServiceImpl
  • AccountEventListener

πŸ” Event-Driven Architecture

image

When a new account is created:

  1. Accounts Service saves Customer + Account.
  2. Publishes AccountCreateEvent.
  3. Kafka distributes event to:
    • Cards Service (creates credit card)
    • Loans Service (creates home loan)

Kafka consumer groups:

  • cards-group
  • loans-group

Pattern: Event-Driven Microservices (Fan-out)


🌐 Synchronous Aggregation Flow

image

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 Architecture

image

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.


πŸ“Š Observability Architecture

image

Implements the Three Pillars of Observability:

Metrics

Micrometer β†’ Prometheus β†’ Grafana

Logs

Application Logs β†’ Alloy β†’ Loki β†’ Grafana

Traces

OpenTelemetry β†’ Tempo β†’ Grafana

Provides:

  • Distributed tracing
  • Performance monitoring
  • Centralized log aggregation
  • Production diagnostics capability

🐳 Docker Deployment Architecture

image

Deployment includes:

  • Containerized microservices
  • Central bridge network
  • Health checks & dependency sequencing
  • Kafka cluster (Zookeeper + Broker)
  • Observability stack
  • Profile-based environment segregation (default / qa / prod)

πŸš€ Running the System (Docker)

Navigate to: docker-compose/default Start services: docker compose up -d

Startup Order:

  1. RabbitMQ
  2. Config Server
  3. Eureka Server
  4. Kafka + Zookeeper
  5. Business Services
  6. Gateway
  7. Observability Stack

πŸ”Ž Access Points

Component URL
Gateway http://localhost:8081
Eureka Dashboard http://localhost:8072
Config Server http://localhost:8071
Grafana http://localhost:3000
Keycloak http://localhost:8180

πŸ“‚ Project Structure

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

🧠 Architectural Patterns Implemented

  • 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

🎯 Production-Grade Capabilities

βœ” Stateless services
βœ” Independent scaling
βœ” Fault isolation
βœ” Event-based decoupling
βœ” Full telemetry pipeline
βœ” Health probes
βœ” Profile-based configuration
βœ” Dockerized deployment


πŸ‘¨β€πŸ’» Author

Sarthak Rastogi

Designed and engineered as a production-style distributed banking architecture to demonstrate advanced system design, cloud-native architecture, and enterprise microservices patterns.


Engineered with precision. Designed for scale. Built for production.

About

CentralBank is a production-style, cloud-native distributed banking platform built using Spring Boot and Spring Cloud.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

0