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

micro-service-toolkit

v0.3.1

Published

Wire business logic in node with in- and outbound channels (e.g. RabbitMQ) by JSON config.

Readme

micro-service-toolkit

Wire business logic in node with in- and outbound channels (e.g. RabbitMQ) by JSON config.

What's it?

We're running a lot of microservices on node.js communicating via RabbitMQ topics. It was annoying to see lot of similar infrastructure glue code.

This is an approach solves that by

  1. separating technical infrastructure code completely from business logic
  2. avoiding hard coded infrastructure code and use JSON based configuration instead

The business logic is connected to in- and outbound channels (e.g. an RabbitMQ topic) by defining that in the config.json.

Have a look at the example :-)

Published as npm package, you can just do npm install micro-service-toolkit.

Files in this project

  • service.js: the microservice technical framework
  • channels/inboundRabbitMq.js: first channel plug in
  • test/myMessageProcessor.js: dummy microservice business logic part
  • test/config.json: configuration how to connect in- and output channels to the business logic
  • test/sendTesMsg.js: create a test message to be processed by the 'MessageProcessor'

Run the 'MessageProcessor' test service

To start this MessageProcessor micro services:

  1. Start RabbitMQ:
  2. docker pull rabbitmq
  3. docker run -d --hostname my-rabbit --name some-rabbit -e RABBITMQ_DEFAULT_USER=user -p 5672:5672 -p 15672:15672 -e RABBITMQ_DEFAULT_PASS=password rabbitmq:3-management
  4. Console is on http://localhost:15672
  5. Prepare the service: npm install
  6. Start the service in the test directory: node myMessageProcessor.js --rabbitHost=localhost

To send a test message simply run node sendTestMsg.js --rabbitHost=localhost in the test directory.

BTW: The framework uses amqp-heartbeat to enable a monitoring of the microservices.

Gernerate Code Template

Call syntax:

node generateTemplate.js --config=./test/config.json > ./test/myService.js

Command Messages

In an asynchronous environment the best way to manage the services is via messages.

The exchange for command messages is microservicetoolkit. Each service is listening to a topic with the <service name (lowecase)>.* as filter.

Message format is:

{
	"cmd":"<command>",
	"authKey":"<secret key>",   // optional -- for authorization commands
	"version":"<no>",           // optional -- to address services of on version
	"serviceId":<UUID>          // optional -- to address a single service (ref. heartbeat)
}

Currently supported command messages are

  1. start starts the message consumers
  2. kill stops the whole microservice process

By stopping "version-1" and starting "version-2" (JS has no service.start() in service.init(..) code), you can do version switch in a running system environment.

In the test folder you can try that:

node sendStopMsg.js --rabbitHost=localhost --service=MessageProcessor

More generic is node sendCmdMsg.js (will print out the usage).