ReportMQ is a microservice-based system designed to handle invoice creation and automated daily sales reporting using a message queue. It leverages RabbitMQ for asynchronous event-driven communication and MongoDB for persistent storage.
The architecture follows separation of concerns across two services:
Invoice Service: Responsible for handling invoice data and publishing sales events to the queue.
Email Sender Service: Consumes sales events from the queue and sends formatted sales reports via email.
This project uses NestJS, Docker, and RabbitMQ to demonstrate scalable, event-driven service communication.
Before running the project, ensure the following software is installed:
- Node.js
- Docker
- MongoDB (If not using Docker)
- RabbitMQ (If not using Docker)
Docker
- Build Docker containers using
docker-compose up --build - Open the application at
http://localhost:3000
Nest Js
-
Install Dependencies:
npm install
-
Configure Environment Variables:
.envfileRABBITMQ_URL=amqp://localhost:5672
-
Start the Application:
npm run start
This will start the application .
The system consists of two main services:
- Invoice Service - Handles the creation of invoices and stores them in MongoDB.
- Email Sender Service - Consumes the sales report from RabbitMQ and sends an email with the report.
-
Start the invoice service:
cd invoice-service npm run start -
Start the email sender service:
cd email-sender-service npm run start
npm run test- Swagger Documentation:
The Swagger UI Open Api:
http://localhost:3000/api