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