How teransarathchandra/ordermanagementsystem works
Project Type and Purpose
• This is a microservices‐based Order Management System implemented in .NET (C#) with three independent services—Catalog, Customer, and Order—each exposing a Web API, managing its own database via Entity Framework Core, and composed via Docker Compose. There’s also a shared library for common cross‐cutting concerns (logging, telemetry, Swagger, middleware).
Main Components
a. Catalog Microservice
• Layers:
• CatalogWebApi (ASP.NET Core HTTP endpoints)
• Application (CQRS commands/queries and handlers for inventory and product retrieval)
• Domain (Product and Category domain models)
• Infrastructure (EF Core DbContext, migrations, configurations, seed data)
• Database: CatalogDB
b. Customer Microservice
• Layers:
• CustomerWebApi (HTTP endpoints for register, update, delete, retrieve)
• Application (commands/queries for CRUD logic, validators, DTOs)
• Domain (Customer model)
• Infrastructure (EF Core setup, migrations, seed data)
• Database: CustomerDB
c. Order Microservice
• Layers:
• OrderWebApi (endpoints to create, cancel, update status, list orders)
• Application (command/query handlers, validation, DTOs)
• Domain (Order, OrderItem, OrderStatus, Product)
• Infrastructure (EF Core DbContext, migrations, configurations, plus HTTP clients for CatalogService and PaymentService)
• Database: OrderDB
d. Shared Library
• Cross‐cutting concerns: SerilogExtensions, SwaggerExtensions, TelemetryExtensions, ExceptionMiddleware, ValidationMiddleware
e. External Services
• PaymentService (invoked by Order microservice; represented as an external HTTP/REST API)
f. Docker Compose
• Defines containers for each microservice and their databases; centralizes environment orchestration
Relationships and Interactions
• Clients → HTTP calls → CatalogWebApi / CustomerWebApi / OrderWebApi
• OrderMicroservice uses synchronous HTTP calls to:
• CatalogServiceClient (to check availability and reduce inventory)
• PaymentServiceClient (to process payments; external)
• Each service reads/writes its own database; no shared database.
• Docker Compose ensures all containers (three APIs, three databases) run together in a single network.
Architectural Patterns and Principles
• Microservices with bounded contexts: Catalog, Customer, Order
• Layered architecture within each service: Presentation (WebApi), Application (CQRS), Domain, Infrastructure
• CQRS for separating read/write logic
• Dependency Injection and Middleware for cross‐cutting concerns
• Database per service to enforce data ownership and decoupling
• Containerization for isolated deployments