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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dowwntime

v1.3.5

Published

An OpenAPI-based API endpoint monitoring tool that checks the health of your API endpoints and sends alerts when status changes occur.

Readme

Downtime

An OpenAPI-based API endpoint monitoring tool that checks the health of your API endpoints and sends alerts when status changes occur.

Features

  • OpenAPI Spec Parsing: Automatically discovers API endpoints from your OpenAPI specification
  • Scheduled Health Checks: Monitor endpoints at regular intervals
  • Flexible Alerting: Get notified via console or Slack when endpoints change status
  • Request Throttling: Control concurrency with configurable request limits
  • State Management: Track endpoint status changes over time
  • Customizable Status Detection: Define custom logic for determining endpoint health

Installation

npm i -D dowwntime

Quick Start

Create a dowwntime.config.ts file in your project root:

import { ConsoleAlert, defineConfig } from "dowwntime";

export default defineConfig({
  openapiSpecUrl: "https://example.com/api/openapi.json",
  concurrency: 10,
  timeoutMs: 5000,
  storagePath: "./storage.tmp",
  maxSpaceUsageBytes: 262144 * 0.1,
  alerts: [new ConsoleAlert()],
});

Run the health check:

npx dowwntime

Configuration Options

openapiSpecUrl (required)

The URL or file path to your OpenAPI specification. Can be:

  • A remote URL: https://registry.scalar.com/@scalar/apis/galaxy?format=yaml
  • A local file path: ./openapi.json

alerts (required)

Array of alert handlers to notify when endpoint status changes. Built-in options:

ConsoleAlert

Logs status changes to the console.

import { ConsoleAlert, defineConfig } from "dowwntime";

export default defineConfig({
  openapiSpecUrl: "...",
  alerts: [new ConsoleAlert()],
});

Output example:

[ALERT - UP] Path: /api/health is UP (145ms).
[ALERT - DOWN] Path: /api/data is DOWN (5000ms).
[ALERT - DEGRADED] Path: /api/status is DEGRADED (4200ms).

SlackAlert

Sends formatted messages to a Slack channel via a webhook.

import { SlackAlert, defineConfig } from "dowwntime";

export default defineConfig({
  openapiSpecUrl: "...",
  alerts: [new SlackAlert("https://hooks.slack.com/services/YOUR/WEBHOOK/URL")],
});

Slack messages include:

  • Status indicator: ✅ (UP), ❌ (DOWN), ⚠️ (DEGRADED)
  • Endpoint path: The API path that changed status
  • Full URL: Clickable link to the tested endpoint
  • Response time: Duration in milliseconds
  • Color coding: Green for UP, red for DOWN, yellow for DEGRADED

To set up a Slack webhook:

  1. Go to your Slack workspace's App Directory
  2. Search for "Incoming Webhooks"
  3. Click "Add to Slack" and select your target channel
  4. Copy the webhook URL
  5. Add it to your dowwntime.config.ts or pass as an environment variable

concurrency (optional, default: 5)

Maximum number of concurrent requests. Controls how many endpoints are tested simultaneously.

concurrency: 10,

timeoutMs (optional, default: 5000)

Request timeout in milliseconds. If an endpoint doesn't respond within this time, it's marked as DOWN.

timeoutMs: 5000,

storagePath (optional, default: "./storage.tmp")

Path where historical state data is stored. Used to detect status changes between runs.

storagePath: "./storage.tmp",

maxSpaceUsageBytes (optional, default: 262144 * 0.95)

Maximum storage size in bytes. Older entries are removed when this limit is exceeded.

maxSpaceUsageBytes: 262144 * 0.1,

baseUrl (optional)

Override the base URL from the OpenAPI spec. Useful for testing different environments.

baseUrl: "https://staging.example.com",

getExampleValue (optional)

Provide custom example values for path and query parameters. Useful when parameters don't have defaults in the spec.

getExampleValue: (paramName: string, path: string) => {
  if (paramName === "userId") {
    return "12345";
  }
  return undefined;
};

getStatus (optional)

Define custom logic for determining endpoint health based on status code and response time.

getStatus: (statusCode: number, path: string, durationMs: number) => {
  if (statusCode >= 200 && statusCode < 300) {
    if (path === "/api/health" && durationMs > 1000) {
      return "degraded";
    }
    return "up";
  }
  if (statusCode === 429) {
    // Rate limit - mark as degraded instead of down
    return "degraded";
  }
  return "down";
};

Usage in GitHub Actions

Use the provided workflow to automatically check your API endpoints on a schedule.

Setup: Create an Orphan Branch

An orphan branch keeps monitoring history separate from your main codebase:

# Create a new orphan branch (contains no history)
git switch --orphan dowwntime

# Clear the working directory
git rm -rf .

# Create a minimal .gitkeep file
touch .gitkeep
git add .gitkeep

# Commit the orphan branch
git commit -m "Initial commit"

# Push to remote
git push origin dowwntime

# Switch back to main
git checkout main

The orphan branch will contain the storage.tmp file with monitoring history and the monitoring results, keeping your main branch clean.

Workflow Configuration

Create .github/workflows/dowwntime.yml in your repository. Take a look here for a working example.

How It Works

  1. Schedule: The workflow runs every 5 minutes (configurable via cron syntax)
  2. Config Fetch: Pulls the latest dowwntime.config.ts from your main branch
  3. Health Check: Runs monitoring against all endpoints
  4. Results Storage: Saves results to storage.tmp (history is maintained on the orphan branch)
  5. Alerts: Sends notifications to configured alert handlers (e.g., Slack)
  6. Status Tracking: Commits results to the orphan branch for historical tracking

Using Environment Variables

For sensitive data like Slack webhook URLs, use GitHub Secrets:

  1. Go to Settings → Secrets and variables → Actions
  2. Click "New repository secret"
  3. Add SLACK_WEBHOOK_URL with your webhook URL

Update your config to use the secret:

import { SlackAlert, defineConfig } from "dowwntime";

export default defineConfig({
  openapiSpecUrl: "...",
  alerts: [new SlackAlert(process.env.SLACK_WEBHOOK_URL!)],
});

License

MIT