DEV Community

Mu Micro
Mu Micro

Posted on

Developers lose track of which ports are in use — so I built portmap

The problem

Developers running multiple local services — API servers, databases, webpack dev servers — frequently need to know what is listening on which port, but running lsof -iTCP -sTCP:LISTEN or netstat -an produces walls of unformatted text that are slow to read and impossible to scan at a glance.

If you've hit this before, you know how it goes — you cycle through terminal tabs running lsof -iTCP -sTCP:LISTEN -n -P, squinting at the output, trying to find the process on port 3000.

As a solution, I created portmap

Scan all listening ports on localhost and visualise them in a browser dashboard with process names and PIDs

Zero-dependency Node.js, so you can run it immediately:

npx portmap
Enter fullscreen mode Exit fullscreen mode

Output in terminal:

portmap dashboard → http://127.0.0.1:7777
Press Enter to stop.
Enter fullscreen mode Exit fullscreen mode

The browser opens a live dashboard:

Port Process PID Address
3000 node 14321 *:3000
5432 postgres 1892 127.0.0.1:5432
6379 redis-ser 2104 127.0.0.1:6379
8080 python3 19834 *:8080

Hit Refresh to rescan. Press Enter in the terminal to stop. Auto-closes after 60s.

How it works

Uses Node.js child_process.execSync to run lsof -iTCP -sTCP:LISTEN -n -P (macOS/Linux) or netstat -ano (Windows), parses port/PID/process-name triples with regex, then serves a self-contained HTML dashboard via the built-in http module and opens the browser automatically.

Why I built it

Found the complaint repeatedly on r/webdev and r/node — developers juggling Postgres, Redis, a webpack server, and a Node API all at once constantly type lsof or netstat and squint at the output. No popular zero-dep Node.js tool presents this data visually. A local web dashboard is a natural fit: the output is tabular, colour and typography help enormously, and auto-closing keeps it lightweight.

Try it

npx portmap --help
Enter fullscreen mode Exit fullscreen mode

Part of µ micro — one new developer tool, shipped every day. All tools are zero-dependency Node.js and run instantly with npx.

Top comments (0)