frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: Port Zero – how I learned to stop worrying and love PORT=0

https://portzero.net/
6•octopoc•1h ago
Hi HN,

Recently I wasted several hours wrangling my dev environment only to find out that the browser frontend was talking to the wrong version of the backend. This got me thinking--why on earth are we still using simple numbers to describe which process to connect to? Why not use names instead? I thought of all the times a program wouldn't start because of port conflicts. The more I thought about it, the crazier it seemed.

Modern operating systems already offer no-conflict ports: if you make your TCP server listen on port 0, the OS assigns you a random available port. But that only solves half the problem.

I built the other half: PortZero. It's a GPLv3 program that watches for processes (and docker containers!) with a special PZ_TUNNEL environment variable:

  PZ_TUNNEL=myapp-{branch}.portzero.local:80 npm run dev
When it sees such a process or container, PortZero does this:

1. Create a virtual NIC (if it hasn't already)

2. Create a new virtual IP address

3. Create a DNS record that substitutes things like {branch} based on the working directory of the process, and points at that virtual IP address

4. Start listening on that virtual IP address on the port of your choice (e.g. port 80 for http, port 443 for https, port 5432 for postgresql)

5. Forward any TCP connections to that virtual IP address / virtual port to the random, OS-assigned port that your process or container is actually listening on

The result is you don't have to think about ports anymore, you just have to think about subdomains. You can have multiple services available on port 80 without conflicts, as long as they have different portzero.local subdomains.

It does some other cool stuff like:

- Enable HTTPS on local HTTP services by creating a local CA and registering it on your machine

- Enable cloud tunnels so you can access your apps on other devices (paid feature)

Links:

https://portzero.net/docs/

https://github.com/PortZeroNetwork/portzero

Comments

ignoramous•35m ago
> why on earth are we still using simple numbers to describe which process to connect to? Why not use names instead.

Not super popular, but: https://en.wikipedia.org/wiki/SRV_record

yjftsjthsd-h•26m ago
Yep, my immediate reaction was "because browsers refuse to support SRV records" (although I think there was some new variant that kinda worked?)

PGSimCity - How PostgreSQL Works

https://nikolays.github.io/PGSimCity/
80•jonbaer•1h ago•13 comments

Decker, a platform that builds on the legacy of Hypercard and classic macOS

https://beyondloom.com/decker/
223•tosh•7h ago•54 comments

Show HN: Physically accurate black hole you can put in your room

https://blackhole.plav.in
18•aplavin•3d ago•3 comments

We have proof automation now

https://www.imperialviolet.org/2026/07/26/zstd-lean.html
73•zdw•5h ago•10 comments

French firefighters face 'pyrocumulonimbus' for first time

https://www.france24.com/en/live-news/20260726-french-firefighters-face-pyrocumulonimbus-for-firs...
184•saaaaaam•8h ago•91 comments

Teaching Kids Forth

https://gracefulliberty.com/articles/teaching-kids-forth/
50•rbanffy•4h ago•13 comments

US citizen charged after GrapheneOS phone wipes during airport search

https://www.techspot.com/news/113236-us-prosecutors-charge-atlanta-man-after-grapheneos-phone.html
154•eecc•3h ago•83 comments

Introduction to Data-Oriented Design [pdf]

https://www.gamedevs.org/uploads/introduction-to-data-oriented-design.pdf
109•tosh•7h ago•34 comments

Design is compromise

https://stephango.com/design-is-compromise
196•ankitg12•10h ago•73 comments

I Championed Prediction Markets. Look What They've Become

https://newsletter.platypuseconomics.com/p/i-championed-prediction-markets-look
18•NomNew•1h ago•33 comments

Htmx 4.0, the first JavaScript library to release exclusively on the Game Boy

https://swag.htmx.org/en-cad/products/htmx-4-the-game
358•rcy•13h ago•112 comments

Simulate cassette tape audio profiles using FFmpeg

https://github.com/AARomanov1985/Audio-Cassette-Simulation
73•xterminal•5h ago•39 comments

Show HN: CheapSecurity – Lightweight, Self-Hosted CCTV for Linux SBCs

https://github.com/gmrandazzo/CheapSecurity
104•zeldone•10h ago•22 comments

Plasma Tunnels Reveal How Dying Satellites Fall to Earth

https://spectrum.ieee.org/space-debris-atmosphere-burn-up
42•marc__1•5h ago•24 comments

How to Write English Prose

https://thelampmagazine.com/blog/how-to-write-english-prose
72•geneticdrifts•8h ago•38 comments

How to Block Some of the Bots

https://nochan.net/b/Internet-Crap/20260606-How-To-Block-Some-Of-The-Bots/
81•Bender•7h ago•91 comments

Fonts In Use – Find out where a font is used

https://fontsinuse.com/
13•open_•2h ago•0 comments

How AST-grep Rewrote Tree-sitter in Rust and Made It 30% Faster

https://astgrep.com/blog/tree-sitter-rust-rewrite
70•herrington_d•8h ago•11 comments

Go Analysis Framework: modular static analysis by go team

https://pkg.go.dev/golang.org/x/tools/go/analysis
179•AbuAssar•13h ago•39 comments

How the Atmos clock functions

https://atmos-atelier.de/en/atmos-uhr/
5•r3trohack3r•1h ago•0 comments

Show HN: Port Zero – how I learned to stop worrying and love PORT=0

https://portzero.net/
7•octopoc•1h ago•2 comments

The relay market powering token resellers and fraud

https://vectoral.com/blog/token-relay-market
153•mlenhard•10h ago•92 comments

The New AI Superpowers: Focus and Followthrough

https://www.rickmanelius.com/p/the-new-ai-superpowers-focus-and
143•mooreds•12h ago•45 comments

The Usefulness of Useless Knowledge (1939) [pdf]

https://faculty.lsu.edu/kharms/files/flexner_1939.pdf
20•jxmorris12•3d ago•2 comments

I learned PCB design, 3D printing and C just to listen to music

https://pentaton.app/blog/2026-07-12-introducing-pentaton-lp/
174•interfeco•3d ago•35 comments

Kill The Cookie Banner

https://killthecookiebanner.eu/
831•rapnie•14h ago•403 comments

Show HN: Reverse Minesweeper

https://sunflowersgame.com/
149•pompomsheep•13h ago•50 comments

I wanted a clock that never needed setting. Things escalated

https://arstechnica.com/gadgets/2026/07/i-wanted-a-clock-that-never-needed-setting-things-escalated/
49•lee_ars•3d ago•44 comments

Jimothy the raccoon has a rare spinal condition. Here's what that means

https://www.popsci.com/science/whats-jimothy-raccoon-condition/
101•speckx•5d ago•53 comments

Using sed to make indexes for books (1997)

https://www.pement.org/sed/make_indexes.txt
50•TMWNN•3d ago•9 comments