Skip to content

Overview & Quick Start

Bun Runtime Health Integration

@nexload-sdk/healthcheck-bun

v2.1.0 Stable Released

Bun runtime adapter and Bun server metrics for @nexload-sdk/healthcheck.

Bun

@nexload-sdk/healthcheck-bun connects @nexload-sdk/healthcheck to the Bun JavaScript runtime and Bun.serve() HTTP server metrics.


import { createHealthManager, shutdownCheck } from "@nexload-sdk/healthcheck";
import { bunRuntimeAdapter, bunServerMetricsCheck } from "@nexload-sdk/healthcheck-bun";
const server = Bun.serve({
fetch: (req) => {
if (new URL(req.url).pathname === "/health") {
return health.run("readiness").then((r) => Response.json(r));
}
return new Response("OK");
},
});
export const health = createHealthManager({
service: { name: "bun-service" },
runtime: bunRuntimeAdapter(),
checks: [shutdownCheck(), bunServerMetricsCheck(server)],
});

  • Native Bun Runtime Adapter: Queries JavaScriptCore heap statistics, Bun process uptime, and platform architecture.
  • Bun.serve() Server Metrics: Observes pending requests and active WebSocket connections directly from the native Bun server handle.
  • Zero Node Dependencies: Implemented cleanly against Bun global APIs without unnecessary Node.js polyfills.

Terminal window
bun add @nexload-sdk/healthcheck-bun @nexload-sdk/healthcheck

Requires Bun >=1.0.0.