Gust4voSales / notifications-microservice

NestJS microservice for notifications developed during Ignite Lab 04 from @rocketseat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Notifications Microservice

NestJS microservice for notifications developed during Ignite Lab 04 from @Rocketseat

πŸ“œ About

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!

Run in Insomnia

βš™ Features

  • 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.

πŸ›  Getting started

  1. Clone this repo running on your terminal git clone https://github.com/Gust4voSales/notifications-microservice.git
  2. Create a Kafka instance (Upstash free tier recommended) and add a "notifications.send-notification" topic (https://docs.upstash.com/kafka)

   Run NotificationsConsumer (main application)

  1. cd into notifications-consumer
  2. Run yarn to install all dependencies
  3. Run migrations with npx prisma migrate dev
  4. Create a .env file based on the .example.env and fill it in with Kafka connections' keys
  5. Lastly, yarn start:dev to start the server

   Optionally run the producer script*

  1. cd into notifications-producer
  2. Run yarn to install all dependencies
  3. Create a .env file based on the .example.env and fill it in with Kafka connections' keys
  4. node producer.js to run the script

*A script that generates a Kafka messaging event ("notifications.send-notification") to test the notifications-consumer app

About

NestJS microservice for notifications developed during Ignite Lab 04 from @rocketseat


Languages

Language:TypeScript 92.7%Language:JavaScript 5.4%Language:Shell 1.9%