POST https://api.example.com/v/sms/send
DB: It stores data about user, notification, settings, etc.
SQL database can be used for this purpose
Services 1 to N that send notifications via apis provided by notification server
Notification server
Cache
DB
Message Queues for decoupling
Workers which will be pullingfrom the queues constantly
Third party servcies like APM and FCM , sms and email services as well
Reliability -
keeping a notification log database , retry mechanism implementation also there
Dedup mechanism there for already seen notifiacations if its already seen then the notification is not sent else it is sent
Exactly once delivery is not possible here
Notification template can be kept here in this design
consistent format
many websites and apps give users fine-grained control over notification settings. This information is stored in the notification setting table, with the following fields:
user_id bigInt
channel varchar # push notification, email or SMS
opt_in boolean # opt-in to receive notification
Before any notification is sent to a user, we first check if a user is opted-in to receive this type of notification.
Rate limiter also added in this design
appKey and appSecret are used here for secure push notifications
Monitor queued notifications if queue is large then we have to add more workers
Analytics Service can also be used here to know about the click tracking for the notification
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?