Node.js SDK

@vigilry/node

The official Node.js SDK for the Vigilry Risk Engine. Send events and capture errors from any Node.js application with a single function call.

npm@vigilry/nodeversion0.1.5Node.js>= 18.0.0licenseMIT

Features

  • Zero dependencies — uses native fetch() (Node.js ≥ 18)
  • Never throws — all errors are caught and logged to console
  • TypeScript-first with full type definitions included
  • captureError() automatically extracts Error name, message, and stack
  • Correlation context for grouping related events (user_id, order_id, etc.)
  • Configurable base URL — point to self-hosted or cloud deployments

Quick Install

bash
npm install @vigilry/node

Basic Usage

app.ts
import { Vigilry } from "@vigilry/node";

const vigilry = new Vigilry({ apiKey: process.env.VIGILRY_API_KEY! });

// Capture a custom event
await vigilry.capture({
  type: "checkout_started",
  severity: "info",
  message: "User initiated checkout",
  correlation: { user_id: "usr_99", order_id: "ord_4421" },
});

// Capture an unhandled error
try {
  await processPayment(order);
} catch (err) {
  await vigilry.captureError(err, {
    path: "/api/checkout",
    method: "POST",
    status_code: 500,
    correlation: { order_id: order.id },
  });
  throw err;
}

SDK Guides