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

@json-express/plugin-health

v2.0.0

Published

Advanced health check plugin for json-express

Downloads

30

Readme

@json-express/plugin-health

Advanced health check plugin for JSONExpress v2. Replaces the built-in baseline /health endpoint with a deep, database-aware health probe—ideal for Kubernetes liveness/readiness probes and enterprise observability pipelines.


How It Works

JSONExpress ships with a safe, static baseline /health endpoint baked into the CLI:

{ "status": "UP" }

This is enough to prevent orchestrators (K8s, AWS ALB) from declaring your container dead. However, in production you often need to know whether your database is actually reachable.

When you install @json-express/plugin-health, the CLI's Auto-Discovery Engine detects it and yields the baseline, allowing this plugin to register a fully dynamic health handler in its place.


Installation

npm install @json-express/plugin-health

JSONExpress will detect this plugin automatically. No registration code required.


Endpoints

GET /health

Returns the real-time health of the active database adapter.

Healthy response (200 OK):

{
  "status": "UP",
  "database": "connected"
}

Unhealthy response (503 Service Unavailable):

{
  "status": "DOWN",
  "database": "disconnected"
}

If an unexpected exception is thrown during the health check:

{
  "status": "DOWN",
  "error": "Connection timeout"
}

GET /info

Available out-of-the-box from the CLI baseline regardless of this plugin. Returns runtime observability metadata:

{
  "environment": "production",
  "uptimeSeconds": 3621.47,
  "timestamp": "2026-04-03T08:13:00.000Z",
  "system": {
    "nodeVersion": "22.18.0",
    "platform": "linux",
    "memoryUsageMb": 64.3
  }
}

Database Adapter Support

The health check calls db.isHealthy() on the active adapter. Support depends on whether the adapter implements this optional method:

| Adapter | isHealthy() support | Notes | |---|---|---| | adapter-memory | ✅ Always returns true | In-memory is always up | | adapter-mongodb (future) | ✅ Pings the connection | Returns false on timeout | | adapter-postgres (future) | ✅ Runs SELECT 1 | Returns false on error |

If the adapter does not implement isHealthy(), the plugin gracefully falls back to "UP".


Configuration

Disable the /health endpoint entirely via .env:

jex.transport.express.health=false

Architecture Note

This plugin implements the IPlugin interface and uses the Kernel's Awilix IoC container to resolve the active Transport and Database Adapter at boot time — keeping all layers fully decoupled.

CLI Auto-Discovery
  └─ Detects plugin-health → skips BaselineHealthPlugin
       └─ AdvancedHealthPlugin.onBoot(kernel)
            ├─ resolves transport → registers route
            └─ resolves database → calls isHealthy() per request