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

@node-observatory/express

v1.2.0

Published

A Express.js server adapter for Node Observatory dashboard.

Readme

@node-observatory/express

An Express.js server adapter for Node Observatory — a real-time monitoring dashboard for Node.js applications.

Installation

npm install @node-observatory/express @node-observatory/api

Quick Start

import { createObserver } from "@node-observatory/api";
import { ExpressAdapter } from "@node-observatory/express";
import express from "express";
import mysql2 from "mysql2/promise";
import { createClient } from "redis";

const app = express();

// Set up your DB and Redis connections
const connection = await mysql2.createConnection({
  /* ...options */
});
const redisClient = createClient();
await redisClient.connect();

// Mount the Observatory UI at /ui
const expressAdapter = new ExpressAdapter();
expressAdapter.setBasePath("/ui");
app.use("/ui", expressAdapter.getRouter());

// Initialize the observer
await createObserver(
  expressAdapter,
  { uiBasePath: undefined },
  "mysql2",
  connection,
  redisClient,
);

app.listen(3000, () => console.log("Server running on port 3000"));

Navigate to http://localhost:3000/ui to open the dashboard.

How It Works

ExpressAdapter implements the IServerAdapter interface expected by @node-observatory/api. When createObserver is called it:

  1. Runs database migrations.
  2. Initialises watchers for every monitored resource.
  3. Calls the methods below on the adapter to wire up static assets, API routes, the SPA entry point, and a global error handler — all under your chosen base path.

API

new ExpressAdapter()

Creates a new adapter that wraps a fresh Express application instance.

.setBasePath(path: string): ExpressAdapter

Sets the URL prefix under which the dashboard is mounted (e.g. "/ui"). Returns this for chaining.

.setStaticPath(route: string, dir: string): ExpressAdapter

Serves a directory of static files at route. Redirect and index auto-serving are disabled so the SPA router stays in control. Returns this for chaining.

.serveHtmlFile(route: string, filePath: string): ExpressAdapter

Registers a GET handler that sends a single HTML file. Returns this for chaining.

.setApiRoutes(routes: AppControllerRoute[]): ExpressAdapter

Mounts a JSON API router for all Observatory data endpoints. Each route descriptor provides method, route, and handler. Async handlers are wrapped so errors propagate to Express's error-handling pipeline. Returns this for chaining.

.setEntryRoute(routeDef: AppViewRoute): ExpressAdapter

Registers the SPA catch-all route(s). Before sending index.html, the adapter injects a window.SERVER_CONFIG script block containing the base path so the frontend knows where it is mounted. Returns this for chaining.

.setErrorHandler(handler): ExpressAdapter

Registers a custom error handler that maps thrown errors (including statusCode) to a { status, body } response shape. Returns this for chaining.

.getRouter(): Express

Returns the underlying Express application so it can be mounted on a parent app via app.use(basePath, adapter.getRouter()).

What Observatory Monitors

The package works alongside @node-observatory/api, which instruments the following libraries automatically via monkey-patching:

| Category | Libraries | | ----------------- | ---------------------------------------------------------------------------------------- | | HTTP requests | axios, node-fetch, native http, undici | | Databases | mysql, mysql2, pg, mongoose, prisma, sequelize, typeorm, knex, sqlite3 | | Caching | redis, ioredis, node-cache, memjs, keyv, lru-cache, level | | Queues / jobs | bull, agenda, bree | | Schedulers | node-cron, node-schedule | | Mailers | nodemailer, sendgrid, mailgun, postmark, aws-ses | | Notifications | pusher, ably | | Logging | pino, winston, bunyan, log4js, loglevel, signale | | Express | Incoming HTTP request tracking |

Requirements

  • Node.js ≥ 18
  • Express 4 or 5
  • A MySQL-compatible database (MySQL 8 / MariaDB)
  • Redis

License

MIT