How amigoscode/microservices works
1. This repository is a Spring Boot microservices system split into multiple independently deployable services plus shared support modules. The main runtime services are customer, fraud, notification, apigw, and eureka-server.
2. The request entry point is the API gateway (apigw). It sits in front of the services and is the likely external HTTP boundary for clients. It routes requests onward rather than hosting business logic itself.
3. Service discovery is handled by eureka-server. The individual services are designed to register there and discover one another dynamically, which is important because the deployment targets include Docker and Kubernetes where service locations are not fixed.
4. The customer service is the core business workflow service. It contains a REST controller, service layer, repository, and domain model for customer registration. This is the most likely orchestration point for the customer onboarding flow.
5. The fraud service is a separate domain service with its own controller, service, entity, and repository for fraud check history. The clients module includes a FraudClient and FraudCheckResponse, indicating the customer service calls fraud synchronously through a generated client interface rather than embedding fraud logic locally.
6. The notification service is another isolated domain service with its own persistence and REST controller, but it also contains rabbitmq/NotificationConsumer, which shows it consumes async messages from RabbitMQ. This suggests notifications are handled asynchronously after customer-related events rather than inline with the request.
7. RabbitMQ is the asynchronous integration backbone. The shared amqp module provides RabbitMQConfig and RabbitMQMessageProducer, so message publication is centralized and reused. The notification service consumes those messages, forming the main event-driven path in the system.
8. The clients module is a shared contract layer. It packages the HTTP client interfaces and DTOs for cross-service calls, specifically fraud and notification requests/responses. This reduces duplication and keeps service-to-service APIs consistent.
9. Persistence is service-owned and not shared as a single database layer. customer, fraud, and notification each define their own repository and domain objects, which fits the microservice pattern of data ownership per service. The Kubernetes bootstrap files also include PostgreSQL manifests, so at least one shared or service-backed Postgres instance is part of the deployment topology.
10. Observability and infrastructure are first-class parts of the repo. There are Kubernetes bootstrap manifests for PostgreSQL, RabbitMQ, and Zipkin under k8s/minikube/bootstrap, which indicates local cluster setup includes the database, messaging broker, and distributed tracing backend.
11. Deployment is supported in two modes: Docker and Kubernetes. Each service has environment-specific configuration files such as application-docker.yml and application-kube.yml, and the repository includes docker-compose.yml plus Minikube manifests for both platform bootstrapping and individual service deployments.
12. The overall data flow is: external client -> API gateway -> customer service; customer service may call fraud synchronously through clients; domain events are published to RabbitMQ through amqp; notification service consumes those events and stores/handles notifications; Eureka supports discovery across these calls. The architecture is therefore a hybrid of synchronous request/response and asynchronous event-driven messaging.
Main entry points: docker-compose.yml Docker/K8s · CustomerService.java Customer flow · EurekaServerApplication.java Eureka server · statefulset.yml PostgreSQL
Components 20
Runtime services
Deployable Spring Boot services and shared runtime modules
- API gateway · External HTTP entry point and request router
apigw/src/main/java/com/amigoscode/apigw/ApiGWApplication.java - Eureka server · Service registration and lookup for the microservices
eureka-server/src/main/java/com/amigoscode/eurekaserver/EurekaServerApplication.java - Customer svc · Customer onboarding and orchestration flow
customer/src/main/java/com/amigoscode/customer/CustomerApplication.java - Customer API · Handles customer registration requests
customer/src/main/java/com/amigoscode/customer/CustomerController.java - Customer flow · Coordinates registration, fraud check, and persistence
customer/src/main/java/com/amigoscode/customer/CustomerService.java - Customer data · Customer entity and persistence boundary
customer/src/main/java/com/amigoscode/customer/CustomerRepository.java - Fraud svc · Fraud check history and validation service
fraud/src/main/java/com/amigoscode/fraud/FraudApplication.java - Fraud API · Fraud check endpoint
fraud/src/main/java/com/amigoscode/fraud/FraudController.java - Fraud logic · Fraud check evaluation and history writes
fraud/src/main/java/com/amigoscode/fraud/FraudCheckService.java - Fraud data · Fraud check history persistence
fraud/src/main/java/com/amigoscode/fraud/FraudCheckHistoryRepository.java - Notification svc · Notification persistence and message consumption
notification/src/main/java/com/amigoscode/notification/NotificationApplication.java - Notification API · Notification retrieval or management endpoint
notification/src/main/java/com/amigoscode/notification/NotificationController.java - Rabbit consumer · Consumes events from RabbitMQ
notification/src/main/java/com/amigoscode/notification/rabbitmq/NotificationConsumer.java - Notification data · Notification entity and persistence boundary
notification/src/main/java/com/amigoscode/notification/NotificationRepository.java
Infrastructure
Platform services and local deployment environment
- PostgreSQL · Bootstrap database infrastructure for service persistence
k8s/minikube/bootstrap/postgres/statefulset.yml - RabbitMQ · Asynchronous event backbone for notifications
k8s/minikube/bootstrap/rabbitmq/statefulset.yaml - Zipkin · Distributed tracing backend in local cluster setup
k8s/minikube/bootstrap/zipkin/statefulset.yml - Docker/K8s · Service and bootstrap manifests plus docker-compose support
docker-compose.yml
Shared contracts
Cross-service HTTP clients and messaging support
- Client contracts · Feign-style clients and DTOs for fraud and notification calls
clients/src/main/java/com/amigoscode/clients - AMQP support · RabbitMQ configuration and producer utilities
amqp/src/main/java/com/amigoscode/amqp/RabbitMQConfig.java
Connections 26
- API gateway → Customer svc: routes to · External requests are forwarded to customer service
- Customer svc → Eureka server: registers · Customer service participates in discovery
- Fraud svc → Eureka server: registers · Fraud service participates in discovery
- Notification svc → Eureka server: registers · Notification service participates in discovery
- Customer API → Customer flow: delegates · REST layer hands off to orchestration logic
- Customer flow → Customer data: persists · Customer workflow stores domain state
- Customer flow → Client contracts: calls fraud · Uses shared client contracts for synchronous fraud checks
- Client contracts → Fraud svc: invokes · Fraud client targets the fraud service
- Fraud API → Fraud logic: delegates · Fraud REST layer hands off to logic
- Fraud logic → Fraud data: persists · Fraud service stores check history
- Notification svc → Notification API: hosts · Notification service exposes its API
- Rabbit consumer → RabbitMQ: consumes from · Notification events are received from the broker
- Customer flow → AMQP support: publishes · Customer flow emits events through shared AMQP support
- AMQP support → RabbitMQ: sends to · Producer support targets the broker
- Rabbit consumer → Notification data: writes · Consumed events become stored notifications
- Customer data → PostgreSQL: stores in · Customer persistence uses PostgreSQL
- Fraud data → PostgreSQL: stores in · Fraud persistence uses PostgreSQL
- Notification data → PostgreSQL: stores in · Notification persistence uses PostgreSQL
- Customer svc → Docker/K8s: deployed via · Customer service has Docker/Kubernetes deployment support
- Fraud svc → Docker/K8s: deployed via · Fraud service has Docker/Kubernetes deployment support
- Notification svc → Docker/K8s: deployed via · Notification service has Docker/Kubernetes deployment support
- API gateway → Docker/K8s: deployed via · API gateway is configured for Docker/Kubernetes deployment
- Eureka server → Docker/K8s: deployed via · Discovery server is configured for deployment
- Docker/K8s → RabbitMQ: boots · Cluster bootstrap includes RabbitMQ
- Docker/K8s → PostgreSQL: boots · Cluster bootstrap includes PostgreSQL
- Docker/K8s → Zipkin: boots · Cluster bootstrap includes Zipkin