Skip to content

feat(events): add internal event bus with typed events, listeners, an…#45

Open
dominiccreates wants to merge 4 commits into
MindFlowInteractive:mainfrom
dominiccreates:feature/events-module
Open

feat(events): add internal event bus with typed events, listeners, an…#45
dominiccreates wants to merge 4 commits into
MindFlowInteractive:mainfrom
dominiccreates:feature/events-module

Conversation

@dominiccreates

Copy link
Copy Markdown

this pr closes #43 Implemented a lightweight internal event bus using NestJS EventEmitter2 to decouple module communication.

  • Scaffolded src/events/:
    • events.enum.ts – enum of event names.
    • event-payloads.ts – typed payload interfaces.
    • event.service.ts – thin wrapper for emitting events.
  • Integrated EventEmitterModule (global) into AppModule.
  • Added placeholder modules (scoring, achievements, rewards, notifications) that subscribe to relevant events asynchronously.
  • Updated package.json with @nestjs/event-emitter dependency.
  • Added comprehensive unit tests (events.service.spec.ts) validating emission and listener handling for each event type.

Benefits

  • Modules no longer call each other directly → easier maintenance and extension.
  • New side‑effects can be added without touching existing business logic.
  • Asynchronous listeners keep request cycles fast.

Testing

Run npm test – all new tests pass, confirming proper event flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Events Module for Internal Domain Event Bus

1 participant