adonisjs-events

Centralize AdonisJS event listener registrations in start/events.ts.

2|1|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/omakei/adonisjs-architecture-skill --skill adonisjs-events
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adonisjs-events
Source: https://github.com/omakei/adonisjs-architecture-skill/tree/main/adonisjs/skills/adonisjs-events
Command: npx skills add https://github.com/omakei/adonisjs-architecture-skill --skill adonisjs-events

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Event-driven architecture decouples side effects from core business logic, enabling asynchronous work via listeners and emitters.

Core Features & Use Cases

  • Centralized listener registrations in start/events.ts
  • Class-based and string-based event definitions
  • Safe error handling with a global onError listener
  • Guidance on DI, lazy loading, and memory-leak prevention

Quick Start

Register your listeners in start/events.ts and dispatch events using events.<EventName>.dispatch.

Frequently Asked Questions about adonisjs-events

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decouple business logic from side effects in AdonisJS?

Decouple business logic in AdonisJS by using class-based listeners and emitters to handle side effects asynchronously. Centralizing event emission in a single start/events.ts file keeps cross-cutting tasks separated from core operations.

What is the best way to structure AdonisJS event listeners?

The best way to structure AdonisJS event listeners is by centralizing their registration in a single start/events.ts file. Using class-based listener definitions ensures consistent registration patterns and reliable dependency injection across modules.

How do I handle errors in AdonisJS event listeners?

Handle errors in AdonisJS event listeners by defining a global onError listener. This centralized error handling mechanism catches failures across your event emitters, preventing side-effect errors from crashing the main application.

Can I use dependency injection with AdonisJS event listeners?

Yes, you can use dependency injection with class-based AdonisJS event listeners. The Skill provides specific guidance on implementing DI, lazy loading listeners, and preventing memory leaks during event dispatch in your backend application.

Why should I use event-driven architecture in AdonisJS?

Use event-driven architecture in AdonisJS to coordinate cross-cutting tasks across services without tight coupling. Dispatching events via emitters allows modules to react to business logic outcomes asynchronously, improving overall application maintainability.

How do I dispatch events in AdonisJS after separating logic?

Dispatch events in AdonisJS by calling events.<EventName>.dispatch after registering your listeners in start/events.ts. This approach supports both class-based and string-based event definitions to trigger side effects cleanly.