This week's tip of the week is Portless. If you juggle multiple local apps, you know the dance: port conflicts, wrong browser tabs showing the wrong app, and constantly forgetting whether that API was on 3001 or 8080. Portless works on macOS and Linux (Windows support is a work in progress -- if you're on Windows, WSL should get you there in the meantime) and fixes this by giving each local app a stable named URL instead of a random port number. Install it:

npm install portless

Then update your dev command, e.g. in package.json:

...
- "dev": "astro dev",
+ "dev": "portless run astro dev",
...

The project name gets inferred automatically from your package.json or git config. You can also be explicit:

portless api.myapp pnpm dev # -> http://api.myapp.localhost:1355

If you use git worktrees, Portless has you covered there too. Each worktree automatically gets its own subdomain based on the branch name, so fix-ui becomes http://fix-ui.myapp.localhost:1355 with zero config.

Beyond cleaner URLs, distinct hostnames also sidestep the subtle weirdness you get when cookies and localStorage bleed across apps sharing the same localhost origin. Easier debugging, less "why is my session broken" head-scratching.

And if a process is still holding a port hostage, the Raycast Port Manager Extension pairs well with this.

That's it! Short and sweet. Until the next one!

Keep Reading