Skip to content
Open source dev tool · MIT

One port for your whole stack.

portbridge runs your frontend and backend dev servers behind a single port — no CORS, merged logs, and a live request dashboard. One command.

  • No CORS config
  • Framework-agnostic
  • Node.js ≥ 20
  • 16 downloads/mo
— portbridge
➜app
Sound familiar?

Local dev across two servers is death by a thousand ports.

Ports scattered everywhere

Frontend on :5173, backend on :5000, and you're memorizing which tab is which.

localhost:5173 · localhost:5000 · localhost:???

CORS errors, again

Two origins means preflight failures, proxy hacks, and header juggling.

Access to fetch blocked by CORS policy

Logs in three terminals

Web here, API there — tab-hopping to trace a single request through the stack.

$ tab 1 $ tab 2 $ tab 3 …

Zero request visibility

Which requests hit the frontend vs backend? How slow? You're guessing.

GET /api/todos → ??? ms

One command fixes all of itportbridge
How it works

One proxy in front of everything

The browser talks to a single origin. portbridge routes /api/* to your backend and everything else to your frontend — HMR WebSockets included.

01

Initialize

portbridge init auto-detects your frontend and backend, then writes a ready-to-run config.

$ portbridge init
02

Run one command

portbridge boots both servers, waits until they're ready, and shows a single banner.

$ portbridge
03

Open one URL

Your whole stack lives on one origin. Add --dashboard for the live request timeline.

$ open http://localhost:4000
Features

Everything you need to run a full-stack dev loop

One small CLI that removes the papercuts of running two servers side by side — from CORS to crash recovery.

One unified port, zero CORS

The browser talks only to :4000. /api/* proxies to the backend, everything else to the frontend — no CORS config, ever.

Merged, color-coded logs

Both servers interleaved in one terminal. Each line timestamped and prefixed — [web] cyan, [api] magenta, errors red.

Live request dashboard

Run with --dashboard for a real-time timeline at /_portbridge, streaming every request over WebSocket with a waterfall bar.

Smart init

Auto-detects Next.js / Vite / CRA and Express / Fastify / Koa / NestJS, then pre-fills your commands and ports.

Port auto-resolution

If a port is taken, portbridge picks a free one and tells you. Prefer to fail fast? Pass --strict-port.

Wait-for-ready

Waits until both servers are actually listening before showing the banner — and warns you if one never comes up.

Auto-restart on crash

Opt in with restartOnCrash and portbridge revives a downed server, with a crash-loop guard so it never spins.

PORT injection + .env check

Injects PORT into each child process and warns when .env.example keys are missing from your .env.

HMR-safe

Forwards WebSocket upgrades to the frontend, so Vite and Next.js hot module replacement keep working through the proxy.

Dev-only & production-safe

Never a dependency, never deployed. It nudges you toward relative /api/... calls that work identically in dev and prod.

Live dashboard

See every request, the moment it happens

Run with --dashboard and open /_portbridge for a live view of traffic crossing the front↔back boundary.

livelocalhost:4000/_portbridge
MethodPathStatus

See every request cross the front↔back boundary, live.

  • Real-time timeline

    Every request streams over WebSocket the instant it happens — no refresh, no polling.

  • Front ↔ back at a glance

    Color-coded targets show exactly which server handled each request.

  • Waterfall durations

    A per-request bar makes slow endpoints obvious the moment they appear.

Quick start

Up and running in under a minute

Install globally (or run with npx portbridge), drop in a config, then run one command.

1Install
2Configure
portbridge.config.json
{
  "frontend": { "command": "npm run dev",    "port": 5173, "cwd": "./client" },
  "backend":  { "command": "npm run server", "port": 5000, "cwd": "./server" },
  "proxy":    { "port": 4000, "apiPrefix": "/api" }
}

Prefer code? The same config works as .js, .mjs, .cjs or .ts — or run portbridge init to generate it.

3Run
Comparison

Why not concurrently + CORS?

You can wire it up by hand. portbridge just makes the whole thing one command — and adds the parts you can't easily bolt on.

Feature comparison between a manual concurrently plus CORS setup and portbridge
Capability(concurrently + CORS)portbridge
Runs both dev serversYesYes
No CORS setupNoYes
One URL for the whole appNoYes
Labelled + timestamped logsNoYes
Live request viewNoYes
Port auto-resolutionNoYes
Wait-for-ready bannerNoYes
Dev-only & production-safe

It never ships. It never touches your database.

portbridge is a development tool. Keep your API calls relative and the exact same code works in dev and prod — because in production your platform serves everything from one origin anyway.

  • Not a dependency — it never ships in your bundle
  • Never deployed and never used in production
  • Sits between the browser and your HTTP servers — never near your database
Do this — relative path
fetch('/api/users')

Works identically in dev and production.

Not this — hard-coded origin
fetch('http://localhost:4000/api/users')

Breaks the moment you deploy.

FAQ

Questions, answered

The things developers actually ask before running npx portbridge.

No. portbridge sits between the browser and your HTTP servers — it never sits between your backend and your database. Your backend connects to its database exactly as before; portbridge doesn't know or care that a database exists.

Stop juggling ports. Ship faster.

One command runs your whole stack behind a single port — no CORS, merged logs, and a live request dashboard.

Node.js ≥ 20 · MIT licensed · Windows · macOS · Linux