A distributed order processing system built with .NET Clean Architecture, featuring CQRS, RabbitMQ messaging, and dual persistence in SQL Server and MongoDB.
This project demonstrates a scalable microservice pattern using domain events and message queues to decouple the system.
API ββ> Application ββ> Infra ββ> RabbitMQ ββ> Consumer
β β
SQL Server MongoDB
-
API
- Exposes endpoints to create and retrieve orders.
- Triggers a
SaveOrderCommandwhen a POST request is received.
-
Application
- Implements CQRS to separate command and query logic.
- Handles business rules (e.g., inventory validation).
- Saves the order to SQL Server.
- Raises an
OrderCreatedEventas a domain event.
-
Infra
- Listens for domain events.
- Publishes messages to RabbitMQ queue (
order.created).
-
Consumer
- Subscribes to the RabbitMQ queue.
- Reads order details from SQL.
- Syncs the order into MongoDB for read-side optimization or analytics.
| Layer | Technology |
|---|---|
| API | ASP.NET Core Web API |
| Application | MediatR, CQRS, FluentValidation |
| Infra | Entity Framework Core, RabbitMQ |
| Consumer | Background Worker, MongoDB |
| Messaging | RabbitMQ |
| Databases | SQL Server, MongoDB |
| Architecture | Clean Architecture |
| DevOps | Docker, GitHub Actions (CI/CD) |
OrderTrackingApp/
βββ API # Entry point
βββ Application # CQRS, Commands/Queries, COre app logic
βββ Application.Contracts # Interfaces, DTOs, Validation
βββ Domain # Entities, Value Objects, Events
βββ Infrastructure # Event Handlers, RabbitMQ
βββ Consumer # Background service that syncs to MongoDB
βββ ReadPersistence # MongoDB Read Models
βββ Persistence # EF Core
βββ docker-compose.yml # Services for RabbitMQ, SQL Server, MongoDB
- .NET 8 SDK
- Docker
- MongoDB Compass (optional for viewing MongoDB)
- RabbitMQ Management UI (user:
guest, password:guest)
git clone https://github.com/ParagNaikade/order-tracking-app.git
cd order-tracking-app
docker-compose up --buildPOST /api/ordersβ Creates an orderGET /api/orders/{id}β Retrieves an orderGET /api/ordersβ Retrieves paginated list
- β Clean Architecture (Separation of Concerns)
- β CQRS with MediatR
- β Domain Events and Messaging
- β Async Communication via RabbitMQ
- β SQL Write DB & MongoDB Read DB (eventual consistency)
- β Dockerized Microservices
Created with β€οΈ by Parag Naikade