/eShopOnContainersMicroservices

Development of an ECommerce in an environment with microservices architecture in .NET

Primary LanguageC#

eShopOnContainersMicroservices

Development of an ECommerce in an environment with microservices architecture in .NET 5.0

Implementation of an ECommerce using a complex microservices architecture with several popular and main technologies of the Microsoft network (stack .NET 5.0).

Microsoft_eShopOn

Key architectural references:

Final design goal and current state of development:

Microservices_Arch_Applied

Implementations being carried out and planned:

  • Ocelot API Gateway (BFF) and Agreggator

Microservices created and implemented:

💡 SOLID, Clean Architecture, Domain Driven Design (DDD), Clean Code, Repository Pattern, logging, validation, exception handling, Swagger Open API and other standards/features were widely used for the design of projects.

Catalog microservice:

  • ASP.NET Core Web API application
  • REST API (CRUD operations)
  • MongoDB database connection and containerization
  • Repository Pattern Implementation

Basket microservice:

  • ASP.NET Core Web API application
  • REST API (CRUD operations)
  • Redis database connection and containerization
  • Consume Discount Grpc Service for inter-service sync communication to calculate product final price
  • Repository Pattern Implementation
  • Publish BasketCheckout Queue with using MassTransit and RabbitMQ

Discount microservice which includes;

  • ASP.NET Grpc Server application
  • Build a Highly Performant inter-service gRPC Communication with Basket Microservice
  • Exposing Grpc Services with creating Protobuf messages
  • Using Dapper for micro-orm implementation to simplify data access and ensure high performance
  • PostgreSQL database connection and containerization
  • Application of retry policy for database migration

Ordering Microservice

  • ASP.NET Core Web API application
  • Developing CQRS with using MediatR, FluentValidation and AutoMapper packages
  • Consuming RabbitMQ BasketCheckout event queue with using MassTransit-RabbitMQ Configuration
  • SqlServer database connection and containerization
  • Using Entity Framework Core ORM and auto migrate to SqlServer when application startup

Docker Compose establishment with all microservices on docker:

  • Containerization of microservices
  • Containerization of databases
  • YML files configuration
  • Use Portainer to manage docker containers

API Gateway Ocelot Microservice

  • Implement API Gateways with Ocelot
  • Sample microservices/containers to reroute through the API Gateways
  • Run multiple different API Gateway/BFF container types
  • The Gateway aggregation pattern in Shopping.Aggregator

Setup and Run Project

Requirements

Steps to get start

  1. At the root directory which include docker-compose.yml files, run below command to inicialize docker microservices containers:
docker-compose -f .\docker-compose.yml -f.\docker-compose.override.yml up -d --build

Wait for docker compose all microservices, some microservices need extra time to work

It is also possible to launch the project in visual studio by running (F5) when pointing to the docker-compose startup project

  1. Microservices urls: