How mehmetozkaya/eshopmicroservices-udemy-sections works
Project Type & Purpose
• This is a full-stack, e-commerce “EShopMicroservices” reference implementation built in .NET.
• It demonstrates a microservices architecture featuring Catalog, Basket, Discount (gRPC), and Ordering services, working together via synchronous HTTP calls (for queries/commands) and asynchronous events (RabbitMQ via MassTransit).
• A YARP API Gateway fronts the services, and a Razor Pages web app (Shopping.Web) provides the UI.
Key Architectural Components
a. Client Layer
• Shopping.Web (Razor Pages) – invokes REST/gRPC endpoints via HTTP clients.
b. API Gateway
• YarpApiGateway – routes HTTP traffic to appropriate microservices; handles cross-cutting concerns (CORS, authentication).
c. Microservices
• Catalog.API (HTTP/REST + EF Core/PostgreSQL)
• Basket.API (HTTP/REST + Redis)
• Discount.Grpc (gRPC + EF Core/SQLite or PostgreSQL)
• Ordering.API (HTTP/REST + EF Core/SQL Server)
d. Messaging Infrastructure
• MassTransit + RabbitMQ broker – carries IntegrationEvents (e.g., BasketCheckoutEvent) to decouple Basket and Ordering.
e. Datastores
• Redis – Basket cache
• Relational DBs (PostgreSQL, SQL Server, SQLite) – persisted state per service
f. Shared Libraries
• BuildingBlocks (CQRS abstractions, behaviors, exception handling, pagination)
• BuildingBlocks.Messaging (IntegrationEvent base, MassTransit extensions)
Interactions & Data Flows
• Synchronous HTTP/gRPC:
• UI → API Gateway → Catalog/Basket/Ordering services
• API Gateway → Discount.Grpc via gRPC client
• Asynchronous events:
• Basket.API publishes BasketCheckoutEvent → RabbitMQ → Ordering.Application consumes → creates order
• Data persistence per service: each service owns its database; no shared schema.
• IntegrationEvent library standardizes event payloads.
Architectural Patterns & Principles
• Microservices (bounded contexts per domain module)
• API Gateway pattern (YARP)
• Event-driven communication (pub/sub via RabbitMQ)
• CQRS for command/query separation within services via BuildingBlocks.CQRS
• Clean/vertical slice architecture: each service contains its own Controllers/Endpoints, Application (CQRS handlers), Domain (models/events), Infrastructure (EF Core, messaging), DI setup.
• Shared “BuildingBlocks” libraries for cross-cutting concerns (validation, logging, exception handling).
Detailed Capture
• Don’t just list components—show their interactions.
• Both synchronous (request/response) and asynchronous (event-driven) flows.
• Shared libraries to show code-reuse.
• Data ownership boundaries (each microservice has its own database).