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

clug

v0.0.3

Published

Cluster management and logging tool

Readme

clug

NodeJs Cluster management and logging tool

What does this tool do?

  • Simplifies cluster/worker setup
  • Automatically revives dead workers
  • Supports worker connection affinity (sticky sessions)
  • Collects all worker logs in one place
  • Automatically formats logs and writes them to a file
  • Falls back to single process for debugging
  • Monitors memory per worker and restarts worker if limit reached
  • Gracefully closes server connections on shutdown or crash

Usage

Basic

var Clug = require('clug');

Clug('./my-script', {
  logPath: '/var/logs/my-script'
});

This will automatically create workers that run my-script.js. By Default it will create as many workers as there are cores on the sytem with a minimum of two (for resiliency).

Sticky sessions

master.js

var Clug = require('clug');

Clug('./my-script', {
  logPath: '/var/logs/my-script',
  sticky: 8001
});

This will automatically route requests to port 8001 to the same worker for every request from the same remote address. Clug automatically handles the intricacies of address sharing for workers so you can code your worker as if it was a master.

For Example:

worker.js

var http = require('http');

server.listen(8001, function(){
  console.info('Server listening on', 8001);
});

This worker listens on the same address as the master so it will be handled by clug.

API

Clug(path, [opts])

  • path:String - path to script, used just like require
  • opts:Object - options for clug
    • logLevel:String - winston logger log level, defaults to 'debug'
    • logPath:String - directory to put logs into, defaults to root directory of node app
    • workers:Number - number of workers to create, defaults to number of cores with a minimum of two
    • sticky:String|Number|Object|Array - address or addresses to setup sticky sessions for
      • can be port or socket path
      • can be object {host, port, path} (node v0.12+)
      • can be an array of multiple addresses
    • memoryLimit:Number - number of bytes in memory allowed per worker