I launched Local Hoster
By Flavio Copes
I launched Local Hoster, a small Node.js CLI that gives local development projects stable .localhost URLs with HTTPS through Caddy.
Today I launched Local Hoster on Prototyped.
It is a small Node.js command-line tool that gives every local project a stable address.
Instead of opening this:
http://localhost:4321
you open this:
https://myapp.localhost
I built it because I was tired of remembering port numbers.
Was this project running on 3000, 4321, 5173, or something else?
I never remembered.
It was even worse when the usual port was already busy.
The development server picked another one, so the URL changed depending on which projects were already running.
Maybe the project was on localhost:4321 today and localhost:4322 tomorrow.
With Local Hoster, I always open https://myapp.localhost.
The port behind it no longer matters.
How it works
Local Hoster puts Caddy in front of your development servers.
You add a localhost name to package.json and put localhoster before your normal development command:
{
"localhost": "myapp",
"scripts": {
"dev": "localhoster astro dev"
}
}
Then you run:
npm run dev
Local Hoster chooses a stable port for the project, adds the HTTP and HTTPS routes to Caddy, and starts the development server.
Now the project is available at https://myapp.localhost.
When you stop the development server, Local Hoster removes the temporary routes and TLS configuration from Caddy.
Nothing accumulates between development sessions.
Why .localhost?
The .localhost domain is reserved for local development.
Names such as app.localhost and api.localhost resolve to your own computer. You do not need to edit /etc/hosts or run a local DNS server.
The project name becomes the address.
I am already using Local Hoster to run flaviocopes.com and Prototyped locally.
I know which URL to open before I start the server. The address stays the same when I restart the project.
Browser history also becomes useful again. I can type the project name instead of looking for the right port.
Local HTTPS
Caddy can issue locally trusted certificates through its internal certificate authority.
This gives the project a real HTTPS origin in the browser.
That matters when you are working with:
- secure cookies
- service workers
- WebAuthn
- browser credential APIs
- OAuth callback URLs
- other features that expect HTTPS
You deliberately trust Caddy’s local certificate authority once. After that, Local Hoster asks Caddy to create the temporary TLS configuration for each project.
The certificates and addresses are local to your machine. This is not public hosting.
A small tool on purpose
Local Hoster has zero runtime npm dependencies.
Node.js reads the project configuration, validates the hostname, chooses the port, talks to Caddy, starts the command, and handles cleanup.
The development command is started directly, without passing it through a shell.
The implementation is small enough to read and change.
You could add automatic port conflict detection, support a different proxy, build a dashboard for active projects, or package your version with Homebrew.
What you get
Local Hoster is available on Prototyped for a one-time $20 purchase.
The download includes:
- the complete Node.js source code
- the
localhosterexecutable - automated tests
- setup and configuration instructions
- architecture and decision documents
- security and customization notes
- instructions for coding agents
- an MIT license
You need Node.js 18 or newer and a local Caddy installation with its admin API available.
The development command must accept a --port option. This works with Astro, Vite, and other compatible development servers.
Get Local Hoster on Prototyped.
Related posts about news: