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

@hodonsky/node-service

v2.0.1

Published

NodeJS Service for message queue (amqp 0-9-1) of 'topic' and 'action' responding

Readme

Node-Service

This is the service handler side of the SOA: : Working Example

Prequisites ( standard AMQP 0-9-1 )

  • AMQP Server/Cluster accepting connections with credentials. ( see Local setup )
  • Gateway Service(s)/Cluster(s) listening on responseTopic with CorrelationID. (@donsky/node-gateway )

Impliments:

  • NodeJS
  • AVRO Message Standards & Schema ( dependancy: avsc )
  • AMQP 0-9-1 Communication Standard ( dependancy: amqplib )
  • Babel 7 & ESNext plugins ( dependancy: babel-* )

Initialize Your Service

import Service from "@donsky/node-service"

new Service(/* { ...actions } */)

Configure

All of the following configurations must be handled in the env vars, or in config in the code. Examples below:

ENV VARS

Add the following to your bashrc, or bash profile depending on environment. I use docker-compose so I just attach them to the container environment. These will be picked up automatically by the default config file.

export HOSTNAME=consumerService
export MQ_PROTOCOL=amqp
export MQ_HOSTNAME=rabbitmq
export MQ_PORT=5672
export MQ_USERNAME=defaultAdmin
export MQ_PASSWORD=SomePassword
export MQ_QUEUE=consumerTopic
The hostname can be a URI or a local hostname, in this example, 'rabbitmq' is my docker container hostname. During deploy this would change and be environment specific.

Code

Service.configure({
  mq:{
    username: "defaultAdmin",
    password: "somePassword"
    hostname: "rabbitmq"
    port    : 5672,
    queue   : "consumerTopic"
  }
})

Action Object Options:

// action.js
import dep1 from "Dep1"

export const consumerActionName = {
  lambda: async function ( { firstName } ) {
    const lastName = await dep1()
    return { response: lastName }
  },
  requestAVRO : [
    { name: "firstName", type: "string" }
  ],
  responseAVRO: [
    { name: "response", type: "string" }
  ]
}

Events:

  • Error: See what's in the error variables for more detail, like so: serv.on( "error", err => console.log( err ) )
  • Connected Successfully connected to the message queue server serv.on( "connected", () => console.log( "Service Connected to MQ" ) )
  • Ready: App is ready and listening on the topic serv.on( "ready", topic => console.log( "All Ready: ", topic ))

Example:

"use strict"

import Service from "@donsky/node-service"
import * as actions from "./action"

Service.configure( { mq: { queue: "consumerTopic" } } )
const svc = new Service( actions )
svc.on( "error", error => console.error( error ) )
svc.on( "connected", () => console.log( "Connected" ) )
svc.on( "reconnecting", () => console.log( "...reconnecting" ) )
svc.on( "ready", () => console.log( "Service is ready" ) )

Notes:

  • Without any actions and responders the server should start, but it won't do much
  • This works well with PM2 (Process Manager 2)

Local:

May I recommend spinning up a docker environment for those prerequisites, and getting all the services talking:

# Note: I use a docker container
version: "3.8"
services:
  rabbitmq:
    image: rabbitmq:management
    ports:
     - "5672:5672"
     - "15672:15672"
    environment:
      # ${ENV_VAR} work here for values as well
      RABBITMQ_DEFAULT_USER: defaultAdmin
      RABBITMQ_DEFAULT_PASS: SomePassword
    restart: on-failure   

  service-auth:
    build:
      context: ./
    environment:
      - MQ_PROTOCOL=amqp
      - MQ_HOSTNAME=rabbitmq
      - MQ_PORT=5672
      - MQ_USERNAME=defaultAdmin
      - MQ_PASSWORD=SomePassword
      - MQ_QUEUE=consumerTopic
    depends_on:
      - rabbitmq
    restart: on-failure