How stefanycos/spring-boot-microservices works
Main Components
• API-Gateway – Serves as a centralized access point. It is implemented with Netflix Zuul, and it routes incoming requests to the respective microservices after retrieving available services from Service Discovery.
• Service-Discovery – Implemented with Netflix Eureka. This service manages and registers the instances of all the microservices, enabling dynamic discovery.
• Auth-Server – Handles user authentication, token issuance (via Spring OAuth2), and user/client registration. This service secures the ecosystem.
• AWS-S3-Service – Manages all communication with Amazon S3 for file operations. It includes controllers, exception handling, and S3 configuration.
• Product-Service – Manages products and their associated images. It uses fault tolerance patterns (via Netflix Hystrix) and integrates with the AWS-S3-Service for image handling. The service also leverages MongoDB for data storage.
• External Clients – Represented by end users, mobile apps, or integrated systems (such as the provided Postman Collection) that make API calls to the system.
Relationships and Interactions
• External Clients → API-Gateway: All external incoming requests pass through the API Gateway.
• API-Gateway → Service-Discovery: The gateway dynamically fetches the list of active services from the Service Discovery.
• API-Gateway → Auth-Server, Product-Service, AWS-S3-Service: Once discovered, the API Gateway routes requests accordingly.
• Auth-Server ↔ Other Microservices: Other services (like Product-Service) may communicate with the Auth-Server to validate access tokens and retrieve user roles/permissions.
• Product-Service → AWS-S3-Service: The Product-Service communicates with the S3-Service to manage product images.
• Product-Service → MongoDB (implicit): Although not shown explicitly in the file tree, MongoDB is mentioned in the README as the datastore for product information.
Architectural Patterns and Design Principles
• Microservices Architecture: Each service is independently deployable with its own Maven build (as seen in the separate directories and Maven wrapper files) and has a clear separation of concerns.
• API Gateway and Service Discovery patterns: The use of Zuul and Eureka demonstrates standard patterns to manage request routing and dynamic service registration.
• Fault Tolerance: Netflix Hystrix is integrated into the Product-Service to provide fallback methods and ensure resilience.
• Security: The Auth-Server uses Spring Security and OAuth2 to secure the ecosystem.
• Configuration and Environment Separation: Each service has its dedicated application.yml for configuration, underscoring the microservices principle of independent configuration management.
Relevant Technologies, Frameworks, and Libraries
• Spring Boot (the backbone framework for all services).
• Netflix OSS:
– Zuul for API Gateway.
– Eureka for Service Discovery.
– Hystrix for circuit breaker/fault tolerance (in Product-Service).
• Spring Security & Spring OAuth2 (in Auth-Server).
• Amazon S3 and AWS SDK (in AWS-S3-Service).
• MongoDB (for data storage in Product-Service).
Elements
• Clear labels for each component (API-Gateway, Service-Discovery, Auth-Server, AWS-S3-Service, Product-Service, and External Clients).