DEV Community

Muhammad Syarwani
Muhammad Syarwani

Posted on

Simple-proxy-id โ€” A tiny yet secure proxy for Node.js (zero dependencies)

๐Ÿง  From a Small Frustration to a Tiny but Powerful Proxy

A few weeks ago, I just needed a small proxy for testing local APIs.
Something that just works โ€” no heavy setup, no extra dependencies, no magic.

But as usual, once something works, developers canโ€™t resist improving it ๐Ÿ˜…
Thatโ€™s how simple-proxy-id was born.

Itโ€™s a lightweight HTTP/HTTPS proxy for Node.js,
built with zero dependencies, yet still secure, fast, and flexible.


๐Ÿ”ง Why I Built It

While working with APIs, I noticed two extremes in most proxy libraries:

  • Theyโ€™re too flexible, which often leads to open-proxy abuse.
  • Or too limited, making them hard to use in real server environments.

So I aimed for something in between โ€” secure, simple, but production-ready.


โš™๏ธ Quick Example

import { createProxy } from "simple-proxy-id"

createProxy({
  target: "https://jsonplaceholder.typicode.com",
  port: 3000,
  changeOrigin: true,
  pathRewrite: { "^/api": "" },
})
Enter fullscreen mode Exit fullscreen mode

Thatโ€™s it โ€” your proxy is up and running.
No config files, no dependencies, no magic behavior.


โšก Key Features

โœ… Fixed target โ€” cannot be changed by external requests (prevents open proxy abuse)
โœ… Path rewrite โ€” support for both pattern objects and custom functions
โœ… Plugins โ€” CORS, daily rotating logger, brute-force attack detection
โœ… Real IP detection โ€” supports Cloudflare Tunnel and X-Forwarded-For
โœ… Zero dependency, high performance โ€” ~1,660 req/sec (p50: 52 ms, p99: 138 ms)

No frameworks, no dependencies โ€” just pure Node.js, connection pooling,
and a lot of small optimizations to make it perform well under load.


๐Ÿงฉ Why It Matters

The project started from a small frustration โ€”
but sometimes thatโ€™s exactly where useful tools come from.

If you often deal with API testing, debugging, or quick proxy setups,
you might find this handy ๐Ÿ‘‡

๐Ÿ”— GitHub: github.com/ibnushahraa/simple-proxy-id
๐Ÿ“ฆ NPM: npmjs.com/package/simple-proxy-id


Sometimes the best open-source projects donโ€™t start with a plan โ€”
they start with one small problem you just couldnโ€™t ignore.

Top comments (0)