Run dev servers on a remote dev box and open them from your laptop
Run dev servers on a dev box or home server and open them from your laptop: ssh -L port forwarding, Tailscale and ~/.ssh/config, then one window for both.
The quickest way is one SSH connection that forwards the dev server’s port to your laptop, and the server started in it:
ssh -L 5173:localhost:5173 devbox
cd ~/code/acme-shop && pnpm dev
Now http://localhost:5173 on your laptop is the dev server on the dev box. Add one -L per port (-L 8000:localhost:8000 for the API), and run it inside tmux on the dev box so closing the laptop doesn’t stop it.
Why run dev servers on another computer?
A desktop under the desk, a home server or a cloud VM often has more cores and memory than a laptop, stays on, and keeps the fans quiet. Builds, databases and Docker run there; the laptop only runs the browser and the editor. With VS Code’s or Cursor’s SSH remote, the editor already works on the dev box, and only the dev servers are left.
How do I reach the dev box from anywhere?
Any network SSH reaches works. Tailscale is the easiest from outside the house: install it on both computers and sign in with the same account, and the dev box gets a name such as devbox.tail1234.ts.net that works from any network, without opening a port on the router. A LAN, a VPN or a jump host (ProxyJump) work the same way.
Then give it a short name in ~/.ssh/config on the laptop:
Host devbox
HostName devbox.tail1234.ts.net
User you
IdentityFile ~/.ssh/id_ed25519
and a key, so SSH never asks for a password:
ssh-keygen -t ed25519 # if you don't have a key yet
ssh-copy-id devbox
ssh devbox true # should ask nothing, and print nothing
If the key has a passphrase, ssh-add keeps it in the SSH agent. The first ssh devbox asks whether to trust the dev box’s host key: check it, and answer yes.
Where does ssh -L fall short?
- One port per flag, decided in advance. A Service that moves to another port, or a new one, means a new connection.
- It stops with the terminal. The forward lasts as long as that
ssh; the dev server as long as its shell, unless tmux holds it. - You can’t see what runs. Which servers are up, which crashed and why, is in a tmux pane on another computer.
- Starting them is still by hand. The order, the commands and the environment are in your head, or in a script on the dev box.
How does localhost run them from your laptop?
localhost is a free, open-source desktop app that remembers how each Project runs. A dev box you reach with ssh can be one of its Machines: its Projects show in the window on your laptop, below the laptop’s own, and you start and stop them there.
-
Install localhost on both computers, and add your Projects on the dev box, in its app as on any computer (Quick start), or through a coding agent there with
localhost mcp. Projects on the dev box are edited on the dev box; the app there doesn’t have to stay open. -
Check that the laptop’s
sshfinds it. A command run over SSH doesn’t read your interactive profile, so with zsh, setPATHin~/.zshenv, not~/.zshrc:ssh devbox localhost --version -
On the laptop, open Settings → Machines → Add Machine…, pick
devboxfrom the hosts of~/.ssh/config, and click Add. localhost connects first; if it can’t, it says why and what to do next. -
The dev box’s Projects show in the sidebar under its name. Start All, Stop, Restart and logs work as for a Project on the laptop, and the state of each Service is there at a glance.
-
Open in Browser forwards the Service’s Port to the same port on your laptop, through the same SSH connection, then opens it:
http://localhost:5173there ishttp://localhost:5173here, so OAuth callbacks and cookies keep working.
The Services run on the dev box, with its shell, its files and its Secrets; no Secret value reaches the laptop. Nothing new listens on either computer’s network: Forwards are bound to the laptop’s loopback only. If the connection drops, localhost makes it again on its own, without starting or stopping anything. Services you started from the laptop stop when the connection ends, unless localhost is open on the dev box.
When something doesn’t connect, Machines lists every message localhost shows and what to do.
FAQ
How do I open a dev server running on another computer in my browser?
Forward its port over SSH: ssh -L 5173:localhost:5173 devbox, then open http://localhost:5173 on your laptop. The forward lasts as long as that ssh. In localhost, Open in Browser makes the same forward for you, on the same port number.
Do I need Tailscale?
No. localhost uses whatever ssh devbox uses: a LAN, a VPN, a jump host with ProxyJump, or Tailscale. Tailscale is the easy way to reach a computer at home from anywhere, without opening a port on the router.
Does localhost open a port on the dev box?
No. It runs localhost remote --stdio over your SSH connection, and Forwards ride on that connection, bound to your laptop’s loopback only. Nothing new listens on either computer’s network.
What happens to the dev servers when I close my laptop?
The Services you started from the laptop stop on the dev box once the connection ends, about 45 seconds after the laptop goes quiet, unless localhost is open on the dev box. When the laptop is back, localhost connects again on its own, without starting anything.
Why does it say localhost isn’t installed on the dev box when it is?
A command run over SSH gets a non-interactive shell, which doesn’t read ~/.zshrc. Put the folder holding localhost on the PATH in ~/.zshenv (zsh) instead, and check with ssh devbox localhost --version.