How marethy/e-commerce_microservice_aspnetcore works
Project type and purpose
• This is a full-blown ASP.NET Core microservices-based e-commerce system.
• Purpose: independently deployable services (Product, Customer, Basket, Inventory, Ordering, Hangfire jobs, API Gateway, WebHealthStatus) that communicate via REST, gRPC and message bus to fulfill typical e-commerce flows (catalog browsing, order checkout, inventory updates).
File structure
• Top-level “src” splits into three areas:
• ApiGateways (Ocelot)
• BuildingBlocks (shared contracts, infrastructure, event bus, logging, common configs, DTOs)
• Services (each microservice: Basket.API, Customer.API, Product.API, Ordering (API + Application + Domain + Infrastructure), Inventory (Product API + gRPC), Hangfire.API)
• WebApps (WebHealthStatus UI)
• Each service has Controllers, Entities, Persistence or Repositories, Extensions (startup wiring), mapping profiles, Dockerfile and appsettings.
• Shared BuildingBlocks include:
• Contracts (interfaces, event definitions, repository interfaces)
• Infrastructure (Mongo/Redis/EF Core repos, RabbitMQ producer, SMTP email)
• Shared DTOs and settings.
• docker-compose.yml and override define containers: Postgres, MySQL, SQL Server, Redis, MongoDB, RabbitMQ, Elasticsearch, Kibana, Portainer, plus each service.
Extract additional insights from README
• Microservices communicate via:
• REST endpoints (ProductAPI, CustomerAPI, BasketAPI, OrderingAPI, Inventory.Product.API)
• gRPC (Internal Inventory.Grpc, Basket.API calls Inventory via gRPC.)
• RabbitMQ message bus for asynchronous events (BasketCheckout triggers Ordering via integration event).
• Databases per service:
• Product = MySQL, Customer = PostgreSQL, Ordering = SQL Server, Basket = Redis, Inventory = MongoDB.
• Infrastructure orchestration with Docker Compose.
a. API Gateway (Ocelot)
b. Client-facing layer: WebHealthStatus UI (MVC), external client calls to API Gateway
• Product.API (MySQL)
• Customer.API (PostgreSQL)
• Basket.API (Redis, gRPC client to Inventory.Grpc)
• Inventory.Grpc (MongoDB)
• Inventory.Product.API (MongoDB read/write)
• Ordering.API (SQL Server) + Ordering.Application + Ordering.Infrastructure + Consumers (RabbitMQ)
• Hangfire.API (background jobs)
d. Message Broker: RabbitMQ
e. External infra: Elasticsearch + Kibana, Portainer, PgAdmin
Relationships and interactions
• Client → API Gateway → appropriate REST service
• Basket.API → Inventory.Grpc via gRPC for stock validation
• Basket checkout → publish BasketCheckoutEvent → RabbitMQ → Ordering.API consumer
• Ordering.API → writes to SQL Server
• Each service reads/writes its own database
• Services use shared BuildingBlocks libraries for logging, repository patterns, event bus abstractions.
Architectural patterns and design principles
• Microservices per bounded context (DDD in Ordering.Domain)
• Clean layering in Ordering: API → Application (CQRS + MediatR behaviors: validation, performance, exception) → Domain → Infrastructure → Persistence
• API Gateway for façade routing and cross-cutting (authentication, throttling)
• Shared libraries for cross-cutting concerns (Contracts, Logging, EventBus)
• Asynchronous messaging for eventual consistency (RabbitMQ events)
• Containerized deployment with Docker Compose
Detail
• Microservice, its primary endpoints, its database, and its integration points
• Don’t omit the API Gateway or Docker Compose-defined infrastructure (Elasticsearch, Kibana, Portainer)