Selected work
Backend Tool · Node.jsNode.js · HTTP(S) · WebSocket

ngrok_wannabe

Custom Node.js reverse proxy exposing local services through public subdomains—no router port-forwarding needed.

A self-hosted reverse proxy server that tunnels local development services to the public internet via wildcard subdomains. Works with HTTP, HTTPS, WebSockets, and no external account required.

Role — Solo developer
  • Node.js v20+
  • http-proxy
  • WebSocket (ws)
  • Commander CLI
  • dotenv
  • uuid
  • Nginx (reverse proxy layer)
  • Let's Encrypt (SSL)

This is a from-scratch Node.js reverse proxy built as an ngrok alternative. It listens for HTTP/HTTPS traffic on a public domain, parses the subdomain from the Host header, and routes inbound requests to local services you've registered. Each tunnel is identified by either a random UUID or a custom subdomain you provide—no account signup, just fire up the CLI with `-p 3000` and get a live URL.

The core architecture uses http-proxy to stream traffic transparently, handles WebSocket upgrades through native upgrade event listeners, and supports HTTPS via optional SSL certificates. The tunnel registry is a simple in-memory Map; the static landing page at `/` fetches active tunnels via the `/api/tunnels` endpoint and displays them as clickable links. It's configured entirely through `.env` variables (domain, ports, SSL paths) and CLI flags (port, target URL, subdomain).

The setup guide includes a complete Ubuntu/Nginx walkthrough that shows how to layer this behind a reverse proxy with wildcard DNS and Let's Encrypt certs, transforming a local development server into a production tunneling service. Every piece is vanilla Node.js—no framework bloat, just built-in modules plus http-proxy, WebSocket, and CLI parsing utilities.

What's notable
  • Dynamic tunnel registration via CLI: expose any local port with a single command, auto-generate or name your own subdomain
  • Full HTTP(S) and WebSocket support: streams traffic transparently without buffering, preserves headers and upgrade connections
  • Subdomain-based routing: parses Host header, looks up target in memory registry, proxies requests to localhost or any URL
  • Optional SSL/TLS: configure external certs via environment variables; supports both HTTP and HTTPS listeners running in parallel
  • Landing page with tunnel discovery: live API endpoint (`/api/tunnels`) lists active tunnels, public HTML dashboard lets you jump between them