Blog

Can I see my dev server on my phone while an agent codes on my machine?

Yes. The short version: forward your machine’s dev server port to your phone over the SSH connection you already use, and load it in a browser. The longer version is which way to do it.

Yes. Your dev server is listening on a port on your machine, something like localhost:5173. To see it on your phone you have to reach that port from the phone, and there are a few ways to do that. Several apps now build a browser in so the preview sits next to the terminal. I built one of them, Solavera. Here’s where each option helps, and where it costs you.

Why can’t my phone just load localhost?

localhost means “this machine.” On your machine it points at the machine. On your phone it points at the phone. So when the agent starts a dev server on localhost:5173 on the machine and you type that into mobile Safari, the phone looks at itself, finds nothing, and gives up.

Every method below is a different way to cross that gap and reach the machine’s port from the phone.

Can I use Tailscale and mobile Safari?

Yes, with one change. Tailscale puts your machine and your phone on the same private network, so the machine has an address your phone can reach. Most dev servers bind to localhost by default, though, which refuses connections from anything but the machine itself. You have to start it bound to all interfaces, like vite --host or next dev -H 0.0.0.0, and then load http://<your-tailscale-ip>:5173 in Safari.

What it costs you: the preview is in Safari, away from your terminal, so you’re switching apps to look and switching back to type. And you’ve widened the bind from localhost to your whole tailnet for the session. Fine for a quick look, clunky as a loop.

What about a tunnel like ngrok or cloudflared?

This works and a lot of people use it. You run ngrok http 5173 or a cloudflared tunnel, and you get a public URL that points at your dev server. Open it on the phone, anywhere, done.

What it costs you: you’ve put your in-progress dev server on the public internet, and you get a fresh URL most sessions that you paste around. You’re also adding and running a tunnel as its own step every time you want to look.

Can I just deploy a preview?

Yes, and the result is real. Push the branch, let Vercel or Netlify build a preview deploy, open the link on your phone.

What it costs you: it’s the slowest loop there is. You wait for a build to see a one-line change, and you’re looking at the deployed version, not the thing the agent is editing on your machine right now.

What changes when the preview is in the app?

The other route is to forward the dev server’s port over the SSH connection your terminal already holds, into an app that renders it. The phone loads the forwarded port as a local address, so the browser is loading your machine’s dev server with nothing exposed publicly. Several iOS apps do a version of this now.

In Solavera the preview is a sheet over the terminal. You run the dev server, open the preview, and your site renders in the bottom half while the agent works in the top half. Hot reload travels over the same connection, so the page repaints as files change. Nothing goes on your machine except the SSH server it already has, since the preview rides the connection instead of needing a tunnel or a host agent.

Which one should you use?

If you just need to glance at a page once, Tailscale and Safari is fine. If you’re sharing the running site with someone else, a tunnel is the right tool. If you want the deployed truth, a preview deploy is honest about what shipped.

If what you’re doing is driving an agent and watching the frontend it builds, you want the preview and the terminal in the same place, repainting as the agent works, without a URL to manage or anything to leave running on your machine. That’s the loop I wanted, and it’s why the preview in Solavera loads the dev server straight over the SSH connection.

FAQ

Can I see my machine’s dev server on my phone?

Yes. Your dev server listens on a port on your machine. You reach that port from your phone, either by loading it over your private network in mobile Safari, exposing it through a tunnel, or forwarding it over your SSH connection into an app that renders it. The SSH route keeps it private and needs nothing installed on the machine.

Do I need a tunnel like ngrok to preview localhost on my phone?

No. A tunnel works, but it puts your dev server on a public URL you have to manage each session. Forwarding the port over your existing SSH connection reaches the same dev server without exposing anything publicly.

Why can't my phone load localhost from my machine directly?

Localhost on your machine means that machine only. Your phone is a different machine, so localhost on the phone points at the phone. You have to reach across to that machine’s port somehow: over your private network, through a tunnel, or over an SSH port-forward.

Does previewing my dev server on my phone require installing anything on my machine?

It depends on the method. A tunnel or a host agent does. Forwarding the port over SSH does not. On a Mac you turn on Remote Login, which macOS already includes, add your SSH key, and the preview rides the connection the terminal already holds.