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

@varta-health/client

v0.1.0

Published

Health protocol client for distributed local agents (Varta VLP v0.2).

Readme

Varta — Node.js client

npm License

Production Node.js client for the Varta health protocol. Emits 32-byte VLP heartbeats to a varta-watch observer over plaintext UDP or ChaCha20-Poly1305-encrypted UDP. Written in TypeScript; ships compiled .js + .d.ts. Zero npm runtime dependencies — the AEAD primitives come from Node's built-in node:crypto.

npm install @varta/client

Quickstart

import { Varta, Status } from "@varta/client";

const agent = await Varta.connectUdp("127.0.0.1", 5876);
setInterval(() => {
  const outcome = agent.beat(Status.Ok);
  if (outcome.kind === "dropped") {
    // Observer absent, kernel queue full, peer gone, or disk full.
    // Treat as a no-op; the next beat will retry.
  }
}, 500);

API parity with varta-client (Rust)

| Rust | Node.js | | --------------------------------------------------- | --------------------------------------------------------------------------- | | Varta::connect(path) (UDS) | Not supported in 0.1.0 — see "Non-goals" below | | Varta::connect_udp(addr) | Varta.connectUdp(host, port) | | Varta::connect_secure_udp(addr, key) | Varta.connectSecureUdp(host, port, key) | | Varta::connect_secure_udp_with_master(addr, mkey) | Varta.connectSecureUdpWithMaster(host, port, masterKey) | | Varta::beat(status, payload) -> BeatOutcome | Varta.beat(status, payload) -> BeatOutcome | | BeatOutcome::{Sent, Dropped, Failed} | BeatOutcome (discriminated union: { kind: "sent" \| "dropped" \| "failed" }) | | DropReason::{KernelQueueFull, NoObserver, PeerGone, StorageFull} | DropReason enum — same four variants | | BeatError { errno, kind } | BeatError extends Error with errno and kind fields | | classify_send_error | classifySendError(err) | | Varta::reconnect, set_reconnect_after | reconnect(), setReconnectAfter(n) | | Varta::clock_regressions(), fork_recoveries() | clockRegressions(), forkRecoveries() — return bigint | | install_panic_handler* | panic.installSignalHandlerUdp / installSignalHandlerSecureUdp | | panic::run (defer/recover) | panic.run(fn) |

Hard invariants

The Node.js client preserves the Rust client's wire-level contract:

  1. Non-blocking I/O. Every socket is non-blocking. A kernel-queue-full send surfaces as { kind: "dropped", reason: DropReason.KernelQueueFull }, never a block.
  2. Per-emission process.pid. No PID caching — forked children report their own identity on the next beat. Fork auto-recovery refreshes the transport (and, for secure-UDP, re-reads OS entropy via crypto.randomBytes) before the frame leaves the child.
  3. Commit-on-success nonces. Secure-UDP's per-emission IV counter advances only after socket.send resolves successfully. A dropped beat does NOT consume a nonce, eliminating cross-fork nonce reuse.
  4. Wire-format conformance. The package ships a test that loads tools/vlp-test-vectors.json (the same fixture the Rust crate verifies against) and asserts byte-equality for every CRC, frame, and AEAD vector. Drift between languages is impossible without breaking both tests in the same PR.

Non-goals (0.1.0)

  • Unix Domain Sockets. Node's stdlib does not expose AF_UNIX / SOCK_DGRAM; only stream-mode unix: sockets are reachable from node:net. Shipping UDS support would require a native addon and break the zero-dep posture. For same-host deployments use Varta.connectUdp("127.0.0.1", port) — loopback is the same security domain. If you need authenticated same-host transport, use Varta.connectSecureUdp against 127.0.0.1 with a key configured on the observer.
  • accept-degraded-entropy secure-UDP variant. Reserved for embedded targets that lack /dev/urandom; Node itself does not run on such targets.
  • Browser support. This package targets Node.js ≥ 18 LTS only. It uses node:dgram, node:crypto, node:os, and node:process.

Latency note

Node cannot match the ~1 µs-per-beat budget of the Rust client. Measured cost on a modern x86_64 host is ~5–15 µs per beat() including frame allocation, UDP send, and outcome dispatch. The Node client is intended for tooling, batch jobs, Express/Fastify sidecars, and process supervisors — not for tight inner loops emitting kilo-beats per second.

Secure UDP

import { Varta, Status } from "@varta/client";
import { readFileSync } from "node:fs";

const key = readFileSync("/etc/varta/secure.key");   // 32 raw bytes
const agent = await Varta.connectSecureUdp("127.0.0.1", 5876, key);
agent.beat(Status.Ok);

ChaCha20-Poly1305 and HKDF-SHA256 are stdlib in Node ≥ 15.0; no extra install is required.

Panic hook

import { panic } from "@varta/client";

panic.installSignalHandlerUdp("127.0.0.1", 5876);
// any uncaught exception, unhandled rejection, or terminating
// signal (SIGTERM/SIGINT/SIGQUIT/SIGHUP) now emits a Critical beat
// with nonce=NONCE_TERMINAL before the process exits.

For deferred panic emission inside an async pipeline:

await panic.run(async () => {
  await mainLoop();   // any throw inside emits Critical, then re-throws
});

The handler pre-binds its socket at install time so emission is async-signal-safe — no allocation or DNS in the hot path.

Stability

  • Wire format: VLP v0.2, governed by book/src/spec/vlp.md in the workspace. Cross-language byte-equality is enforced by the conformance test suite.
  • Node API: 0.x — refinements may land without deprecation cycles until 1.0.
  • Node version: 18 LTS minimum. CI runs against Node 18, 20, 22.