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

local-debug-proxy

v1.0.3

Published

`local-debug-proxy` is a lightweight HTTP + WebSocket debugging proxy for Express and NestJS applications that lets you **forward incoming API and socket requests to another backend (local or remote) at runtime**, without changing your application code or

Downloads

86

Readme

🚀 local-debug-proxy

local-debug-proxy is a lightweight HTTP + WebSocket debugging proxy for Express and NestJS applications that lets you forward incoming API and socket requests to another backend (local or remote) at runtime, without changing your application code or redeploying.

It’s designed for debugging, development, and temporary routing, not as permanent infrastructure.


✨ What It Does (In One Line)

Receive a request in one environment → execute it in another → return the response transparently.

Your server URL remains unchanged — only where the code executes changes.


🔥 Use Cases for local-debug-proxy

1️⃣ Debug Production Issues Using Local Code

Client → Server → Local Machine → Server → Client

Some bugs only appear in the server environment. Instead of redeploying with console.log:

  • Server receives the request (HTTP or WebSocket)
  • Proxy forwards it directly to your local backend
  • Code executes locally with full debugger and hot-reload access
  • Response flows back transparently!

2️⃣ Run Local Backend Logic Behind a Server URL

Frontend teams depend on a stable server URL dev.api.myapp.com, but backend logic is still changing locally.

  • Frontend continues calling the stable server URL
  • Server forwards requests to your local backend
  • Frontend stays unblocked while backend tests locally!

3️⃣ Temporarily Forward Server Traffic for Deep Inspection

Enable proxy at runtime to observe EXACT request/response flows without changing infrastructure. Completely zero downtime and fully reversible.


📦 Installation

npm install local-debug-proxy

⚙️ Express Example (HTTP + WebSockets / Socket.IO)

import http from "http";
import express from "express";
import { Server } from "socket.io";
import { createLocalDebugProxy, attachWebSocketProxy } from "local-debug-proxy";

const app = express();
const server = http.createServer(app);

// 1. Add HTTP proxy middleware
app.use(
  createLocalDebugProxy({
    enabled: true,
    mountPath: "/proxy",
    bypass: ["/health"],
    log: true,
  })
);

// 2. Initialize Socket.IO (Must happen BEFORE attachWebSocketProxy)
const io = new Server(server, { cors: { origin: "*" } });

io.on("connection", (socket) => {
  console.log("Client connected locally:", socket.id);
});

// 3. Attach WebSocket proxy (Must be LAST!)
attachWebSocketProxy(server, { log: true });

server.listen(3000, () => {
  console.log("Express server running on http://localhost:3000");
});

🦅 NestJS Example (HTTP + WebSockets)

In a NestJS application, apply the middleware globally and attach the WebSocket listener to the underlying HTTP server.

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { createLocalDebugProxy, attachWebSocketProxy } from 'local-debug-proxy';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  // 1. Add HTTP Proxy Middleware
  app.use(
    createLocalDebugProxy({
      enabled: process.env.NODE_ENV !== "production",
      mountPath: "/proxy",
      log: true,
    })
  );

  // Wait for NestJS to initialize engines (including WebSockets)
  await app.init(); 

  // 2. Get underlying raw HTTP server instance
  const server = app.getHttpServer();

  // 3. Attach WebSocket proxy LAST
  attachWebSocketProxy(server, { log: true });

  await app.listen(3000, () => {
    console.log("NestJS Server running on http://localhost:3000");
  });
}
bootstrap();

🌐 Proxy Control UI

Once enabled, visit the control panel at:

http://localhost:3000/proxy

From here you can Enable request forwarding, set target backend URLs dynamically, and Disable immediately. No restart required!


🛡️ Safety Notes

  • Disabled by default: Acts as a true no-op middleware when turned off.
  • Intended strictly for debugging workflows, not as a permanent reverse proxy.

👤 Author & Maintainer

Ankit Kumar

Built and maintained with ❤️ for backend developers who want faster, safer debugging workflows.


🏷️ Keywords & Search Tags

debug-proxy express-proxy nestjs-proxy http-proxy websocket-proxy socketio-proxy local-debugging nodejs-debugging development-tools ngrok-alternative reverse-proxy