How phuocphan13/microservices works
Main Components
• API Gateways: There are at least two API gateway projects – “OcelotApiGw” and “Shopping.Aggregator” – that centrally route requests to internal services.
• Microservices: Under the “Services” folder, you have multiple domain-specific services:
– Basket Service (Services/Basket/Basket.API)
– Catalog Service (Services/Catalog/Catalog.API)
– Discount Service (Services/Discount/Discount.API and the associated gRPC service)
– Logging Service (Services/Logging/Logging.Api)
– Ordering Service (Services/Ordering/Ordering.API along with application, domain and infrastructure layers)
• Identity Service: Found under the “Identity” directory, providing authentication, token management, roles, and permissions.
• Common Libraries: Modules like “Common”, “EventBus.Messages”, “Common/Platform”, and “Common/Worker” encapsulate shared functionalities (e.g., API client code, integration framework, OpenTelemetry, worker jobs) to support cross-service needs.
• Frontend Client: The “WebApps/AngularClient” indicates an Angular-based client application that interacts with the backend services.
• Configuration & Deployment: Docker files, docker-compose files, and configuration files under “Configs” and “config” directories drive deployment and environment configuration.
• Messaging: The “EventBus.Messages” folder and related gRPC projects under Discount indicate an internal eventing system to enable service-to-service communication using messaging, including state machines for logging and order processing.
Relationships and Interactions
• The API gateways (Ocelot and Shopping Aggregator) serve as a single entry point for clients by forwarding requests to appropriate microservices.
• Each microservice exposes REST or gRPC endpoints used for business operations (e.g., basket management, catalog querying, discount processing, and order placement).
• The Identity service is central to securing these communication paths (with token generation, role and permission management).
• Shared “Common” libraries support cross-cutting concerns such as API client call abstractions, logging, messaging integration, unit-of-work, and more.
• The Angular Client communicates with the API gateways (and possibly directly with some services) to provide a GUI for the ecommerce functionalities.
Architectural Patterns and Design Principles
• Microservices Architecture: Each bounded context—basket, catalog, discount, logging, ordering, identity—resides in its own service, supporting independent development and deployment.
• Event-Driven Communication: The event bus components, state machines, and gRPC integrations are used for decoupled, asynchronous interactions.
• Shared Libraries: Common functionality (such as API clients, configuration options, logging, and database access) is centralized in shared libraries that all microservices interact with.
Final Recommendations to the Principal Software Engineer
• Shared libraries and message/event bus architecture that bridges different microservices, highlighting its role in decoupling and asynchronous communications.
• Cross-cutting concerns like authentication (integrating the Identity service), logging (Logging.Api along with events and state machines), and monitoring infrastructure (reflecting the configs for Grafana, Jaeger, Prometheus which are in the configuration folders).
• Remember that the goal is to be as detailed as necessary so that any stakeholder can understand the major components, their interactions, and how the system operates both at a high-level and in key subsystems.