Classic case studies · senior
Case study: notification system
A strong notification design has a server-authoritative unread count, cursor-paginated history with grouped items, SSE (or an existing WebSocket) for live updates with gap-fill on reconnect, Web Push for closed tabs with a polite permission flow, and toasts that are rate-limited and announced politely.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Surfaces: bell with unread badge, dropdown and full history page, toasts, browser push when the tab is closed; email digests are usually out of scope.
- Model: { id, type, actor, entity, createdAt, readAt, groupKey }; group 'A and 5 others liked your post' by groupKey.
- API: GET /notifications?cursor=; GET /notifications/unread-count; POST /notifications/read { ids } or { upTo }; mark-all-read for 10k items is one server call, not 10k.
- Live: SSE is the simplest server → client channel; reuse a WebSocket if the app already has one; on reconnect fetch since the last id; dedupe by id.
- Push API + service worker for closed tabs: ask permission after a user action that shows value (never on page load); respect preferences per type and channel.
- Many tabs: BroadcastChannel to sync read state; one connection per browser via a leader tab (Web Locks).
- Toasts: queue with a maximum visible, rate limit, skip toasts for the conversation the user is already viewing; role=status / aria-live='polite'.
- Avoid fatigue: batching, digests, user preferences, quiet hours.
The red pen
Common traps: mistake → fix
Mistake: Poll every second
Fix: load and battery cost; push or poll slowly with backoff.
Mistake: Compute unread counts on the client
Fix: wrong across devices and pages.
Mistake: Ask for notification permission on page load
Fix: most users block it forever.
Mistake: Re-render the whole list on every incoming notification
Fix: jank.
Easy to hard
Questions interviewers ask, easy to hard
- Design a notification bell with history and live updates.
- Polling, SSE, WebSocket or Push API: which when?
- How do unread counts stay right across tabs and devices?
- The laptop sleeps for an hour. What happens when it wakes?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.