Creating a notification system that's scalable

Hi, so I’m creating a web app and would like to implement a normal notification system (similar to upwork’s or bubble forum).

I’ve got it set it up so that everytime there is an action that requires sending a notification to the user it creates a new Thing called “Notification” with a user associated to this data type.

The thing is, every time there is a change to an event I should create a new notification for every single user suscribed to it (lets assume an event can have 1000+ users suscbribed to it) And any change on the event would create a new “notification” - adding up to 1k notifs at once.

I think this obviously is not scalable it could add up to a million of entries in a couple of months of abt 2000 users.

Is there a better approach or plugin to create a notification system that is actually scalable?

Thanks

You can create one single record for the event notification and associate it with a certain event type.

Event type can be stored as an OptionSet or as another DB table, depends on your use case.

Then you associate users to certain event types.

You now have only one record created per notification, regardless of how many users are associated to it.

Downsides of this approach are:

  1. You can’t store extra info about the user-event relationship, like a “seen” field
  2. You lose fine-grain control over user-event relationship, like deleting the relationship itself, without deleting the relationship for the whole event type.

If I’d want to keep these features, I’d start thinking about using another service to store notifications, outside Bubble.

I though about a similar approach. There is one key element my notifications should have which is they should contain a link to the event itself.

E.g. Changes in X event - On click it takes you to the event landing page.

That was my main concern regarding this approach you mention…

That’s completely doable with the approach I exposed.

You just need to associate the link with the Event.

The users are shown a notification that is bound to the Event, and so to the link you want them to access on click.

If you have many notifications and most of the users are free users, it can get expensive fast if you implement it in Bubble. :grin: