Design a Notification System
Problem Statement
Design the Low-Level Design (LLD) for a Notification System that can send notifications to users through multiple channels — such as Email, SMS, Push, and In-App notifications.
The system should be extensible, configurable, and capable of handling different message templates, priorities, and delivery mechanisms.
🎯 Core Requirements
1. Notification Creation
2. Notification Delivery
3. Multi-Channel Support
4. Scheduling (Optional Extension)
5. Notification Preferences
6. Status Tracking
⚙️ Key Operations (APIs)
APIDescription
sendNotification(Notification notification)
Sends a notification immediately.
scheduleNotification(Notification notification, Date time)
Schedules for future.
updatePreferences(User user, Preferences prefs)
Updates user notification preferences.
getNotificationStatus(String notificationId)
Retrieves the delivery status.
🧱 Suggested Class Design
ClassResponsibility
Notification
Represents the core notification entity (title, message, type, recipient, metadata).
NotificationService
Entry point for sending notifications. Delegates to correct channel(s).
NotificationChannel (Interface)
Abstract interface implemented by all channel types (Email, SMS, Push).
EmailNotificationChannel, SMSNotificationChannel, PushNotificationChannel
Implementations of notification channels.
NotificationScheduler
Handles delayed notifications using a queue or timer.
NotificationRepository
Stores sent notifications and their statuses.
UserPreferences
Stores user-specific channel preferences.
RetryHandler
Handles retries for failed sends.
🧠 Design Considerations
🚀 Possible Extensions
✅ Goal:
Design a modular, extensible, and maintainable notification system that supports multiple channels, user preferences, scheduling, and reliable delivery.