Untitled Lesson
Skill Matrix
UNLOCK NODES BY LEARNING NEW TAGS.
What genuine risk does a global, application-wide event bus introduce, even though it decouples individual modules from directly calling each other?
💻 Code Challenge | +75 XP
Build a typed event bus wrapper (using TypeScript generics) for a small set of events, ensuring a mismatched event name or payload shape is caught as a compile-time type error.
A large codebase's event bus has grown to the point where nobody can confidently answer "what reacts to this event?" without grepping the entire codebase. Reorder the steps to introduce more discipline.
Task: Reorder the blocks in logical sequence to solve the problem.
A.D.A. Interface
Adaptive Didactic Assistant

Pascual Vila
Frontend Instructor // Code Syllabus
The Error //
Naming events as imperative commands (like "placeOrder") instead of past-tense facts (like "orderPlaced")
// Misleading: sounds like a command directed at someone specific
eventBus.emit("placeOrder", order);
// Correct: a fact that already happened, anyone can react to it
eventBus.emit("orderPlaced", order);The Solution //
An event represents something that has already happened, which any number of independent listeners may react to — naming it as a command implies a single intended action and a specific responder, which is misleading in a pattern designed for zero-knowledge, many-to-many communication. Consistent past-tense naming keeps the event bus's vocabulary clear and self-documenting as it grows.
The Error //
Assuming an in-process event bus can be used to communicate with a genuinely separate service or process
// Does NOT work across separate processes/services
eventBus.emit("orderPlaced", order); // only reaches listeners in THIS process
// Correct for cross-process/service communication
await redisPublisher.publish("orderPlaced", JSON.stringify(order));The Solution //
An in-process EventEmitter-based bus only works within a single running Node.js process — a listener registered in one process has no way to receive an event emitted from a different process or service. Cross-process or cross-service communication requires a real message broker like Redis Pub/Sub, RabbitMQ, or Kafka.