@nineup/node
v0.1.2
Published
Official Node.js SDK for Nineup — deep health checks, heartbeats, and events for your services.
Readme
@nineup/node
Official Node.js SDK for Nineup — deep health checks, heartbeats, and events.
npm install @nineup/nodeQuickstart
import { createNineup } from "@nineup/node";
import { drizzleAdapter, redisAdapter, httpAdapter } from "@nineup/node/adapters";
const nineup = createNineup({
apiKey: process.env.NINEUP_API_KEY,
monitorId: process.env.NINEUP_MONITOR_ID,
});
nineup.check("postgres-prod", drizzleAdapter(db));
nineup.check("redis-shared", redisAdapter(redis));
nineup.check("stripe", httpAdapter("https://api.stripe.com/healthz"));
// Expose health at any HTTP route:
// (for Next.js use @nineup/next instead)
http.createServer(nineup.httpHandler()).listen(3000);What this does — and only this
Three primitives, by design:
- Checks — declarative health probes for dependencies.
- Heartbeats — wrap things Nineup can't poll (cron, ETL).
- Events — discrete annotations (deploy markers, custom signals).
No automatic error capture, no tracing, no metrics, no logs. Use the right tool for those.
Heartbeats
await nineup.heartbeat(process.env.NINEUP_HEARTBEAT_TOKEN!, async () => {
await runNightlyBackup();
});If the function throws, the SDK reports status: "fail" with the message and duration, then re-throws.
Events
await nineup.event({
type: "deploy",
message: "Shipped v1.2.4",
metadata: { commit: process.env.VERCEL_GIT_COMMIT_SHA },
});Adapters
Adapters are just functions matching the CheckFn signature. Ship-with:
httpAdapter(url)— generic external probedrizzleAdapter(db)— Drizzle ORMpostgresAdapter(client)—pg,postgres-jsredisAdapter(client)—ioredis,node-redis
Writing your own is just a function:
nineup.check("queue", async () => {
const depth = await queue.depth();
if (depth > 1000) return { status: "warn", message: `depth=${depth}` };
return true;
});Topology
When multiple of your services emit a check with the same name (e.g. postgres-prod), Nineup automatically draws an edge in your account's dependency graph. One failed shared dep → one incident covering all affected services. No extra config beyond consistent naming.
License
MIT
