What is the best architecture to handle notifications in NodeJS

148 views Asked by At

We have a NodeJS Application running on ECS. It is a REST service with PostgreSQL.

We have to implement notification system. Admin can create a notification from a frontend (web) and these notifications are sent to mobile apps and web apps.

Notifications can be sent at the exact moment, scheduled for later delivery and can be made recurring so they occur weekly on a specifc day, every day, every weekdays.

What have I got so far:

  • Use BullMQ to schedule jobs, delayed jobs, and repeatable jobs.
  • Send Notificaiton data to the job, so it can run and send notification through Pusher Beams
  • Notification sometimes also contains filters to filter users, so the job will also connect to db and get user ids to which the notification must be sent.

Now, BullMQ needs redis to work. is there som other best way we can use PostgreSQL DB or some library other than BullMQ so as to avoid redis (avoiding redis because we will need to setup a EC2 instance, so extra costing. But if it's the best way then i guess, we'll have to do it.)

So, is my approach the best way to handle this scenario, keeping in mind the Developer eXperience?

What have I got so far:

  • Use BullMQ to schedule jobs, delayed jobs, and repeatable jobs.
  • Send Notification data to the job, so it can run and send notifications through Beams
  • Notification sometimes also contains filters to filter users, so the job will also connect to db and get user ids to which the notification must be sent.
1

There are 1 answers

1
Dan Philip Bejoy On

PARTIAL ANSWER

For a scalable BullMQ architecture, you can check out my story on Medium. You can use it as a base and scale it up by adding rest of the requirements.