A sample shopping website based on Microservices architecture. This application incorporates multiple microservices like:
- Catalog API
- Basket API
- Discount API
- Order API
that are aggregated using an Aggregator pattern.
An API gateway exposes the relative endpoints for performing API actions like adding items to the basket, displaying the product catalogue and placing an order by calling the required microservice endpoint(s). The API gateway acts as a Backend for Front (BFF pattern) end that allows restricted access to the microservices only exposed via the gateway.
Pattern Name: Project
- API Gateway:
Ocelot.ApiGw
- Aggregator:
Shopping.Aggregator
- Backend for Front-end:
Shopping.Aggregator
- Database per Service: The
Basket
,Catalog
andOrdering
microservices have their own version of the database - Command Query Responsibility Segregation (CQRS):
Ordering
microservice implementsCQRS
pattern internally - Mediator: Ordering microservice uses
Mediator
pattern to fire commands and queries from the API controller to the application layer - Event-Driven Architecture: The
Basket.API
project publishes an event usingMassTransit
message broker onRabbitMQ
instance. Checkout action inOrdering.API
is subscribed to the checkout fired byBasket.API
which as a result invokesSendMail
action via theEmailService
.
The UI part is a simple MVC website that communicates with the API gateway for performing portal operations like displaying and ordering products.
- .NET Core 6
- Ocelot API gateway
- Rabbit MQ with Mass transit
- Docker containers
- Dapper
- Redis
- Mongo DB
- Protobuf with messages over gRPC
- Fluent Validations
- Entity Framework Core 7
- Automapper
- MediatR