In this lesson, you build a small event-driven setup with NestJS and Next.js. You use EventEmitter on the backend and Server-Sent Events (SSE) on the frontend. This setup lets your app push updates without a page reload.
How the Event Flow Works
NestJS creates and sends events when something changes. These events carry simple data. Next.js keeps an open link to the backend and waits for updates.
When a new event arrives, the page updates at once. You do not need extra fetch calls.
Why Use This Pattern
This setup helps you build live features with little code. You can show alerts, track long tasks, or refresh small parts of the page.
You also keep the flow easy to trace. The backend sends events, and the frontend reacts in order.
What You Build Here
You set up a basic event path. NestJS fires an event. Next.js listens and shows the new data. This gives you a clear start for larger real-time features.