Design
Pub-Sub Messaging System
Design an in-memory publish-subscribe system where publishers send messages to topics and multiple subscribers receive them.
01 - Why interviewers ask this
Publish-subscribe is the Observer pattern in disguise at a system level — this question checks whether you can decouple producers from consumers cleanly before you ever touch a real message broker.
02 - Where this system exists in the real world
You interact with this design every day.
In-app event buses (UI state updates)
Microservice event notification systems
Chat/notification fan-out to multiple subscribers
03 - What you'll master
Solve this once. Know it forever.
Apply the Observer pattern at a systems level
Decouple publishers from subscribers completely
Handle subscriber registration/removal safely
04 - What you'll design
6 functional · 3 non-functional requirements.
Publishers send messages to named topics
5 more requirements inside
Sign in to unlock the full brief and start designing
05 - Companies that ask this
You may face this exact question in your next interview.
Ready?
Open the canvas.
Design it yourself.
See all requirements, use staged hints, run your code, and compare with community discussions - all on the same canvas.
Start Solving