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

callcatcher

v1.3.4

Published

Your native NodeJS monitoring API

Downloads

6

Readme

npm version Package Quality codecov Language grade: JavaScript CallCatcher

Your native NodeJS monitoring API

CallCatcher is a flyweight typescript API managing request monitoring for NodeJS apps natively. Requests and responses saved locally, and redistributed to the developer through NeDB. It is then up to the developer to make use of the distributed data.

Installation

$ npm install callcatcher --save

Building

To build the project, run the following command

$ npm run build

Please make sure you lint the project before building it

$ npm run lint

or

$ npm run lint:fix

Documentation

To generate the documentation use the following command :

$ npm run doc

This will generate a new docs folder located at the project's root. The entrypoint to the documentation is the index.html file.

Running tests

To run unit test use the following command :

$ npm run test

This will generate a new coverage folder located at the project's root. This folder is used by codecov to calculate the coverage of the tests.

API

Methods

Probing

The first step for monitoring your server is probing. When creating a server using any NodeJS compatible library, the freshly created http.Server can be probed using the probe() method.

Calling the probe() method on a http.Server instance, lets the API know that all ingoing and outgoing http messages should be saved and used later on during reporting.

See probe.

Probing example

Using Express
const monitor = require('callcatcher');
const express = require('express');

const app = express();
app.use(express.json());

// let the express app it has to listen for GET requests on the /icecream route
app.get('/icecream', (req,res) => {
    res.status(200).json(/* data */);
})


// create a new http.Server using Express (or any other framework, or even none...)
const server = app.listen(8080, () => {
    console.log("Listening on port 8080");
});

// Probe the running server
monitor.probe(server);

Reporting

The second step of monitoring you NodeJS app using CallCatcher is reporting. After probing your http.Server, the last step is to get the data back. The is where the report() method comes in handy.

The report() method creates a Report instance, which is nothing more than a superset of a NeDB database instance. NeDB methods can be used on the outputted data. For more information on how to use NeDB, please refer to the official NeDB github page.

See report.

Reporting example

Using Express
const monitor = require('callcatcher');

const server = /* init a new http.Server */;

// Probe the running server
monitor.probe(server);

// Create a new route to get the monitoring data back.
app.get('/stats', (req,res) => {
    res.status(200).json(monitor.report(server).getAllData());
})

Data structures

Report

A Report is an extension of a NeDB database containing Hits.

export class Report extends Nedb<Hit> {}

Hit

A Hit is the data structure of a single api call, which contains information on the request and the response.

export interface Hit {
  response: {
    status: {
      code: number;
      message: string;
    }
    datetime?: number;
  };
  request: {
    httpVersion: string;
    url?: string;
    method?: string;
    headers: IncomingHttpHeaders;
    body: object;
    datetime: number;
  };
}

Events

Report

onHit

When inserting documents (a.k.a. hits to a report), the hit event gets fired, containing the inserted documents :

// models/report.ts
// line 40
            this.emit('hit', documents);

The emitted documents can then be used as such :

const server: Server = /* init a new http.Server */;
const rep: Report = await report(server);
// A hit gets added to the report
rep.on('hit', (docs: Hit[]) => {
  console.log(docs);
});

onError

Similarly, as the hit event, the error event gets emitted with and error message when an error occurred when adding one or many hits to the report.

const server: Server = /* init a new http.Server */;
const rep: Report = await report(server);
// A hit gets added to the report, but an error occurres ...
rep.on('error', (err: Error) => {
  console.err(err);
});