New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@thaparoyal/replayapi

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thaparoyal/replayapi

ReplayAPI SDK for Node.js — Capture HTTP traffic automatically

latest
npmnpm
Version
0.1.4
Version published
Maintainers
1
Created
Source

@replayapi/node

ReplayAPI SDK for Node.js — Automatically capture outgoing HTTP traffic for replay testing.

Install

npm install @replayapi/node

Quick Start

import { replayApi } from '@replayapi/node'

// Initialize once at app startup
replayApi.init({
  apiKey: process.env.REPLAY_API_KEY!,
  environment: 'staging',
})

// That's it — all http, https, and fetch calls are now captured

Configuration

replayApi.init({
  // Required
  apiKey: 'rp_your_api_key',

  // Optional
  proxyUrl: 'http://localhost:8080',  // Default proxy URL
  environment: 'staging',             // Environment label
  sessionId: 'user-checkout-flow',    // Group related requests

  // Filter what gets captured
  include: ['api.example.com', /\/api\/v\d+\//],
  exclude: ['healthcheck', /\.internal\./],

  // Debug
  debug: true,                        // Enable verbose logging
  disabled: false,                    // Disable without removing code
  timeout: 30000,                     // Proxy request timeout (ms)
})

API

replayApi.init(config)

Initialize the SDK. Patches http.request, https.request, and fetch globally.

replayApi.stop()

Stop capturing and restore original HTTP behavior.

replayApi.isActive()

Returns true if the SDK is currently intercepting traffic.

replayApi.getStats()

const stats = replayApi.getStats()
// { totalCaptured: 42, totalSkipped: 3, totalErrors: 0, startedAt: Date }

How It Works

  • Your app makes an HTTP request: GET https://api.example.com/users
  • The SDK rewrites it to: GET http://proxy:8080/users with headers:
    • X-Api-Key: rp_... (your API key)
    • X-Replay-Target: https://api.example.com (original target)
    • X-Replay-Env: staging (environment)
  • The proxy captures the traffic, forwards to the target, returns the response
  • Your app receives the response as if the proxy wasn't there

Supported

  • Node.js 18+ (native fetch support)
  • http.request / http.get
  • https.request / https.get
  • globalThis.fetch
  • Libraries that use these under the hood (axios, node-fetch, got, etc.)

Keywords

api

FAQs

Package last updated on 14 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts