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

@telehost/jarvis-client

v0.1.0

Published

Jarvis monitoring agent client for Node.js — expose health metrics to the Jarvis autonomous monitoring agent via a standardized /jarvis/health endpoint. Works with Express, Fastify, Hono, and any middleware-based framework.

Downloads

126

Readme

@telehost/jarvis-client

Expose your Node.js app to Jarvis — the autonomous monitoring agent that watches your infrastructure and alerts you via WhatsApp when things go wrong.

npm license

What it does

Jarvis is an AI agent that polls your app every 15 minutes. If anything is off — queue backlog, dropped users, rising error rate, failed jobs — it sends you a WhatsApp message with evidence-based suggestions.

This package exposes a standardized /jarvis/health endpoint that Jarvis polls. You define what metrics to expose. The package handles auth, formatting, timeouts, and error isolation.

Installation

npm install @telehost/jarvis-client
# or
pnpm add @telehost/jarvis-client
# or
bun add @telehost/jarvis-client

Quick Start

Express

import express from 'express';
import { jarvisHealth } from '@telehost/jarvis-client/express';

const app = express();

app.get(
  '/jarvis/health',
  jarvisHealth({
    token: process.env.JARVIS_TOKEN!,
    appName: 'my-app',
    metrics: {
      users_active: async () => await User.count(),
      revenue_today: async () => await Order.sumToday(),
      queue: async () => ({
        pending: await jobQueue.count(),
        failed_1h: await jobQueue.failedInLastHour(),
      }),
    },
    alerts: {
      disk_low: async () => {
        const free = await getFreeDiskBytes();
        return free < 1_000_000_000
          ? { severity: 'critical', message: 'Less than 1GB disk free' }
          : null;
      },
    },
  })
);

Fastify

import Fastify from 'fastify';
import { jarvisPlugin } from '@telehost/jarvis-client/fastify';

const app = Fastify();

await app.register(jarvisPlugin, {
  token: process.env.JARVIS_TOKEN!,
  appName: 'my-app',
  metrics: {
    users_active: async () => await User.count(),
  },
});

Hono

import { Hono } from 'hono';
import { jarvisHandler } from '@telehost/jarvis-client/hono';

const app = new Hono();

app.get(
  '/jarvis/health',
  jarvisHandler({
    token: process.env.JARVIS_TOKEN!,
    appName: 'my-app',
    metrics: {
      users_active: async () => await User.count(),
    },
  })
);

Any other framework (manual)

import { JarvisManager, extractAndValidateToken } from '@telehost/jarvis-client';

const jarvis = new JarvisManager({
  appName: 'my-app',
  metrics: {
    users_active: async () => await User.count(),
  },
});

// In your route handler:
async function healthHandler(req, res) {
  const auth = extractAndValidateToken(
    req.headers.authorization,
    req.headers['x-jarvis-token'],
    process.env.JARVIS_TOKEN!
  );
  if (!auth.valid) return res.status(401).json({ error: 'unauthorized' });

  const payload = await jarvis.buildPayload();
  res.json(payload);
}

Setup in 3 steps

  1. Get your token from https://jarvis.telehost.net/dashboard
  2. Set JARVIS_TOKEN=jrv_app_abc123... in your .env
  3. Add the adapter to your app (see examples above)

Verify:

curl -H "Authorization: Bearer $JARVIS_TOKEN" http://localhost:3000/jarvis/health

Response:

{
  "app": "my-app",
  "version": "1.0",
  "timestamp": "2026-04-19T14:30:00Z",
  "status": "healthy",
  "metrics": {
    "users_active": 1247,
    "revenue_today": 82340.50,
    "queue": { "pending": 3, "failed_1h": 0 }
  },
  "alerts": [],
  "custom": {}
}

What your closures can return

Metrics

  • Scalars: number, string, boolean
  • Objects (for grouped metrics):
    queue: async () => ({
      pending: 5,
      failed_1h: 0,
      by_type: { email: 2, webhook: 3 },
    })
  • null (metric skipped this cycle)

Alerts

// Alert triggered
return { severity: 'info' | 'warning' | 'critical', message: 'Human-readable' };

// No alert
return null;

Features

  • Error isolation: one failing metric doesn't break the payload
  • Timeout protection: metrics that take too long are cancelled (default 5s, configurable)
  • Timing-safe auth: resistant to timing attacks on the bearer token
  • Zero peer dependencies: works with any Node.js HTTP framework
  • First-class TypeScript: fully typed, strict mode friendly
  • Tiny: <5KB gzipped

Configuration

new JarvisManager({
  appName: 'my-app',       // Name shown in Jarvis alerts
  appVersion: '1.2.3',     // Reported in payload
  metrics: { /* ... */ },
  alerts: { /* ... */ },
  custom: { /* ... */ },
  metricTimeoutMs: 5000,   // Max time per metric (default)
});

Why WhatsApp?

Because you don't have Slack open at 3am when your queue is backed up. You have WhatsApp.

License

MIT © TeleHost C.A.

Related