{"id":45814,"library":"pp-event-bus","title":"pp-event-bus","description":"A distributed event bus library for TypeScript and JavaScript, built on Redis Streams. Version 1.12.1 supports event versioning, metadata, validation, and a fanout (1:N) pattern. It uses a modular architecture with separate components for stream management, publishing, consumer groups, and logging. The library is designed for high-performance event distribution with consumer groups for reliable message delivery and load balancing. Key differentiators include built-in validation hooks, semantic versioning for events, and optional JSONL persistence. It is actively maintained and released on npm.","status":"active","version":"1.12.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","dragonfly","redis","distributed","event-bus","eventbus","pub-sub","typescript"],"install":[{"cmd":"npm install pp-event-bus","lang":"bash","label":"npm"},{"cmd":"yarn add pp-event-bus","lang":"bash","label":"yarn"},{"cmd":"pnpm add pp-event-bus","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Redis client for connecting to Redis/DragonflyDB","package":"redis","optional":false}],"imports":[{"note":"Event is a named export, not a default export.","wrong":"import Event from 'pp-event-bus'","symbol":"Event","correct":"import { Event } from 'pp-event-bus'"},{"note":"ESM named import is preferred; CommonJS require also works but is non-standard.","wrong":"const EventBus = require('pp-event-bus').EventBus","symbol":"EventBus","correct":"import { EventBus } from 'pp-event-bus'"},{"note":"Config class for initializing EventBus.","wrong":"","symbol":"EventBusConfig","correct":"import { EventBusConfig } from 'pp-event-bus'"}],"quickstart":{"code":"import { Event, EventBus, EventBusConfig } from 'pp-event-bus';\n\nclass OrderCreatedEvent extends Event {\n  constructor(\n    public readonly orderId: string,\n    public readonly customerId: string,\n    public readonly totalAmount: number\n  ) {\n    super('1.0.0');\n    this.validate();\n  }\n  protected validate(): void {\n    if (this.totalAmount <= 0) {\n      throw new Error('Amount must be greater than 0');\n    }\n  }\n}\n\nconst config = new EventBusConfig({\n  redisUrl: process.env.REDIS_URL ?? 'redis://localhost:6379',\n  logger: console\n});\nconst eventBus = new EventBus(config);\n\nasync function main() {\n  const event = new OrderCreatedEvent('123', '456', 100);\n  await eventBus.publish('order.created', event);\n  console.log('Event published');\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Shows how to define a custom event with validation, configure an EventBus with Redis URL from environment, and publish an event."},"warnings":[{"fix":"Pass a Redis URL string instead of a client instance.","message":"The 'EventBusConfig' constructor now requires 'redisUrl' as a string (not a Redis client object).","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use eventBus.publish(topic, event) instead of event.publish()","message":"The 'Event.publish()' method is deprecated in favor of 'EventBus.publish()'.","severity":"deprecated","affected_versions":">=1.5.0"},{"fix":"Always call super() and this.validate() in your custom event constructor.","message":"The 'Event' class requires a call to 'this.validate()' in the constructor if you override the 'validate' method, otherwise validation will not run.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1':28 '1.12.1':19 'activ':85 'architectur':35 'balanc':66 'built':14,71 'built-in':70 'bus':4,8,97 'compon':38 'consum':43,58 'deliveri':63 'design':50 'differenti':68 'distribut':6,56,94 'dragonfli':92 'event':3,7,21,55,78,96 'event-bus':95 'eventbus':98 'fanout':27 'group':44,59 'high':53 'high-perform':52 'hook':74 'includ':69 'javascript':13,91 'jsonl':81 'key':67 'librari':9,48 'load':65 'log':46 'maintain':86 'manag':41 'messag':62 'metadata':23 'modular':34 'n':29 'npm':90 'option':80 'pattern':30 'perform':54 'persist':82 'pp':2 'pp-event-bus':1 'pub':100 'pub-sub':99 'publish':42 'redi':16,93 'releas':88 'reliabl':61 'semant':75 'separ':37 'stream':17,40 'sub':101 'support':20 'typescript':11,102 'use':32 'valid':24,73 'version':18,22,76","created_at":"2026-06-07T12:56:52.028157+00:00","updated_at":"2026-06-07T12:56:52.028157+00:00","problems":[{"fix":"Use import { Event } from 'pp-event-bus' instead of import Event from 'pp-event-bus'.","cause":"Importing Event as default instead of named export.","error":"TypeError: Event is not a constructor"},{"fix":"Ensure totalAmount > 0 when creating the event.","cause":"Validation error when creating an OrderCreatedEvent with a non-positive totalAmount.","error":"Error: Amount must be greater than 0"},{"fix":"Check Redis URL and ensure Redis server is reachable.","cause":"Redis connection failure or network issue.","error":"TimeoutError: command timed out"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://gitlab.polskiepolisy.pl/microservices/event-bus","github":null,"docs":null,"changelog":null,"pypi":null,"npm":"pp-event-bus","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}