How chandan7dec/mangomicroservice works
Main Components
• API Gateway: Represented by Mango.GatewaySolution, which uses Ocelot to route and aggregate requests.
• Microservices: Separate services for AuthAPI, CouponAPI, EmailAPI, OrderAPI, RewardAPI, ShoppingCartAPI, and ProductAPI. Each microservice has its own business logic, data access layer (with dedicated AppDbContext files and EF Core migrations), and associated communication components (like message senders).
• Message Bus: Illustrated by the Mango.MessageBus, along with message sender/consumer components in several services (see RabbitMQ in AuthAPI and Azure Service Bus in EmailAPI and RewardAPI).
• Frontend Application: The Mango.web project, which is an MVC Razor view based application that interacts with the backend through the API Gateway.
• Payment Gateway: Integration with Stripe (as seen in DTOs such as StripeRequestDto), used likely in the Order/ShoppingCart flow.
Relationships and Interactions
• The Frontend (Mango.web) sends HTTP requests to the API Gateway.
• The API Gateway routes incoming requests to the appropriate microservices.
• Microservices communicate with their own databases. They also link with each other indirectly through asynchronous message handling via the message bus (Azure Service Bus in EmailAPI/RewardAPI or RabbitMQ in AuthAPI).
• The payment process is handled by Stripe, so include an external connection from the Order or ShoppingCart service to the Stripe system.
• Some microservices might call external services or third-party APIs as needed (such as for sending emails, handling coupons, etc.), so represent those interfaces where applicable.
Architectural Patterns and Technologies
• Microservices Architecture: Each business capability (auth, orders, products, etc.) is encapsulated in a separate service.
• API Gateway Pattern: Ocelot is used to centralize request routing and centralized cross-cutting concerns (e.g., authentication, logging).
• Database per Service: Show each microservice connected to its own SQL Server instance (or logical database) via Entity Framework Core.
• External Payment Integration: Clearly mark where the Stripe payment gateway fits into the Order or ShoppingCart flow.
• MVC / Frontend: The mango.web project is a distinct component interacting with users through Razor views.