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

admin-error-monitor-package

v1.0.0

Published

Reusable Express middleware for error log monitoring with EJS dashboard UI.

Readme

error-monitor-package

Reusable error-monitoring dashboard middleware for Express apps with bundled EJS UI, filtering, pagination, and bulk actions.

Overview

error-monitor-package provides a plug-and-play admin dashboard to inspect and manage application errors.

Key features:

  • Provider-based architecture (no built-in DB dependency)
  • Bundled EJS templates and static assets
  • Filtering by severity, status, and date range
  • Pagination and severity sorting
  • Bulk select/delete
  • Mark fixed/pending from list or detail/edit screen
  • Optional purge-all-fixed action

Installation

npm install error-monitor-package

Basic Usage

import express from "express";
import { errorMonitor, type ErrorLog } from "error-monitor-package";

const app = express();

app.use(
  "/admin/errors",
  errorMonitor({
    getData: async (filters) => {
      // return either ErrorLog[] or { data, total }
      return { data: [], total: 0 };
    },
    getById: async (id) => null,
    deleteLogs: async (ids) => {},
    updateStatus: async (id, status) => {},
    purgeFixed: async () => {},
    options: {
      pageSize: 20,
      enableBulkActions: true,
      enableDeleteAll: true
    }
  })
);

Data Contract

export interface ErrorLog {
  id: string;
  message: string;
  severity: "low" | "medium" | "high";
  status: "pending" | "fixed";
  createdAt: Date;
  meta?: any;
}

Data Mapping Example

Example with Mongo documents:

import ErrorLogModel from "./models/ErrorLog";
import type { ErrorLog } from "error-monitor-package";

function mapDoc(doc: any): ErrorLog {
  return {
    id: String(doc._id),
    message: doc.errorMessage,
    severity: doc.severity ?? "low",
    status: doc.resolutionStatus ?? "pending",
    createdAt: doc.createdAt,
    meta: {
      method: doc.method,
      path: doc.path,
      stack: doc.stack
    }
  };
}

API Reference

errorMonitor(config)

Returns an Express.Router middleware that you mount with:

app.use("/admin/errors", errorMonitor(config));

Config

Required:

  • getData(filters)
    Receives normalized filters (page, limit, severity, status, createdFrom, createdTo, sortOrder) and returns either:
    • ErrorLog[] or
    • { data: ErrorLog[]; total: number }
  • deleteLogs(ids)
  • updateStatus(id, status)

Optional:

  • getById(id) for detail and edit pages
  • purgeFixed() for delete-all-fixed action

Options

{
  pageSize?: number;          // default: 10
  enableBulkActions?: boolean; // default: true
  enableDeleteAll?: boolean;   // default: true
}

Features

Filtering

  • Severity: low | medium | high
  • Status: pending | fixed
  • Date range: createdFrom, createdTo

Pagination

  • Server-side paging via page + limit
  • Total pages computed from provider total count

Bulk Actions

  • Select all / deselect all current page rows
  • Bulk update status to fixed/pending
  • Bulk delete selected rows
  • Optional purge all fixed rows

Customization

  • Use provider callbacks to connect any datastore (Mongo, SQL, API, files, etc.)
  • Use options to enable/disable bulk and destructive actions
  • Extend meta payload for custom detail rendering context

Folder Structure

error-monitor/
├── src/
│   ├── core/
│   ├── middleware/
│   ├── public/
│   ├── types/
│   ├── utils/
│   ├── views/
│   └── index.ts
├── package.json
├── tsconfig.json
└── tsup.config.ts

Development

npm install
npm run build

Example App

A runnable Express sample is included at:

  • examples/express-app

Run it with:

cd examples/express-app
npm install
npm start

Build output:

  • dist/index.js (ESM)
  • dist/index.cjs (CommonJS)
  • dist/index.d.ts (types)
  • dist/views/*, dist/public/* (bundled assets)

Contribution Guide

  1. Fork and clone the repository.
  2. Install dependencies with npm install.
  3. Implement changes in src/.
  4. Run npm run build and verify middleware behavior.
  5. Open a PR with a clear summary and test notes.