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

@jabybaby/request-replay

v0.1.0

Published

A modular debugging tool to capture and replay HTTP requests for Node.js frameworks

Readme

Request Replay Debugger

A modular debugging tool that captures and replays HTTP requests for Node.js frameworks. Perfect for debugging API endpoints during development.

Features

  • 🎯 Framework Agnostic: Abstract base class with framework-specific implementations
  • 📊 Web UI: Clean interface to view and replay requests
  • Real-time Updates: Live request capture with Server-Sent Events
  • 🔍 Filtering: Search and filter by method, URL, status code
  • 📋 Request Details: View headers, body, query params, and response comparison
  • ⚙️ Configurable: Ignore static files, specific paths, set request limits
  • 🔄 One-click Replay: Replay any captured request with a button click

Installation

npm install request-replay-debugger

Quick Start

Express.js

const express = require('express');
const { Express } = require('request-replay-debugger');

const app = express();
app.use(express.json());

// Create recorder instance
const recorder = new Express({
  uiPort: 3001,
  maxRequests: 100,
  ignoreStatic: true,
  ignorePaths: ['/health']
});

// Add middleware to capture requests
app.use(recorder.middleware());

// Your routes
app.get('/api/users', (req, res) => {
  res.json({ users: [] });
});

app.listen(3000, () => {
  console.log('Server running on http://localhost:3000');
  
  // Start the UI server
  recorder.startUI().then(() => {
    console.log('Replay UI at http://localhost:3001');
  });
});

Configuration

const recorder = new Express({
  uiPort: 3001,           // Port for the UI server
  maxRequests: 100,       // Maximum requests to store
  ignoreStatic: true,     // Ignore .css, .js, .png, etc.
  ignorePaths: ['/health', '/metrics'], // Paths to ignore
  baseUrl: 'http://localhost:3000',     // Base URL for replays
  enableUI: true          // Enable/disable UI server
});

API

Express Class

const recorder = new Express(config);

// Middleware function
app.use(recorder.middleware());

// Start UI server
await recorder.startUI();

// Stop UI server
recorder.stopUI();

// Get all requests
const requests = recorder.getRequests();

// Get specific request
const request = recorder.getRequest(id);

// Replay request
const result = await recorder.replayRequest(id);

// Clear all requests
recorder.clearRequests();

Events

// Listen for new requests
recorder.on('requestRecorded', (request) => {
  console.log('New request:', request.method, request.url);
});

// Listen for replayed requests
recorder.on('requestReplayed', ({ id, replayResponse }) => {
  console.log('Request replayed:', id);
});

// Listen for cleared requests
recorder.on('requestsCleared', () => {
  console.log('All requests cleared');
});

UI Features

  • Request Table: View all captured requests with timestamps
  • Search & Filter: Find requests by URL or HTTP method
  • One-click Replay: Replay any request and see the response
  • Request Details: View headers, body, query parameters
  • Response Comparison: Compare original vs replayed responses
  • Real-time Updates: New requests appear automatically

Extending for Other Frameworks

Create a new framework implementation by extending BaseRecorder:

const { BaseRecorder } = require('request-replay-debugger');

class MyFramework extends BaseRecorder {
  constructor(config) {
    super(config);
  }

  middleware() {
    return (req, res, next) => {
      // Capture request details
      const record = this.recordRequest(
        req.method,
        req.url,
        req.headers,
        req.body,
        req.query,
        // Optional: original response
        {
          statusCode: res.statusCode,
          headers: res.headers,
          body: responseBody
        }
      );
      
      next();
    };
  }
}

Development

# Install dependencies
npm install

# Build TypeScript
npm run build

# Run tests
npm run test

# Run linting
npm run lint

# Type checking
npm run typecheck

Example

Check out the complete example in examples/express-example/:

cd examples/express-example
npm install
npm start

Then visit:

  • http://localhost:3000 - Your Express app
  • http://localhost:3001 - Request Replay UI

License

MIT