local-debug-proxy
v1.0.1
Published
`local-debug-proxy` is a lightweight Express middleware that lets you **forward incoming API requests to another backend (local or remote) at runtime**, without changing your application code or redeploying.
Readme
🚀 local-debug-proxy
local-debug-proxy is a lightweight Express middleware that lets you forward incoming API 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.
🔥 Use Cases for local-debug-proxy
1️⃣ Debug Production Issues Using Local Code
Problem
Some bugs only appear in the server environment. Logs aren’t enough, and redeploying just to debug is slow and risky.
How local-debug-proxy Helps
- Server receives the request
- Request is forwarded to your local backend
- Code executes locally with full debugger access
- Response flows back to the original caller
Why This Is Powerful
- Debug live behavior without redeploying
- Use breakpoints, logs, and hot reload
- Instantly disable when done
This is the #1 real-world reason teams use it.
2️⃣ Run Local Backend Logic Behind a Server URL
Problem
Frontend teams depend on a stable server URL, but backend logic is still changing locally.
How local-debug-proxy Helps
- Frontend continues calling the server URL
- Server forwards requests to your local backend
- Local code responds as if it were deployed
Why This Is Powerful
- No backend deployments needed
- Frontend stays unblocked
- Faster API iteration and testing
Perfect for feature development and integration testing.
3️⃣ Temporarily Forward Server Traffic for Deep Inspection
Problem
You need to inspect real request behavior end-to-end, but only for a short time and without changing infrastructure.
How local-debug-proxy Helps
- Enable proxy at runtime
- Forward selected routes to a local instance
- Observe exact request/response flow
- Disable immediately after investigation
Why This Is Powerful
- Zero downtime
- Fully reversible
- Safe, controlled debugging sessions
Ideal for incident response and edge-case investigation.
📦 Installation
npm install local-debug-proxy⚙️ Basic Usage (Express)
import express from "express";
import { createLocalDebugProxy } from "local-debug-proxy";
const app = express();
app.use(
createLocalDebugProxy({
enabled: process.env.NODE_ENV !== "production",
mountPath: "/proxy",
bypass: ["/proxy", "/health"],
log: true,
})
);
app.listen(3000, () => {
console.log("Server running on http://localhost:3000");
});🌐 Proxy UI
Once enabled, open:
http://localhost:3000/proxyFrom here you can:
- Enable request forwarding
- Set the target backend URL
- Disable forwarding instantly
No restart required.
🛡️ Safety Notes
- Disabled by default
- Acts as a no-op middleware when turned off
- Intended for debugging & development use
- Not recommended for permanent traffic routing
🧠 Mental Model
local-debug-proxy lets you decide where code runs without changing where requests come from.
👤 Author & Maintainer
Ankit Kumar
- GitHub: https://github.com/connectankit
- Email: [email protected]
Built and maintained with ❤️ for backend developers who want faster, safer debugging workflows.
