What problem does it solve?
Centralizes communication between components to eliminate tight coupling, making systems easier to test, reuse, and evolve by routing interactions through a mediator rather than direct references.
Core Features & Use Cases
- Decoupling components: Components send events or commands to a mediator instead of calling each other, improving reuse and testability.
- Event bus / publish-subscribe: Support for typed event handlers so multiple services can react to the same event without mutual awareness.
- CQRS command/query routing: Register command and query handlers with a mediator to enforce single responsibility and clear routing in complex workflows.
- Use Cases: UI coordination (forms, inputs, buttons), backend order processing (inventory, shipping, email), analytics middleware, and domain-specific mediators to avoid God Objects.
Quick Start
Use the mediator-pattern guidance to replace direct component references with a mediator and register handlers to route commands, queries, or events across your domain.