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

code-alert

v0.1.0

Published

Lightweight Node.js utility for sending SMS alerts (via Twilio) on console events.

Readme

Code Alert

A simple, lightweight Node.js package for sending notifications (initially SMS) on console errors and warnings.

Installation

npm install code-alert
# or
yarn add code-alert

Quick Start

  1. Set Environment Variables: Create a .env file in your project root (add it to .gitignore!). You need your Twilio credentials and the recipient phone numbers.

    # .env
    TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    TWILIO_AUTH_TOKEN=your_auth_token_xxxxxxxxxxxxx
    TWILIO_FROM_NUMBER=+15551112222
    CODE_ALERT_RECIPIENT_NUMBERS=+15551234567,+15559876543
  2. Initialize in your app: Call init once at startup, passing configuration options except for recipient numbers (which are read from the environment).

    // Load environment variables (e.g., using dotenv)
    import "dotenv/config";
    import { init } from "code-alert";
    
    async function startApp() {
      try {
        await init({
          // Recipient numbers are now read from process.env.CODE_ALERT_RECIPIENT_NUMBERS
          notifyOn: ["error"], // Optional: Trigger on console.error (default)
          // Add other configurations like thresholds, rate limits here
        });
    
        console.log("Code Alert Initialized!");
        // ... rest of your application startup
    
        // Example: This will now potentially trigger an SMS (once implemented)
        console.error("Something went wrong!");
      } catch (error) {
        console.error("Failed to initialize Code Alert:", error);
        process.exit(1); // Exit if init fails
      }
    }
    
    startApp();

Configuration

Configuration is primarily handled via environment variables and the init function.

Environment Variables

The following environment variables are required:

  • TWILIO_ACCOUNT_SID: Your Twilio Account SID.
  • TWILIO_AUTH_TOKEN: Your Twilio Auth Token.
  • TWILIO_FROM_NUMBER: Your Twilio phone number (must be capable of sending SMS) in E.164 format (e.g., +15551112222).
  • CODE_ALERT_RECIPIENT_NUMBERS: A comma-separated list of recipient phone numbers in E.164 format (e.g., +15551234567,+15559876543).

init(config) Options

The init function accepts an optional configuration object:

  • notifyOn: (ConsoleLevel[]) - An array of console levels ('error', 'warn', 'info', 'log') that should potentially trigger notifications. Defaults to ['error'].
  • messageFormat: (string) - A template string for formatting the notification message. Placeholders like {{message}}, {{level}} etc., will be added later. (Default format TBD).

(Threshold, rate limit, and context options will be added here as they are implemented)

Usage

_(Usage examples, including the explicit `