Notification System LLD | Asked in Microsoft, Paypal, Walmart
You are tasked with designing a Notification System that allows users to send and receive notifications across multiple channels while adhering to object-oriented design principles.
Difficulty: Medium → Hard
Companies Asked: Microsoft, PayPal, Walmart

Requirements
Users
Each user has a unique ID.
Users can subscribe/unsubscribe to notification types.
Users can manage preferences, including frequency and channels.
Notification Channels
Support multiple channels: Email, SMS, Push, In-App.
Each channel has its own delivery mechanism and requirements.
Notification Types
Users can subscribe to notifications like new messages, friend requests, system alerts, promotional messages, security alerts, or custom events.
Each type may require specialized delivery formatting.
Bonus Requirements
Personalization – notifications can include user-specific data, such as name or event-specific information.
Opt-out & Preferences – users can fully unsubscribe or manage preferences at a granular level.
Entities
User – id, name, email, phoneNumber, globalOptOut, optedOutTypes, preferences
Notification – id, type, title, content, createdAt, personalizationData, sender
NotificationType (Interface) – getNotificationType(), formatContent(), hasSpecializedDeliveryRequirement()
NotificationChannel (Interface) – getChannelName(), sendNotification(), isChannelAvailableForUser()
Publisher (Interface) – publishNotification(), start(), stop()
NotificationBroker – manages users, subscriptions, channels, registered publishers, async dispatch
Flow
A Publisher publishes a notification.
The NotificationBroker finds subscribed users by NotificationTypeEnum.
For each user, the broker resolves preferred ChannelTypes, validates availability, and dispatches asynchronously.
Channels personalize and send content, returning success/failure.
Key Features Implemented
Pub-Sub Pattern (used over Observer Pattern) for decoupled, scalable notification routing.
Multithreaded async dispatch using ExecutorService for performance.
Easy to add new notification types or channels without major refactoring.
Fully supports personalization, opt-outs, and channel preferences.
📌 UML Diagram attached
📌 GitHub code link available in the video description
🎥 Watch the full implementation here:

