How sametkayik/ecommerce-microservices works
Main Components to be Represented
• API Gateway – This is the first point of entry and routes incoming requests (using Ocelot) to the appropriate microservices. It is represented under the directory "APIGateway" and includes its configuration file (ocelot.json).
• Product API – Managed in the Ecommerce.Services.ProductAPI folder. It handles product management (CRUD operations, mapping, migrations, etc.). Indicate its repository layer and DbContexts.
• Coupon API – Located in Ecommerce.Services.CouponAPI. This service manages discount/coupon operations, with dedicated controller, models, and repositories.
• Cart API – Found in Ecommerce.Services.CartAPI with its controllers, DbContexts, repositories, message bus integration (RabbitMQ via the RabbitMQSender), and mapping definitions.
• Identity Service – The Ecommerce.Services.Identity manages all user authentication and authorization tasks. It includes controllers and views for account management, identity initialization, and even configuration for issuing tokens.
• Chat Service – Offered by Ecommerce.Services.Chat, this uses SignalR (as mentioned in the README) to support real-time chat functionality.
• Web Service – This MVC-based frontend service (Ecommerce.Web) interacts with all backend services and provides the user interface for both admin and customer functionalities.
• Message Bus – The Ecommerce.MessageBus library encapsulates the messaging infrastructure that services like the Cart API use to publish events (and likely listen for responses).
• Databases – Although not explicitly shown as separate services, each microservice with a “DbContexts” folder or migrations (e.g., Product, Coupon, Identity, Cart) indicates its own persistence layer (MSSQL as per the README).
Relationships and Data Flow
• The external clients or the dedicated frontend send requests first to the API Gateway.
• API Gateway then communicates with various microservices based on defined routing rules.
• The Cart API publishes messages or interacts with the Message Bus to facilitate event-driven communication (e.g., for checkout processing).
• The Identity Service handles user login/registration and token issuance, likely interfaced with other services for secured resource access.
• The MVC Web Service calls the backend APIs (directly or via the gateway) to retrieve and display information.
• Each microservice interacts with its own MSSQL database for persistent storage.
• Real-time interactions may be represented specifically in the Chat Service through SignalR.
Architectural Patterns and Design Principles
• Microservices Architecture – Each service is decoupled and responsible for its own domain.
• API Gateway Pattern – A central API Gateway (using Ocelot) abstracts the microservice endpoints.
• Event-Driven Architecture – Communication via a message bus (RabbitMQ) facilitates asynchronous operations (e.g., within Cart API).
• MVC for the Web Service – The frontend separates concerns with Controllers, Views, and Models.
Technological and Deployment Details to Highlight
• .NET 8 is the foundation of all services.
• Dockerfiles in each service indicate containerized deployments, and the docker-compose.yml at the root orchestrates the containers.
• Use of Ocelot in the API Gateway is key to routing and centralized request management.
• SignalR is critical for the Chat Service’s real-time capabilities.
• MSSQL databases are used across services.
• RabbitMQ integration for service messaging (especially in the Cart API, as seen in the RabbitMQSender directory).