How to share localhost
localhost means the computer you are on, so a localhost:3000 link won't open anywhere else. To show your site to a teammate, a client or your phone, there are four options.
1. Your local IP address
If the other device is on the same network, use your computer's address, such as http://192.168.1.20:3000.
- Good for: a phone on your desk.
- Catches: both devices must share a network, many dev servers only listen on localhost until you tell them otherwise (
vite --host,next dev -H 0.0.0.0), and it isn't HTTPS, so features like the camera won't work.
2. A tunnel
A small program opens an outgoing connection to a public server, which gives you a URL. Here is how that works.
npx hostc@latest 3000- Good for: sharing with anyone, anywhere, in seconds. Receiving webhooks.
- Catches: the link only works while your computer is on and the tunnel is running, and anyone with it can reach your server.
3. Port forwarding on your router
You tell your router to send outside traffic to your computer.
- Good for: very little these days.
- Catches: many home networks sit behind carrier-grade NAT, so it may not work at all. It exposes your machine directly, and you would still need HTTPS.
4. Deploy a preview
Push to a host such as Vercel, Netlify or Cloudflare and share the preview URL.
- Good for: something people need to look at tomorrow, or next week.
- Catches: it takes setup, and every change means another build. Local databases and services aren't there.
Which to pick
| You want to | Use |
|---|---|
| Check your site on your own phone | A tunnel, or your local IP |
| Show a teammate for five minutes | A tunnel |
| Receive webhooks | A tunnel |
| Share with a client for a few days | A deploy |
| Run something real | A deploy |
A tunnel makes your server public, so don't expose admin panels, databases or secrets, and stop it when you are done.
Give localhost a public URL, free and with no account
npx hostc@latest 3000