Skip to content

[Feature Request]: Built-in Event System for Nuxt #31892

@martinszeltins

Description

@martinszeltins

Describe the feature

Problem & Solution

Most backend frameworks like Laravel and Symfony have a built-in event system. You can dispatch and listen to events and have a place to monitor all events happening in your app. This would be a very useful feature to have built into Nuxt itself with a NuxtDevtools plugin to monitor all events.

Currently, if you want to have events in your Nuxt app, you can use VueUse EventBus composable or install the mitt package or use hookable from unjs. But none of them integrate well with Nuxt, lack SSR support, or offer Nuxt DevTools integration to monitor events in real time.

At our company, we use VueUse event bus and have built a custom NuxtDevtools module around it to be able to monitor events. It doesn't have SSR support, no async support etc. And VueUse may not even be the best option. While it works for us, it would be great to have a proper, well thought out event system as a first-class citizen in Nuxt like in other frameworks.

Why Events?

Nuxt itself is no stranger to events - it is built around events using hookable. Events is what allows to create modular and extensible software. This is one of the reasons why Nuxt is so great. And when building large, enterprise level Nuxt applications, modularity is not merely an option - it is a necessity. It helps keep code organized and managable.

For example - this is our own internal NuxtDevtools "Events" module. It allows you to record events, search, filter by type, see payloads etc.
For reference: vueuse/vueuse#4290 (comment)
Screenshot of NuxtDevtools Events Module

Laravel
Laravel has a powerful Event System and monitoring.
Image

Symfony
Symfony also has a built-in event system.
Image

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Later

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions