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

xecurecode-node-sdk

v0.1.0

Published

AI-driven reliability SDK for Node.js applications

Downloads

104

Readme

@xecurecode/node-sdk

AI-driven reliability SDK for Node.js applications.

The official Node.js SDK for the XecureTrace Reliability Platform — a human-first failure analysis and recovery recommendation system.


Why This SDK Exists

Modern backend systems fail in unpredictable ways.

This SDK:

  • Captures structured runtime errors
  • Generates deterministic fingerprints
  • Classifies error types (DATABASE, NETWORK, VALIDATION, etc.)
  • Determines severity
  • Sends non-blocking telemetry to your backend
  • Never crashes your application

AI assists. Humans decide. Nothing executes automatically.


Installation

npm install @xecurecode/node-sdk

Requirements

  • Node.js 18+
  • TypeScript (recommended)
  • Express (optional, for middleware)

Quick Start

1️⃣ Initialize the SDK

import { ReliabilityClient } from "@xecurecode/node-sdk";

const reliability = new ReliabilityClient({
  apiKey: "your-api-key",
  service_id: "your-service",
  mode: "development"
});

Configuration Options: | Option | Required | Description | |--------|----------|-------------| | apiKey | Yes | Your API key | | service_id | Yes | Service identifier | | mode | Yes | development or production | | timeout | No | Request timeout (default: 5000ms) |


2️⃣ Automatic Global Error Capture

The SDK automatically tracks:

  • uncaughtException
  • unhandledRejection
// This will be automatically captured
throw new Error("Database timeout");

3️⃣ Express Integration

Add the middleware after all routes and include an error handler:

import express from "express";
import { ReliabilityClient } from "@xecurecode/node-sdk";

const reliability = new ReliabilityClient({
  apiKey: "your-api-key",
  service_id: "my-service",
  mode: "development"
});

const app = express();

// Your routes
app.get("/api/users", (req, res) => {
  throw new Error("Database connection failed");
});

// Add SDK middleware AFTER all routes
app.use(reliability.middleware());

// Error handler (required for Express to work properly)
app.use((err, req, res, next) => {
  res.status(500).json({ error: err.message });
});

app.listen(3000);

4️⃣ Manual Capture

try {
  riskyOperation();
} catch (err) {
  reliability.capture(err);
}

// With request context
reliability.capture(err, req);

What Gets Sent

Example structured payload:

{
  "message": "Database connection failed",
  "name": "Error",
  "fingerprint": "a8c39c21...",
  "timestamp": 1700000000000,
  "service_id": "my-service",
  "environment": "development",
  "severity": "critical",
  "errorType": "DATABASE",
  "serviceContext": {
    "pid": 12345,
    "nodeVersion": "v20.0.0",
    "platform": "linux",
    "hostname": "server-01"
  },
  "requestContext": {
    "method": "GET",
    "url": "/api/users",
    "ip": "10.0.0.5"
  },
  "occurrenceCount": 1
}

Error Classification

The SDK automatically categorizes errors:

| Type | Example | |------|---------| | DATABASE | Timeout, SQL errors, connection issues | | NETWORK | Fetch failures, socket errors | | VALIDATION | Invalid input, type errors | | RUNTIME | Standard JS errors | | UNKNOWN | Fallback |


Severity Detection

  • Critical → Database, timeout, connection errors
  • Warning → Validation, recoverable issues

Design Guarantees

  • Non-blocking HTTP calls
  • Timeout protected (5s default)
  • Retry logic (3 attempts)
  • Deduplication (1-minute window)
  • Rate limiting
  • Never throws inside SDK
  • Never crashes host application
  • No sensitive data leakage

API Reference

ReliabilityClient

const client = new ReliabilityClient(config);

// Capture an error
client.capture(error);
client.capture(error, requestContext);

// Express middleware
const middleware = client.middleware();

// Graceful shutdown
await client.flush();
client.shutdown();

Development

cd node_sdk
npm install
npm run build

Build outputs:

dist/
├── index.js      (CommonJS)
├── index.mjs     (ESM)
├── index.d.ts

Testing

Run the test server:

cd test_sdk
npm install
node index.ts

License

MIT