Lesson 12 of 30
The track's first full case study: designing an in-app notification center end to end, applying the requirements-scoping framework and the real-time decision tree to one concrete prompt.
13 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 3
Why should the unread notification badge count be derived from the notification list rather than stored as its own separate piece of state?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
The prompt: "Design the frontend architecture for a notification system" — an in-app notification center, an unread badge count, and a way for a new notification to actually reach the client in real time. This lesson works it through end to end, applying the framework from earlier in this track rather than inventing a new one.
Clarify requirements first. This is a direct application of the requirements-scoping lesson earlier in this track: is this in-app only, or does it include push notifications too? Does the unread count need to stay in sync across multiple open tabs or devices for the same user, or is per-session state acceptable? Each answer changes the design that follows — push notifications pull in a service worker and a backend push provider; in-app-only is a much smaller surface.
The real architectural pieces, assuming push is out of scope and the answer is "in-app only, but the badge should update live":
The coordination detail that trips people up: marking one notification "read" has to update two things consistently — that notification's own state, and the aggregate unread badge count. This is exactly why the earlier lesson on normalized client state matters here: if the notification list and the badge count are two independently-updated pieces of state, they will drift out of sync (a notification opens, its read flag flips, and the badge count forgets to decrement). Deriving the badge count from the notification list itself, instead of storing it separately, makes that class of bug structurally impossible rather than something to remember to handle.
"Design a notification system" is one of the most commonly asked frontend system design prompts precisely because it touches requirements scoping, a real-time delivery choice, and client state design all in one question — a strong answer visibly connects all three instead of treating them separately.