Design a Notification Center
Problem statement
Design a realtime notification center with durable inbox history, unread-count correctness, cross-tab sync, priority grouping, accessible announcements, and idempotent read/archive flows.
Asked In
Key Challenges
- ·Realtime notification delivery without duplicate toasts or lost updates
- ·Unread count correctness across tabs, devices, and reconnects
- ·Priority grouping so critical notifications do not drown in low-value events
- ·Bulk read/archive actions with optimistic UI and safe rollback
- ·Accessible announcements that inform without interrupting screen-reader users
2-Minute Answer — High-Level TL;DR
Read this before your interview
HLD Interview Focus
I would design this as two surfaces: a transient toast layer for immediate feedback and a durable notification inbox for history. The client keeps normalized notifications by id, an ordered inbox id list, and a server-authoritative unread count. Realtime events arrive over WebSocket or SSE, but every event has an eventId and cursor so reconnect can gap-fill without duplicates. Read/archive mutations are optimistic, idempotent, and reconciled against server counts. The hard parts are cross-tab consistency, priority grouping, accessible announcements, and not disrupting the user's current focus.
My Approach: Building the Solution
How to think about this problem
I'll start from unread count drift after a flaky reconnect — then design durable inbox vs transient toasts, dedupe keys, and focus-safe inserts.
Why This Approach?
Most candidates draw a bell icon and a list. Strong answers treat unread count as a distributed consistency problem across tabs, reconnects, and devices — and keep realtime inserts from stealing focus.
Treat notifications like email plus a doorbell: the inbox is the record, the toast is just the bell.
Requirements: What Makes a Great Solution?
Clarify scope before designing anything
Requirements Exploration Questions
Ask your interviewer these questions to refine requirements
Which notification types exist?
- ·Mentions, assignments, comments, approvals, system alerts
- ·Priority levels and expiration rules
- ·Actionable vs informational items
How realtime does it need to be?
- ·Instant delivery vs periodic polling
- ·Expected reconnect behavior
- ·Mobile push vs web-only scope
What does read mean?
- ·Read on open vs explicit mark-read
- ·Per-item read vs mark all read
- ·Cross-device count source of truth
Do users need preferences?
- ·Mute channels/projects
- ·Quiet hours
- ·Digest vs immediate delivery
What scale should the UI handle?
- ·Unread count size
- ·History retention
- ·Large tenants with high event volume
What compliance/privacy constraints matter?
- ·PII in preview text
- ·Tenant isolation
- ·Auditability of system alerts
Functional Requirements
Must Have — MVP
- ✓Notification bell with accurate unread count
- ✓Inbox panel with cursor pagination and grouping
- ✓Realtime new-notification delivery
- ✓Mark one, mark all, archive, and undo flows
- ✓Preferences entry point for mute and digest settings
- ✓Accessible keyboard navigation and announcements
Advanced (If Time Permits)
- +Cross-tab sync using BroadcastChannel
- +Priority queues and notification digests
- +Offline read/archive queue with replay
- +Inbox search and filters by type/source
Non-Functional Requirements
Performance Targets
- ·Bell count visible on first shell render
- ·Inbox opens in under 150ms from cached data
- ·Realtime event-to-toast latency under 1s on healthy connections
- ·Render thousands of historical notifications with virtualization
Reliability & Consistency
- ·No duplicate notifications after reconnect or tab restore
- ·Unread count reconciles with server after failed mutations
- ·Bulk actions are idempotent and resumable
- ·Gap-fill fetch runs whenever event cursor has a missing range
Accessibility & Input Support
- ·Keyboard-first flows with visible focus and predictable tab order
- ·Screen-reader announcements for async changes using aria-live where appropriate
- ·Reduced-motion alternatives for animated transitions
- ·Pointer, touch, and keyboard parity for every core action
Security & Privacy
- ·Never render rich notification HTML without sanitization
- ·Avoid leaking private content in browser notifications unless user opted in
- ·Scope notification queries by tenant and authenticated user
Observability
- ·Track Core Web Vitals plus domain-specific interaction latency
- ·Measure API error rate, retry rate, stale-cache usage, and client exceptions
- ·Emit structured events for critical user journeys and abandoned flows
The full solution is part of HelloFrontend Pro
The question above is free to read in full. Upgrade to unlock the interactive workspace and the senior-level walkthrough that go with it.
- Full RADIO-framework walkthrough with architecture diagrams
- Data model, API design, and rendering strategy trade-offs
- Performance, accessibility, and offline sections plus a model answer
Already a member? Log in to open the workspace.