This is a Proof of Concept (POC) project that demonstrates a simple blog application integrated with an email sending feature and a notification system using RabbitMQ for message broker. The goal is to show how to handle asynchronous tasks such as sending notifications when new blog posts are created.
- Node v20 or higher;
- Docker and Docker Compose
- Backend: Node.js, Express and Knex;
- Message Broker: RabbitMQ;
- Email Service: Nodemailer and mailcatcher;
- Database: MySql.
- Install dependecies
yarn
- Create
.env
file in blog-api root
DB_HOST=localhost
DB_USERNAME=root
DB_PASSWORD=admin
DB_NAME=blog
DB_PORT=3306
RABBITMQ_HOST=localhost
RABBITMQ_PORT=5672
RABBITMQ_USERNAME=guest
RABBITMQ_PASSWORD=guest
- Create
.env
file in email-cosnumer root
NODEMAILER_SENDER_EMAIL=sender@gmail.com
NODEMAILER_HOST=localhost
NODEMAILER_PORT=1025
RABBITMQ_HOST=localhost
RABBITMQ_PORT=5672
RABBITMQ_USERNAME=guest
RABBITMQ_PASSWORD=guest
- Start RabbitMQ and MySql (ensure Docker and Docker Compose is installed)
cd apps/blog-api && docker compose up
- Run migrations
yarn nx run blog-api:migrate:latest
- Seed database
yarn nx run blog-api:seed:run
- Run blog-api
yarn dev:blog-api
- Run email-consumer
yarn dev:email-consumer
Swagger API documentation is available at: