Hostline
Your localhost as a link.
Let a friend try what you're building without a deploy, or open it on your phone without being on the same Wi-Fi. Hostline turns a port on your computer into a link, and whoever opens it gets your app in their browser, straight from your machine.
One line in PowerShell puts it on your PATH:
irm https://hostline.luannzin.com/install.ps1 | iexSharing a port
- Start your app the way you always do.
- Run Hostline with its port:
hostline 3000 - Send the link, or point your phone's camera at the QR code. The link is already copied.
With Node, there's nothing to install: npx hostline 3000
Try it here
The computer shares a file instead of a port, and the phone opens the link. Both ends run in this page, over a real WebRTC line and Hostline's own frames. Run it, open the link, then edit the page and watch the phone.
Your computer
$ hostline 3000
Their phone
Run Hostline on the computer first.
What they see
- Before your app
- While the link opens, the page says it comes from someone's computer, through Hostline.
- Your app
- At its own path, with Live in a corner. Hot reload works through the link: you save, their page updates.
- When you stop
- Every page that has the link open says it ended. The next run gets a new link.
Running it
- Any port, not only dev servers: vite, next dev, next start, vite preview, a Python http.server, an API with a page in front of it.
- With no port, Hostline looks at the usual ones (3000, 5173, 8080 and a dozen more) and shares the one that's listening.
- hostline --for 30m ends the link after 30 minutes (s, m and h work). Without it, the link lasts until you press Ctrl+C.
- Each person who opens the link shows up in your terminal: ● Safari on iPhone opened the link.
How it gets there
- Finding each other
- Everything after the # in the link stays in the browser, so this site never sees it. Your computer and their browser meet in a room on public Nostr relays, named by a hash of the link's secret, and seal every message with a key made from it.
- The line
- Once they've met, it's one WebRTC data channel from their browser to your machine, encrypted. The relays drop out.
- The page
- This page opens your app in a frame, and its service worker hands every request the app makes to the line. Hostline makes the real request to your port and streams the answer back. WebSockets go the same way.
- Cookies and storage
- Cookies live in a jar on your machine, one per visitor's browser, kept across reloads until the link ends, so logins work. localStorage, sessionStorage and IndexedDB belong to the link, and go when it ends.
What goes where
- Anyone with the link reaches the port you shared, and only that port, while Hostline runs. Treat it like a key to that port.
- The relays see that two IP addresses met. They can't read the link or the connection details.
- Your app's traffic goes straight between their browser and your machine, with no server of mine in the middle. You can see each other's IP address, as in any peer-to-peer connection.
Not there yet
- When both sides are behind strict networks (some mobile carriers, company firewalls), there's no direct path and it doesn't connect. There's no relay to fall back on yet.
- The shared app's own service worker doesn't install, and Cache Storage is shared by every link.
- The visitor's browser needs service workers, which some private windows turn off.
- Tested so far in Chrome on Windows and Firefox on Linux.
Every file
| System | File | How |
|---|---|---|
| Linux, x86_64 | hostline-linux-x86_64chmod +x, then run it from a terminal. One line puts it in ~/.local/bin: curl -fsSL https://hostline.luannzin.com/install.sh | sh | |
| Linux, arm64 | hostline-linux-arm64chmod +x, then run it from a terminal. On an arm64 machine, the line above installs this one. | |
| macOS, Apple silicon and Intel | hostline-macosOne file for both. Downloaded in a browser, macOS stops it until you allow it in System Settings, Privacy & Security. One line puts it in ~/.local/bin, and macOS doesn't stop it the way it stops a downloaded file: curl -fsSL https://hostline.luannzin.com/install.sh | sh | |
| Windows 10 and 11Yours | hostline-windows-x86_64.exeRun it from a terminal. One line in PowerShell puts it on your PATH: irm https://hostline.luannzin.com/install.ps1 | iex |
Installed copies keep themselves up to date: when a new version is out, Hostline swaps itself for it while it runs, and the next run is the new version. npx runs the version npm picks.