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

stressy

v0.1.2

Published

A comprehensive HTTP stress testing library for Node.js

Downloads

10

Readme

Node.js stressy

A comprehensive HTTP stress testing library for Node.js applications. Perform load testing, stress testing, and performance testing of HTTP APIs and web services with both constant rate and ramp-up testing patterns.

Features

  • 🚀 High Performance: Efficient request handling with configurable RPS
  • 📊 Real-time Reporting: Live progress bars and detailed statistics
  • 🔄 Multiple Test Patterns: Constant rate and ramp-up testing
  • 🎯 Flexible Configuration: Support for all HTTP methods and custom headers
  • 📝 Dynamic Data: Generate dynamic request bodies with templates
  • 🔇 Silent Mode: Disable all terminal output for CI/CD integration
  • 📈 Event-driven: Listen to test events for custom integrations
  • 🖥️ CLI Support: Command-line interface for easy usage

Installation

npm install stressy

Quick Start

Programmatic Usage

import StressTester from "stressy";

const tester = new StressTester();

// Basic stress test
await tester.runStressTest({
  url: "https://api.example.com/users",
  requestsPerSecond: 100,
  totalRequests: 1000,
});

// POST request with dynamic data
await tester.runStressTest({
  url: "https://api.example.com/users",
  method: "POST",
  body: {
    name: "User {id}",
    email: "user{id}@example.com",
  },
  dynamicData: true,
  requestsPerSecond: 50,
  totalRequests: 500,
});

// Ramp-up test
await tester.runStressTest({
  baseURL: "https://api.example.com",
  endpoint: "/users",
  requestsPerSecond: 10,
  rampUp: [10, 50, 100, 200],
  duration: 60,
});

CLI Usage

# Basic usage
npx stressy --url "https://api.example.com/users" --rps 100 --requests 1000

# With custom headers and body
npx stressy --url "https://api.example.com/users" --rps 50 --requests 500 \
  --method POST --headers '{"Authorization": "Bearer token"}' \
  --body '{"name": "Test User"}'

# Duration-based test
npx stressy --url "https://api.example.com/users" --rps 200 --duration 60

# Silent mode (no terminal output)
npx stressy --url "https://api.example.com/users" --rps 100 --requests 1000 --silent

API Reference

StressTester Class

Constructor Options

const tester = new StressTester({
  baseURL: "https://api.example.com", // Base URL for all requests
  timeout: 5000, // Request timeout in milliseconds
  maxRetries: 3, // Maximum retry attempts
  reportInterval: 1000, // Progress reporting interval
  silent: false, // Disable terminal output
  reporter: new CustomReporter(), // Custom reporter instance
  dataGenerator: new CustomGenerator(), // Custom data generator
});

runStressTest Options

| Option | Type | Required | Description | | ------------------- | --------------- | -------- | ------------------------------ | | url | string | No* | Complete URL for requests | | baseURL | string | No* | Base URL (use with endpoint) | | endpoint | string | No* | API endpoint path | | method | string | No | HTTP method (default: GET) | | headers | object | No | HTTP headers | | body | object/function | No | Request body | | dynamicData | boolean | No | Enable dynamic data generation | | requestsPerSecond | number | Yes | Requests per second rate | | totalRequests | number | No | Total requests to send | | duration | number | No | Test duration in seconds | | rampUp | number[] | No | RPS values for ramp-up testing | | timeout | number | No | Request timeout | | maxRetries | number | No | Maximum retry attempts | | silent | boolean | No | Disable terminal output |

*Either url or both baseURL and endpoint are required.

Events

The StressTester extends EventEmitter and emits the following events:

  • testStart - Emitted when test starts
  • progress - Emitted during test execution
  • requestComplete - Emitted for each completed request
  • stageComplete - Emitted when ramp-up stage completes
  • testComplete - Emitted when test completes
  • error - Emitted when an error occurs
tester.on("testComplete", (results) => {
  console.log(`Test completed: ${results.successRate}% success rate`);
});

Dynamic Data Generation

Generate dynamic request bodies using template strings:

await tester.runStressTest({
  url: "https://api.example.com/users",
  method: "POST",
  body: {
    id: "{id}", // Request ID
    name: "User {id}", // String interpolation
    email: "user{id}@example.com",
    age: "{randomNumber:100}", // Random number 0-100
    country: "USA",
  },
  dynamicData: true,
  requestsPerSecond: 10,
  totalRequests: 100,
});

Reporters

ConsoleReporter (Default)

Provides colored terminal output with progress bars.

JSONReporter

Outputs structured JSON data for programmatic consumption.

import { JSONReporter } from "stressy";

const tester = new StressTester({
  reporter: new JSONReporter(),
});

CLI Options

| Option | Alias | Type | Description | | ------------ | ----- | ------- | --------------------------- | | --url | -u | string | Target URL | | --requests | -r | number | Total number of requests | | --rps | | number | Requests per second | | --duration | -d | number | Test duration in seconds | | --method | -m | string | HTTP method | | --headers | | string | Headers as JSON string | | --body | | string | Request body as JSON string | | --silent | -s | boolean | Silent mode |

Testing

The project includes comprehensive test coverage using Vitest:

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

Test Coverage

The test suite covers:

  • StressTester class - All methods and configurations
  • DataGenerator - Dynamic data generation and placeholders
  • Reporters - ConsoleReporter and JSONReporter
  • Validators - Configuration validation
  • Statistics - Statistical calculations
  • CLI - Command-line interface functionality

Requirements

  • Node.js >= 16.0.0

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Setup

# Clone the repository
git clone https://github.com/ArturRushanyan/stressy.git
cd stressy

# Install dependencies
npm install

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Run examples
npm run dev

Author

ArthurRushanyan