How firas-b/microservices-full-code works
Project type and purpose
• This is a Spring-Boot-based, cloud-native microservices e-commerce learning project.
• It uses Spring Cloud Config (config-server), Eureka discovery (discovery-service), API gateway (gateway-service), and a set of domain-specific microservices: customer, product, order, payment, notification.
File structure
• Top‐level folders:
• services/ : each subfolder is one Spring Boot microservice
• docker-compose.yml : orchestration of services plus dependencies
• resources/ : business/distributed patterns docs
• Each service has standard Maven layout, application.yml, tests.
• product-service uniquely includes Flyway migrations (db/migration).
• order and payment services include Kafka producer/consumer configs.
• notification service consumes Kafka events and sends emails.
README
• Confirms it is a “Spring boot microservice for learning”.
• No further architecture docs—so we infer interactions from code and files.
Main components & interactions
a. Config Server
• Centralized configuration: serves service-specific YAMLs
b. Service Registry (Discovery)
• Eureka for service registration & discovery
c. API Gateway
• Single entry point; routes incoming HTTP requests to domain services
d. Domain Microservices
• Customer Service – CRUD on customers
• Product Service – CRUD on products, backs onto a relational DB (Flyway migrations)
• Order Service – orchestrates order creation, calls Customer & Product via REST, publishes OrderConfirmation to Kafka
• Payment Service – processes payments, calls Order (or stub), publishes PaymentConfirmation to Kafka
• Notification Service – consumes Kafka topics for orders & payments, persists Notification entities, sends emails via templates
e. Messaging Infrastructure
• Kafka cluster or broker, topics: orders, payments
f. Databases
• Product Service DB (SQL via Flyway)
• Others may use in-memory H2 or external DB instances for persistence
g. External Email SMTP
• Used by Notification Service to send transactional emails
Architectural patterns & principles
• Microservices pattern: each bounded context is a separate deployable
• Centralized configuration via Spring Cloud Config
• Service discovery via Eureka
• API Gateway pattern for cross-cutting concerns (routing, security, rate-limit)
• Asynchronous communication via Kafka for decoupling order/payment/notification
• Database per service (product service shown)
• Resilience & fault handling via global exception handlers