KatInterview

Multi-Channel Messaging Platform Design

System DesignModel answer
HardModel answerSystem Designdistributed-systemsmessagingscalability

Last updated

Build a platform that routes millions of messages per day across email, SMS, and mobile push, handling both real-time triggers and scheduled campaigns.

You're building a messaging platform for a two-sided marketplace with millions of users. The platform must dispatch communications through multiple channels—email, SMS, and mobile push notifications—and accommodate different user roles including buyers, sellers, and internal staff.

Your system needs to handle two distinct sending patterns:

Real-time triggered messages: Individual messages fired by application events. For example, when a transaction completes, the buyer receives a receipt; when an appointment time arrives, the seller gets a reminder with access credentials.

Scheduled audience campaigns: Bulk sends to user segments, either one-time or recurring. A marketing team might send a promotion to all sellers in a region, or operations might notify users about a policy change.

You can assume upstream services already produce events for business activities. Your platform consumes these events and handles message delivery.

Design the complete system, addressing:

  1. Scope and capacity planning: What functional capabilities and performance targets drive your design? Estimate throughput, latency requirements, and reliability goals.

  2. Architecture and flow: Sketch the major components and trace the path a message takes from trigger to delivery for both sending patterns.

  3. Storage schema: What entities do you persist and how do they relate?

  4. Interface contracts: What APIs do other services call? How do external providers report back?

  5. Content management: How are message templates created, stored, customized per user, and selected for each channel?

  6. User control and regulations: How do users manage what they receive? How do you comply with anti-spam laws and handle opt-outs?

  7. Traffic management: How do you prevent low-priority bulk sends from delaying time-sensitive messages?

  8. Correctness guarantees: What prevents duplicate sends? When does ordering matter and how do you enforce it?

  9. Resilience: How do you handle failures—both transient errors and complete provider outages?

  10. Horizontal scaling: What strategies let you grow capacity? How do you partition work and handle sudden spikes?

  11. Visibility: What instrumentation reveals system health and proves compliance?

  12. Economic controls: How do you keep provider costs predictable as volume grows?

State your assumptions clearly. Explain the reasoning behind key decisions and the trade-offs you're accepting. Describe how you'd validate the design before launching.

Hints

Hint 1

Start with concrete numbers—daily volume, peak throughput, and latency targets for different message types. These drive every downstream choice about queuing, partitioning, and provider capacity.

Hint 2

Separate the concerns: one pipeline validates preferences and renders content; distinct priority queues per channel prevent bulk campaigns from starving urgent messages; workers handle provider interaction and retries.

Hint 3

Think through the compliance layer carefully—suppression lists, category-based consent, frequency limits, and timezone-aware quiet hours must all execute atomically before any message leaves the system.