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

elysia-healthcheck

v1.0.0

Published

Healthcheck plugin for Elysia.js

Readme

Elysia.js Healthcheck Plugin

Healthcheck plugin for Elysia.js that provides configurable health endpoints with custom checks and TypeBox schema validation.

Installation

bun add elysia-healthcheck elysia
# or
npm install elysia-healthcheck elysia
# or
yarn add elysia-healthcheck elysia

Concepts

This plugin follows Kubernetes health check conventions and cloud-native best practices:

Liveness vs Readiness

  • Liveness (/healthz/live) — Determines if the application is running and should continue running. If this fails, the application should be restarted. Use for checking critical dependencies like database connections.

  • Readiness (/healthz/ready) — Determines if the application is ready to receive traffic. If this fails, traffic should be temporarily stopped but the application shouldn't be restarted. Use for checking if caches are warmed up, migrations completed, etc.

  • Overall (/healthz) — General health endpoint without specific checks, always returns healthy with uptime information.

Why /healthz?

The /healthz path follows the Kubernetes HTTP health check convention and is widely adopted across cloud-native applications. The z suffix avoids conflicts with application routes while being memorable and standardized.

Usage

Basic Setup

import { Elysia } from 'elysia';
import { healthcheckPlugin } from 'elysia-healthcheck';

const app = new Elysia().use(healthcheckPlugin()).listen(3000);

This creates three health endpoints:

  • GET /healthz — Overall health status
  • GET /healthz/live — Liveness check
  • GET /healthz/ready — Readiness check

Custom Paths

const app = new Elysia().use(
  healthcheckPlugin({
    prefix: '/health',
    paths: {
      liveness: '/liveness',
      readiness: '/readiness',
    },
  }),
);

Health Checks

Add custom health check functions for liveness and readiness endpoints:

const app = new Elysia().use(
  healthcheckPlugin({
    checks: {
      liveness: [
        () => ({ name: 'database', healthy: true }),
        async () => {
          const isHealthy = await checkRedisConnection();
          return {
            name: 'redis',
            healthy: isHealthy,
            details: { host: 'localhost:6379' },
          };
        },
      ],
      readiness: [() => ({ name: 'migrations', healthy: true })],
    },
    timeoutMs: 3000,
  }),
);

Type Safety

This plugin is fully typed and works seamlessly with Elysia's Treaty client:

import { treaty } from '@elysiajs/eden';
import { Elysia } from 'elysia';
import { healthcheckPlugin } from 'elysia-healthcheck';

const app = new Elysia().use(healthcheckPlugin());
const client = treaty(app);

// Fully typed health check calls
// Will also handle custom endpoints
const health = await client.healthz.get();
const liveness = await client.healthz.live.get();
const readiness = await client.healthz.ready.get();

Response Format

Health endpoints return structured JSON responses:

{
  "healthy": true,
  "uptime": 42.123,
  "checks": {
    "database": {
      "healthy": true,
      "details": { "host": "localhost:5432" }
    },
    "redis": {
      "healthy": false,
      "details": { "error": "Connection timeout" }
    }
  }
}

Configuration

| Option | Type | Default | Description | | ------------------ | ----------------- | ---------- | ------------------------------------------- | | prefix | string | /healthz | Base path for all health endpoints | | paths.liveness | string | /live | Liveness check endpoint path | | paths.readiness | string | /ready | Readiness check endpoint path | | checks.liveness | CheckFunction[] | [] | Functions for liveness checks | | checks.readiness | CheckFunction[] | [] | Functions for readiness checks | | timeoutMs | number | 5000 | Timeout for check functions in milliseconds |

HTTP Status Codes

  • 200 OK — All checks passed or no checks configured
  • 503 Service Unavailable — One or more checks failed

License

MIT