NestJS microservice for notifications developed during Ignite Lab 04 from @Rocketseat
This project was developed during IgniteLab 4 day course, even though the APP is very simple, the course focused a lot on building a microservice with attention to scalability by following high standard principles such as test-driven-development, clean and scalable code design.
The app allows users to:
- Send notifications (it creates a notification instance in the DB, there's no actual notification system);
- Read notification;
- Unread notification;
- Cancel a notification;
- Get notifications from a recipient;
- Count notifications from a recipient;
- Send notification when received Kafka messaging event
If you want to test the API REST routes you can use Insomnia. Import the workspace with one click!
- Node Js β An asynchronous event-driven JavaScript runtime
- NestJS β A progressive Node.js framework for building efficient, reliable and scalable server-side applications
- Prisma β An open source next-generation ORM
- Kafka β A distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications
- Jest β Jest is a delightful JavaScript Testing Framework with a focus on simplicity.
- Clone this repo running on your terminal
git clone https://github.com/Gust4voSales/notifications-microservice.git
- Create a Kafka instance (Upstash free tier recommended) and add a "notifications.send-notification" topic (https://docs.upstash.com/kafka)
cd
intonotifications-consumer
- Run
yarn
to install all dependencies - Run migrations with
npx prisma migrate dev
- Create a .env file based on the .example.env and fill it in with Kafka connections' keys
- Lastly,
yarn start:dev
to start the server
cd
intonotifications-producer
- Run
yarn
to install all dependencies - Create a .env file based on the .example.env and fill it in with Kafka connections' keys
node producer.js
to run the script
*A script that generates a Kafka messaging event ("notifications.send-notification") to test the notifications-consumer
app