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

errortracksdk

v1.0.4

Published

Lightweight error tracking SDK for Node.js applications

Readme

🚀 ErrorTrack SDK

Lightweight, production-ready error tracking SDK for Node.js applications. Automatically capture crashes, unhandled promise rejections, and custom events, then send them to your ErrorTrack server for monitoring and debugging.


✨ Features

  • ⚡ Zero configuration setup
  • 🚀 Lightweight and fast
  • 🔥 Automatic exception tracking
  • 🛡 Captures uncaught exceptions
  • 📌 Captures unhandled promise rejections
  • 📝 Manual exception reporting
  • 💬 Custom log messages
  • 🏷 Attach metadata to errors
  • 🌍 Environment support
  • 🔒 API Key authentication
  • 📦 Zero runtime dependencies
  • 📊 Works seamlessly with the ErrorTrack Dashboard

📦 Installation

Using npm

npm install errortracksdk

Using yarn

yarn add errortracksdk

Using pnpm

pnpm add errortracksdk

⚡ Quick Start

const ErrorTrack = require("errortracksdk");

const client = ErrorTrack.init({
  apiKey: process.env.ERRORTRACK_API_KEY,
  endpoint: "https://your-domain.com/api/sdk/ingest",
  environment: "production",
});

That's it.

The SDK automatically starts listening for:

  • Uncaught Exceptions
  • Unhandled Promise Rejections

No additional setup required.


📖 Basic Example

const ErrorTrack = require("errortracksdk");

const client = ErrorTrack.init({
  apiKey: process.env.ERRORTRACK_API_KEY,
});

function divide(a, b) {
  if (b === 0) {
    throw new Error("Division by zero");
  }

  return a / b;
}

try {
  divide(10, 0);
} catch (err) {
  client.captureException(err);
}

🚨 Automatic Error Tracking

ErrorTrack automatically captures application crashes.

throw new Error("Something went wrong");

or

Promise.reject(new Error("Promise failed"));

Both will automatically appear in your ErrorTrack Dashboard.


📝 Manual Exception Tracking

try {
  riskyOperation();
} catch (error) {
  client.captureException(error);
}

📌 Exception With Metadata

Metadata helps you identify exactly where an error occurred.

client.captureException(error, {
  userId: "user_123",
  orderId: "ORD-12093",
  paymentMethod: "Stripe",
  feature: "Checkout",
});

Dashboard Output

Error:
Database Connection Failed

Metadata

userId : user_123
orderId : ORD-12093
paymentMethod : Stripe
feature : Checkout

💬 Capture Custom Messages

Not every important event is an exception.

You can also send informational messages.

client.captureMessage("Cache cleared successfully", "INFO");

Another example

client.captureMessage("Payment completed", "INFO");

🎯 Supported Log Levels

| Level | Description | |---------|------------| | INFO | Informational message | | DEBUG | Debug information | | WARNING | Warning message | | ERROR | Error message |

Example

client.captureMessage("Redis Connected", "INFO");

client.captureMessage("Disk usage is high", "WARNING");

client.captureMessage("API request failed", "ERROR");

🌍 Environment Configuration

Specify the environment to better organize errors.

const client = ErrorTrack.init({
  apiKey: process.env.ERRORTRACK_API_KEY,
  environment: "production",
});

Available values

  • development
  • testing
  • staging
  • production

⚙ Configuration

| Option | Type | Required | Default | Description | |----------|----------|-----------|------------|----------------------------| | apiKey | string | ✅ | — | Your Project API Key | | endpoint | string | ❌ | Default Server | Backend ingest endpoint | | environment | string | ❌ | production | Environment name |

Example

const client = ErrorTrack.init({
  apiKey: "project_api_key",

  endpoint:
    "https://api.example.com/sdk/ingest",

  environment: "production",
});

📚 API Reference


ErrorTrack.init()

Initialize the SDK.

const client = ErrorTrack.init(config);

Returns

ErrorTrackClient

client.captureException()

Capture an exception manually.

client.captureException(error);

With metadata

client.captureException(error, {
  userId: "101",
  tenantId: "company-1",
});

client.captureMessage()

Capture a custom message.

client.captureMessage(
  "Background worker started",
  "INFO"
);

📂 Complete Example

const ErrorTrack = require("errortracksdk");

const client = ErrorTrack.init({
  apiKey: process.env.ERRORTRACK_API_KEY,
  endpoint: "https://api.example.com/sdk/ingest",
  environment: "production",
});

async function main() {
  throw new Error("Database Connection Failed");
}

main();

Dashboard

✔ Error Captured

Message
Database Connection Failed

Environment
production

Timestamp
2026-07-24T18:30:21Z

Node Version
v22.17.0

Platform
linux

Stack Trace
...

📦 What Gets Captured?

Each event contains

  • ✅ Error Message
  • ✅ Stack Trace
  • ✅ Timestamp
  • ✅ Environment
  • ✅ Platform
  • ✅ Node.js Version
  • ✅ Hostname
  • ✅ Metadata
  • ✅ Severity
  • ✅ SDK Version

🔄 Error Lifecycle

Application

        │

        ▼

ErrorTrack SDK

        │

        ▼

Captures Error

        │

        ▼

Sends Event

        │

        ▼

ErrorTrack Backend

        │

        ▼

Dashboard

📈 Dashboard

Once events are received, you'll be able to

  • 📊 View all errors
  • 🔍 Search errors
  • 🏷 Filter by environment
  • 📌 View stack traces
  • 👤 View metadata
  • ⏰ View occurrence history

Dashboard screenshots can be added here after publishing.


🚀 Best Practices

✔ Use environment variables for API Keys.

apiKey: process.env.ERRORTRACK_API_KEY

✔ Send useful metadata

client.captureException(error, {
  userId,
  tenantId,
  feature: "Checkout",
});

✔ Keep environments separated

development

staging

production

🛣 Roadmap

  • ✅ Exception Tracking
  • ✅ Automatic Crash Detection
  • ✅ Promise Rejection Tracking
  • ✅ Metadata Support
  • ✅ Dashboard
  • ⏳ Express Middleware
  • ⏳ NestJS Integration
  • ⏳ Fastify Plugin
  • ⏳ Source Maps
  • ⏳ Session Replay
  • ⏳ Performance Monitoring
  • ⏳ Browser SDK
  • ⏳ React SDK

🤝 Contributing

Contributions are welcome!

git clone https://github.com/yourusername/errortracksdk.git

cd errortracksdk

npm install

npm run dev

Please open an Issue before submitting major changes.


📄 License

MIT License


❤️ Support

If you find this project useful, consider giving it a ⭐ on GitHub.

It helps others discover the project and motivates future development.


Made with ❤️ by the ErrorTrack Team