How zoltanvin/royal-reserve-bank works
Project Type and Purpose
• This is a Spring Boot – Spring Cloud microservices banking solution.
• Goal: support account management, transactions, asset queries, notifications – all coordinated via an API Gateway, with centralized config, service discovery, monitoring, tracing, caching, event-driven messaging, and containerization.
File Structure
• Top-level modules:
– api-gateway
– account-api
– transaction-api
– asset-management-api
– notification-api
– config-server
– discovery-server
• Infrastructure files:
– docker-compose.yml / docker-compose-infrastructure-services.yml
– config-files for each service
– postman/ for manual testing
– docs/javadoc for API reference
• Each microservice follows a Spring Boot Maven layout (src/main/java, src/main/resources, src/test).
Extract Key Architecture from README
• High-level architecture: microservices + API Gateway + Config Server + Discovery Server + databases + Kafka + Redis + Zipkin + Prometheus + Grafana.
• Patterns in use: Service Discovery (Eureka), Centralized Config (Config Server), Distributed Tracing (Zipkin), Event-Driven (Kafka), DB per Service, Cache-Aside (Redis/Spring Cache), Circuit Breaker (Resilience4J), Security (Auth0 via Gateway), Containerization (Docker).
a. Components
1. Clients
– Web/Mobile/App or Postman (external actors)
2. API Gateway
– Entry point, handles Auth0 authentication/authorization
3. Service Discovery (Eureka Discovery Server)
4. Centralized Configuration (Spring Cloud Config Server)
5. Microservices (all Spring Boot apps)
– Account API (MongoDB + Redis cache)
– Transaction API (PostgreSQL + Spring Cache + Resilience4J circuit breaker)
– Asset Management API (MySQL + Spring Cache)
– Notification API (stateless, consumes Kafka events)
6. External Systems
– MongoDB, PostgreSQL, MySQL
– Redis
– Apache Kafka cluster
– Zipkin tracing server
– Prometheus & Grafana for metrics & dashboards
7. Infrastructure
– Docker / Docker Compose orchestration
b. Relationships & Data Flows
1. Client → API Gateway (HTTPS, JWT via Auth0)
2. API Gateway ↔ Eureka for service lookup
3. API Gateway → Individual Microservices (load-balanced via Eureka)
4. Microservices at startup → Config Server (HTTP) to fetch their config
5. Account API reads/writes → MongoDB; caches reads in Redis
6. Transaction API:
– On transaction request: synchronously calls Account API & Asset API (via WebClient)
– Records transaction → PostgreSQL; caches data (Spring Cache); protects calls with Resilience4J
7. Asset Management API reads/writes → MySQL; caches data
8. Notification API: subscribes to Kafka topic “transaction-events”; processes messages → sends email/SMS
9. All services send trace spans → Zipkin
10. Prometheus scrapes metrics from all services → Grafana dashboards
c. Architectural Patterns Highlighted
• Service Discovery – dynamic service resolution via Eureka
• Centralized Config – externalized, environment-specific properties via Config Server
• Event-Driven – decoupled notifications via Kafka pub/sub
• Database per Microservice – independent schemas & scaling
• Cache-Aside – Redis (Account API) + Spring Cache (Transaction/Asset APIs)
• Circuit Breaker – Resilience4J wrapping inter-service calls in Transaction API
• Distributed Tracing – Zipkin instrumentation of each service
• Security – JWT tokens at API Gateway (Auth0)
• Containerization – Docker images & Compose orchestration
d. Technologies & Frameworks
• Java 17, Spring Boot, Spring Cloud (Config, Netflix Eureka)
• Spring Data (MongoDB, JPA for PostgreSQL/MySQL)
• Redis, Kafka, Zipkin, Prometheus, Grafana
• Resilience4J, Spring Cache, Auth0
• Docker, Docker Compose
Final Advice
– Start by sketching the high-level view: client, gateway, core services, infra.
– Drill down on each microservice’s dependencies: DB, cache, event bus, other APIs.
– Emphasize architectural patterns by grouping components (e.g., Eureka + Config grouped under “Spring Cloud Core”).
– Iterate with stakeholders to ensure accuracy and completeness.