#user notifications

1 messages · Page 1 of 1 (latest)

bright ferry
#

i want to create a notification system in my app, for users to have in app notifications, like user X, commented on the report Y
i have a user module, and i was thinking, would it make more sense to create a notification module, or add it directly to the user module ?

thank you

quick spindle
#

That choice heavily depends on how advanced the notification system you want to implement is.
I usually create separate modules for the stuff not entirely associated with the users entity.
When it comes to a notification feature, it's common to store them in a database or interact with external services to handle push notifications, emails, etc. So, having those actions defined in a separate notifications module makes more sense. It helps me to have isolated business logic and a more organized file structure (feature per module).

If the system you have in mind is not that complex, you might want to create a notifications.service.ts in the users module and probably attach some endpoints to it for simplicity and worry about untangling it as the application grows in the future.

bright ferry
#

thanks @quick spindle appreciate your time

hybrid crane
#

a very simple but very effective way would be to make use of web sockets
these are pretty fast if not instant

strong flower
hybrid crane
hybrid crane
#

i have said dumber things and you know this all to well 😅