05Blog
Give your local tools a name, not a port
My training plan, my Paris outings and the Bootstrap triage dashboard are small websites that run all day on my laptop, kept up to date by agents. portless gave the first one a real address: training.localhost.
- Author
- Julien Déramond
- Published
- Reading time
- 3 min
My training plan used to live at http://127.0.0.1:4747/training/#/. Since 29 November, it lives at http://training.localhost/. The change took one command from portless, a local reverse proxy from Vercel Labs, plus a redirect for the old links.
It’s a small change for a kind of website I build more and more. The tool runs all day on my laptop, I read it in the browser, and an agent keeps it up to date.
Section 01 of 05
Websites an agent feeds#
I have three of them today.
- Training. My trail running plan. I tell a local agent what I did, it updates the plan, and the site shows the weeks ahead.
- Paris. Things to do in Paris. A local agent scans the listings on a schedule and the site shows what it found.
- Bootstrap triage. The backlog of every open Bootstrap issue and pull request, analysed by agents. I explained how it works in Triaging open source with agents, on the Bootstrap blog.
None of them is deployed anywhere. They hold personal data or answers we haven’t posted yet, so they stay on my machine. Each one runs as a background service that starts when I log in and restarts if it crashes.
Section 02 of 05
The trouble with ports#
A port number says nothing. 4747, 47319 and 47320 avoid collisions, but none of them tells you which app is behind it. The /training/ prefix in the old URL was my workaround: a name in the path, because the host had none.
That prefix was useful. I open these tools from the browser’s history far more than from bookmarks, and typing “training” in the address bar found the right URL because the word was in it. With portless, the name moves into the host, so the same few letters still find it, and the path doesn’t have to carry it.
The browser doesn’t like ports either. Local storage belongs to an origin, and the port is part of the origin, so an app that moves to another port loses its saved filters and theme. Cookies ignore the port, so every app on 127.0.0.1 shares the same jar. With a name per app, each one gets its own origin.
Agents have the same problem I have. The project’s instructions now say training.localhost, and that name tells the next session which app it is. A port tells it nothing. The portless README puts it in its first line: “For humans and agents.”
Section 03 of 05
What portless does#
portless runs a proxy on your machine and maps <name>.localhost to a local port. Browsers send every .localhost name to your own machine, so these names need no DNS and no hosts file.
For a dev server, you wrap the command (portless run next dev). portless picks a free port, passes it in PORT, and gives you https://<name>.localhost. My training server already has its fixed port, so it gets a static route instead:
npm install -g portless
portless alias training 4747
The route is saved in ~/.portless/routes.json. By default, the proxy serves HTTPS on port 443 with its own local certificate authority, and that asks for sudo. For a tool only I open, I chose the unprivileged mode: plain HTTP on port 80, no sudo, and only connections from my own machine.
Section 04 of 05
Keeping it running#
The training site has run as a macOS launchd service for weeks, so the proxy had to be one too. portless has portless service install, but on macOS it installs a system service that runs as root. I wanted it under my user, like the site, so a user LaunchAgent starts the proxy at login and restarts it if it stops:
<key>ProgramArguments</key>
<array>
<string>/Users/me/.nvm/versions/node/v24.21.0/bin/node</string>
<string>/Users/me/.nvm/versions/node/v24.21.0/bin/portless</string>
<string>proxy</string><string>start</string>
<string>--unprivileged</string>
<string>--foreground</string>
</array>
<key>RunAtLoad</key><true/>
<key>KeepAlive</key><true/>
portless needs Node 24 or later, and launchd doesn’t load my shell, so the paths point at nvm’s Node 24 directly.
The server got a redirect from /training/… to /. The part after the # never reaches the server, so the browser keeps it, and an old URL from the history like /training/#/day/2026-11-29 still opens the right day. http://127.0.0.1:4747/ still works too, if the proxy is ever down. When a name doesn’t load, portless doctor checks the proxy, the routes and DNS without changing anything.
Section 05 of 05
Done from the chat#
I asked the local agent, in the Training project, to move the site to portless. It wrote the LaunchAgent, added the alias and the redirect, and updated the project’s instructions file with the new URL and the portless doctor command.
That last step is the one that counts for a tool an agent feeds. The instructions the agent reads on every turn now carry the URL, so the next session opens training.localhost and finds the right app.