How brodygaudel/bank works
1. This repository is a microservices monorepo. Each service is a separate Spring Boot application with its own Maven build, tests, and runtime configuration, so the architecture is deployment-unit oriented rather than a single shared application.
2. The edge layer is split into a discovery service and a reactive gateway. The discovery service is a Eureka registry; the gateway is the public entry point that routes requests to downstream services by service name, letting clients avoid talking to services directly.
3. The authentication service owns user identity and authorization. It models users, roles, and verification records, exposes REST endpoints for login and account/password management, and uses JWT-based security. Other services share the same JWT validation pattern through their own security filters/configs.
4. The customer service is a conventional CRUD service for customer master data. It persists a Customer entity through JPA, exposes REST endpoints, enforces domain validation such as minimum age, and returns DTOs for create/read flows. Other services consult it for customer existence and profile-related checks.
5. The account service is the most architecturally specialized part of the system. It implements CQRS and event sourcing with Axon Framework: command handling is separated from query handling, and account changes are emitted as domain events instead of being written directly to a single mutable model.
6. Inside the account service, the command side centers on an AccountAggregate plus command objects for create, activate, suspend, credit, debit, delete, and transfer. Commands pass through validation/interception, then the aggregate produces events such as AccountCreatedEvent or AccountDebitedEvent.
7. The account service query side builds a separate read model. Event handlers project account and operation events into JPA entities and repositories, and query handlers serve read requests from these materialized views. This means writes and reads are intentionally decoupled and can evolve independently.
8. Service-to-service communication is synchronous and client-based. The account and authentication services include REST clients for customer and notification interactions, so flows like “validate customer”, “send notification”, or “check account state” cross service boundaries through HTTP rather than shared database access.
9. The notification service is a dedicated outbound communication service. It accepts notification requests, renders email content using an HTML template, and centralizes messaging concerns so business services do not embed mail delivery logic.
10. Data ownership is service-scoped. Authentication manages users/roles/verifications, customer manages customers, account maintains both event-sourced command state and read-side projections, and notification is focused on delivery. Axon Server must be up first for the account service, while Docker support and the root Maven build indicate the repo is designed for containerized, independently runnable services.
Main entry points: pom.xml Root build · GatewayServiceApplication.java Gateway · DiscoveryServiceApplication.java Discovery · AuthenticationServiceApplication.java Auth service
Components 19
Platform
Cross-cutting runtime and composition pieces
- Root build · Top-level multi-service Maven build and repo composition
pom.xml
Edge
Discovery and public entry points
- Discovery · Service registry for runtime discovery
discovery-service/src/main/java/org/mounanga/discoveryservice/DiscoveryServiceApplication.java - Gateway · Public entry point that routes to downstream services by service name
gateway-service/src/main/java/org/mounanga/gatewayservice/GatewayServiceApplication.java
Business services
Domain services with their own data and APIs
- Auth service · Identity, roles, verification, login, and password management
authentication-service/src/main/java/org/mounanga/authenticationservice/AuthenticationServiceApplication.java - Customer service · Customer master data with validation and DTO-based REST access
customer-service/src/main/java/org/mounanga/customerservice/CustomerServiceApplication.java - Account service · Account management with Axon command and query separation
account-service/src/main/java/org/mounanga/accountservice/AccountServiceApplication.java - Notification · Outbound messaging and email rendering
notification-service/src/main/java/org/mounanga/notificationservice/NotificationServiceApplication.java - JWT security · JWT authorization and security configuration
authentication-service/src/main/java/org/mounanga/authenticationservice/security/SecurityConfiguration.java - Identity model · Users, roles, and verification records
authentication-service/src/main/java/org/mounanga/authenticationservice/entity/User.java - Auth API · Login, user, role, and password endpoints
authentication-service/src/main/java/org/mounanga/authenticationservice/web/AuthenticationRestController.java - Customer core · Customer entity, validation, repository, and service layer
customer-service/src/main/java/org/mounanga/customerservice/service/implementation/CustomerServiceImpl.java - Customer API · Customer REST endpoints and DTO flow
customer-service/src/main/java/org/mounanga/customerservice/web/CustomerRestController.java - Notify core · Notification rendering and delivery implementation
notification-service/src/main/java/org/mounanga/notificationservice/service/implementation/NotificationServiceImpl.java - Notify API · Notification request endpoint
notification-service/src/main/java/org/mounanga/notificationservice/web/NotificationRestController.java
Account internals
CQRS/event-sourced account service structure
- Command side · Aggregates, commands, validation, and event emission
account-service/src/main/java/org/mounanga/accountservice/commands/aggregate/AccountAggregate.java - Query side · Event projections, repositories, and query handlers for materialized views
account-service/src/main/java/org/mounanga/accountservice/queries/service/AccountQueryHandlerService.java - Account events · Event stream shared by projections and downstream effects
account-service/src/main/java/org/mounanga/accountservice/common/event/AccountCreatedEvent.java - Account API · Command and query HTTP entry points
account-service/src/main/java/org/mounanga/accountservice/commands/web/AccountCommandRestController.java - Service clients · Customer and notification REST clients used across flows
account-service/src/main/java/org/mounanga/accountservice/commands/web/CustomerRestClient.java
Connections 30
- Root build → Discovery: includes · Root build composes the discovery service
- Root build → Gateway: includes · Root build composes the gateway service
- Root build → Auth service: includes · Root build composes the authentication service
- Root build → Customer service: includes · Root build composes the customer service
- Root build → Account service: includes · Root build composes the account service
- Root build → Notification: includes · Root build composes the notification service
- Gateway → Discovery: registers via · Gateway relies on service discovery for routing
- Auth service → Discovery: registers via · Auth service is discoverable through Eureka
- Customer service → Discovery: registers via · Customer service is discoverable through Eureka
- Account service → Discovery: registers via · Account service is discoverable through Eureka
- Notification → Discovery: registers via · Notification service is discoverable through Eureka
- Gateway → Auth API: routes to · Gateway exposes auth-related public traffic
- Gateway → Customer API: routes to · Gateway exposes customer traffic
- Gateway → Account API: routes to · Gateway exposes account traffic
- Gateway → Notify API: routes to · Gateway exposes notification traffic
- Auth API → JWT security: protected by · Authentication endpoints use JWT security
- Auth service → Identity model: owns · Auth service owns user, role, and verification data
- Customer API → Customer core: serves · Customer REST layer delegates to CRUD domain logic
- Account API → Command side: writes · Command endpoints dispatch account mutations
- Account API → Query side: reads · Query endpoints serve materialized views
- Command side → Account events: emits · Commands produce domain events instead of direct writes
- Account events → Query side: projects into · Events update read-side projections
- Command side → Service clients: calls · Command flows validate customers and other external state
- Query side → Service clients: calls · Read-side flows can notify or integrate externally
- Service clients → Customer service: checks · Account service consults customer existence and profile state
- Service clients → Notification: notifies · Account service sends outbound notifications through HTTP
- Auth service → Notification: notifies · Authentication flows can trigger outbound messaging
- Notify API → Notify core: delegates to · Notification controller delegates to delivery logic
- Customer service → JWT security: shares pattern · Customer service uses the same JWT-style security boundary
- Account service → JWT security: shares pattern · Account service uses JWT authorization filtering