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

prod-alert-sentry

v1.1.0

Published

Enterprise-grade error monitoring with smart Slack alerts and automatic data format conversion. Used in production for lawyer booking platforms serving 10k+ daily users.

Downloads

385

Readme

🚨 prod-alert-sentry

Enterprise-grade error monitoring with smart Slack alerts and automatic data format conversion.

npm version License: MIT

✨ Features

Real-time Slack Alerts - 3 severity levels (HIGH/🚨, MEDIUM/⚠️, LOW/ℹ️)
Automatic Format Conversion - Convert between JSON, CSV, TXT on-the-fly
Production-Ready - Used in production for 10,000+ daily users
File Attachments - Attach error context as files
Smart Parsing - Handle nested objects, arrays, errors
Auto Cleanup - Temporary file management
TypeScript Support - Full type safety

🚀 Quick Start

Installation

npm install prod-alert-sentry
# or
yarn add prod-alert-sentry

# 🚀 Quick Start

## 1️⃣ Initialize (Once at App Startup)

```ts
import alert from "prod-alert-sentry";

alert.init(
  process.env.SLACK_TOKEN_ID!,
  process.env.CHANNEL_NAME!,
  process.env.CHANNEL_ID!
);

2️⃣ Send a Simple Alert

try {
  throw new Error("Database connection failed");
} catch (error) {
  alert.high(error);
}

That’s it.
You’ll instantly receive a Slack message.


🔥 Severity Levels

| Method | Use Case | |--------|----------| | alert.high() | Critical production failures | | alert.medium() | Warnings / performance issues | | alert.low() | Informational events |

Example:

alert.medium("API rate limit exceeded");

📎 File Attachments (Direct Creation)

JSON File

alert.medium("API error", {
  fileData: {
    service: "user-service",
    errorCode: "ERR-500",
    userId: 12345
  },
  fileType: "json",
  fileName: "api-error-details",
  comment: "JSON file created from object"
});

CSV File (Array of Objects)

alert.low("User export completed", {
  fileData: [
    { id: 1, name: "John", status: "active" },
    { id: 2, name: "Jane", status: "inactive" }
  ],
  fileType: "csv",
  fileName: "user-export"
});

TXT File

alert.high("Server logs attached", {
  fileData: "Database connection failed on port 5432",
  fileType: "txt",
  fileName: "server-logs"
});

🔄 Automatic Format Conversion

You can convert between formats automatically.

JSON → CSV

alert.medium("Converted data", {
  fileData: { name: "John", age: 30 },
  from: "json",
  to: "csv",
  fileName: "converted-data"
});

CSV → JSON

alert.low("Import ready", {
  fileData: `id,name
1,John
2,Jane`,
  from: "csv",
  to: "json"
});

TXT → CSV (With Headers)

alert.low("Text converted", {
  fileData: `Line 1
Line 2
Line 3`,
  from: "txt",
  to: "csv",
  csvHeaders: ["lineNumber", "content"],
  fileName: "text-to-table"
});

JSON → TXT

alert.high("Debug data", {
  fileData: { service: "api", status: "failed" },
  from: "json",
  to: "txt"
});

⚙️ API Reference

alert.init(token, channelName, channelId, options?)

Initializes Slack client.

alert.init(
  "xoxb-your-bot-token",
  "#production-alerts",
  "C1234567890",
  { autoDeleteFiles: true }
);

Options

{
  autoDeleteFiles?: boolean; // default: true
}

alert.high(error, options?)

alert.medium(error, options?)

alert.low(error, options?)

Send alert with severity.

Options

{
  channelName?: string;
  channelId?: string;
  fileData?: any;
  fileName?: string;
  fileType?: "json" | "csv" | "txt";
  from?: "json" | "csv" | "txt";
  to?: "json" | "csv" | "txt";
  csvHeaders?: string[];
  comment?: string;
}

🛠 Slack Setup

  1. Go to https://api.slack.com/apps
  2. Create a new Slack App
  3. Add Bot Token Scopes:
    • chat:write
    • files:write
  4. Install to workspace
  5. Copy:
    • Bot Token (xoxb-...)
    • Channel ID

❗ Important Rules

You CANNOT use both:

fileType

and

from + to

Choose one mode only:

  • Direct creation → fileType
  • Conversion → from + to

🧪 Tested Conversions

The library has been tested with:

  • JSON → CSV
  • JSON → TXT
  • CSV → JSON
  • CSV → TXT
  • TXT → JSON
  • TXT → CSV
  • Array → CSV
  • Error object handling
  • Channel override

🏭 Production Tip

alert.init(
  process.env.SLACK_TOKEN_ID!,
  process.env.NODE_ENV === "production"
    ? "#production-alerts"
    : "#dev-alerts",
  process.env.CHANNEL_ID!
);

📄 License

MIT © Parshuram Kumar