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

ready-checker

v1.0.1

Published

A lightweight, zero-dependency CLI tool to verify that your Node.js server starts correctly and responds to health checks

Readme

ready-checker

A lightweight, zero-dependency CLI tool to verify that your Node.js server starts correctly and responds to health checks.

Perfect for CI/CD pipelines, pre-deployment verification, and local development testing.

Features

  • Zero external dependencies (uses only Node.js standard library)
  • Works with any HTTP server (http, Express, Fastify, Koa, etc.)
  • Configurable health endpoint and timeout
  • Retry support for flaky startups
  • Multiple output formats (human-readable, JSON, silent)
  • Config file support (JSON file or package.json)

Installation

# Global installation
npm install -g ready-checker

# Or use with npx (no installation required)
npx ready-checker server.js

Quick Start

  1. Your server file should export your app instance (Express, Koa, http.Server, etc.):
// server.js
const express = require('express');
const app = express();

app.get('/health', (req, res) => res.json({ status: 'ok' }));

module.exports = app;  // Just export - ready-checker handles .listen()
  1. Run the check:
npx ready-checker server.js

Usage

ready-checker <server-file> [options]

Options

| Flag | Default | Description | |------|---------|-------------| | --health <path> | /health | Health endpoint path | | --timeout <ms> | 1000 | Request timeout in milliseconds | | --retries <n> | 0 | Number of retry attempts on failure | | --retry-delay <ms> | 500 | Delay between retry attempts | | --json | false | Output result as JSON | | --silent | false | No output, only exit code |

Examples

# Basic usage
ready-checker server.js

# Custom health endpoint
ready-checker server.js --health /api/health

# With timeout and retries
ready-checker server.js --timeout 5000 --retries 3 --retry-delay 1000

# JSON output for CI/CD parsing
ready-checker server.js --json

# Silent mode for scripts
ready-checker server.js --silent && echo "Server OK"

Configuration

Config File

Create ready-checker.config.json or .readycheckerrc in your project root:

{
  "health": "/api/health",
  "timeout": 2000,
  "retries": 3,
  "retryDelay": 500
}

Package.json

Add a readyChecker field to your package.json:

{
  "name": "my-app",
  "readyChecker": {
    "health": "/health",
    "timeout": 3000,
    "retries": 2
  }
}

Priority Order

Configuration is merged in this order (highest priority first):

  1. CLI arguments
  2. Config file (ready-checker.config.json / .readycheckerrc)
  3. package.json readyChecker field
  4. Default values

Server Contract

Option 1: Export your app (recommended)

Export your app instance - ready-checker calls .listen() for you:

const express = require('express');
const app = express();

app.get('/health', (req, res) => res.json({ status: 'ok' }));

module.exports = app;

Option 2: Use process.env.PORT

If your server already calls .listen(), use process.env.PORT:

const express = require('express');
const app = express();

app.get('/health', (req, res) => res.json({ status: 'ok' }));

// ready-checker sets PORT automatically before requiring your file
app.listen(process.env.PORT || 3000);

module.exports = app;  // Export so ready-checker can close it

Skipping Crons, Schedulers, etc.

ready-checker sets READY_CHECK=true before requiring your file. Use this to skip non-essential services:

const express = require('express');
const app = express();

app.get('/health', (req, res) => res.json({ status: 'ok' }));

// Skip crons and background jobs during health check
if (!process.env.READY_CHECK) {
  require('./cron-jobs');
  require('./queue-workers');
  connectToRedis();
  startScheduler();
}

app.listen(process.env.PORT || 3000);
module.exports = app;

Supported Export Types

  • Express app - module.exports = app
  • Koa app - module.exports = app
  • http.Server - module.exports = http.createServer(handler)
  • Request handler - module.exports = (req, res) => { ... }
  • Fastify - module.exports = app
  • NestJS - Export the app instance
  • Hapi - module.exports = server

See the examples/ folder for implementation examples.

Exit Codes

| Code | Meaning | |------|---------| | 0 | Success - server started and health check passed | | 1 | Failure - server failed to start or health check failed |

Output Examples

Default Output

✅ Server started on port 54321
✅ Health check passed (GET /health → 200)

With Retries

✅ Server started on port 54321
⚠️  Attempt 1/3 failed, retrying in 500ms...
⚠️  Attempt 2/3 failed, retrying in 500ms...
✅ Health check passed (GET /health → 200) [attempt 3/3]

JSON Output

{
  "success": true,
  "port": 54321,
  "status": 200,
  "elapsed": 45,
  "attempts": 1
}

Failure Output

✅ Server started on port 54321
❌ Health check failed (GET /health → 500)

Use Cases

CI/CD Pipeline

# GitHub Actions example
- name: Verify server starts
  run: npx ready-checker server.js --timeout 5000 --retries 3

Pre-commit Hook

#!/bin/sh
npx ready-checker server.js --silent || exit 1

Docker Health Check

HEALTHCHECK CMD node -e "require('./server.js')(3000)" || exit 1

License

MIT