Lesson 12 of 15
33. Design a Notification System

Score yourself

3 min read+10 XP

Score yourself

Give yourself 0, 1 or 2 points per row.

Area0 points1 point2 points
RequirementsStarted drawingListed channelsChannels, categories, latency per type, duplicates and opt-outs agreed
EstimatesNoneNumbers, not used laterNumbers that showed isolation and provider limits are the real problems
API and dataSkippedAPI or tables, not bothAsync 202 API with idempotency key, OTP API separate, preferences and status modelled
High-level designOne queue, one workerQueues and workers, no walkthroughOrder and OTP paths walked, receipts, campaigns separate
Deep diveHand-wavedOne topic coveredIsolation, de-duplication, preferences or OTP security done properly
Trade-offsNone namedNamed when askedRaised unprompted (failover vs duplicates, SMS cost, priority vs separate queues)
CommunicationLong silencesMostly clearThought out loud, checked in, managed time

12 to 14: strong hire signal. 8 to 11: solid, polish the weak rows. Under 8: redo the round in a week, timer on.

The bar: fresher vs SDE-2

FresherSDE-2
ChannelsQueue plus workers per channelSeparate lanes by priority with reserved provider quotas
ReliabilityRetriesBackoff, failover, DLQ, staleness checks
DuplicatesNot mentionedIdempotency at API, worker and provider
PreferencesOpt-out flagCategories, quiet hours by time zone, caps, unsubscribe rules
OTPRandom 6 digits in a tableCrypto RNG, HMAC, TTL, attempts, resend limits, fraud, SMS weaknesses

Common mistakes

  • One queue for everything, so a campaign delays OTPs.
  • Retrying by failing over to a second provider for every timeout, sending duplicates.
  • Storing OTPs in plain text, or letting the calling service generate and log them.
  • Applying marketing opt-outs to security messages, so users can't log in.
  • Ignoring provider limits and cost, especially for SMS.

Quick check

Five questions on this chapter. Pick an answer, then check it.

quiz