npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@selvoc/event-client

v0.1.0

Published

An experimental TypeScript library for event-driven communication in microservices. This is not production-ready and is likely to change significantly in the future.

Readme

Event Client

An experimental TypeScript library for event-driven communication in microservices. This is not production-ready and is likely to change significantly in the future.

This library provides a simple, object-oriented approach to event-driven systems, using decorators for event definition and handling. It aims to make event publishing and consumption type-safe and ergonomic, but is still in early development and may have breaking changes.

Features

Installation

npm install @selvoc/event-client @selvoc/event-client-transport-basic class-validator reflect-metadata

Peer dependencies: class-validator, class-transformer, and reflect-metadata must be installed.

Usage

Defining an Event

import { Event } from '@selvoc/event-client';
import { IsString } from 'class-validator';

@Event('user.created')
export class UserCreatedEvent {
  @IsString()
  userId: string;

  static build(userId: string): UserCreatedEvent {
    const event = new UserCreatedEvent();
    event.userId = userId;

    return event;
  }
}

Note: Do not use a constructor with parameters in your event classes. Due to how class-transformer works, it does not pass parameters to the constructor when deserializing. Use a static build method instead. This may improve in the future.

Setting up the Event Client

import 'reflect-metadata';
import { EventClient } from '@selvoc/event-client';
import { BasicEventTransport } from '@selvoc/event-client-transport-basic';
import { UserCreatedEvent } from './events/user-created.event';

const eventClient = new EventClient({
  transports: [new BasicEventTransport([UserCreatedEvent])],
  logger: console, // must implement EventLogger interface
});

await eventClient.init();

Handling Events with Decorators

import { EventInterceptor, EventListener } from '@selvoc/event-client';
import { UserCreatedEvent } from './events/user-created.event';

@EventInterceptor()
class UserEventHandler {
  @EventListener(UserCreatedEvent)
  async handleUserCreated(event: UserCreatedEvent) {
    console.log('User created:', event);
  }
}

// Just instantiate the handler to register it
new UserEventHandler();

Producing Events

import { UserCreatedEvent } from './events/user-created.event';

const event = UserCreatedEvent.build('123');
await eventClient.produce(event);

Validation

Validation is automatic before producing or handling. Invalid events will throw an error.

Custom Transports

You can implement your own transport by extending the EventTransport abstract class.

Caveats & Roadmap

  • This is an experiment and not ready for production
  • API and internals will change a lot
  • Currently, only basic and rabbitmq transports are available
  • Constructor parameters in event classes are not really supported (see above) unless you handle undefined.
  • More docs, examples, and features are planned