Your localhost is now on your phone — effortlessly.
PhoneHost is a simple CLI tool that lets developers preview their local development websites (like localhost:3000) directly on their mobile phone. No need for USB debugging, emulators, or clunky setups — just scan a QR code and see your site live on your phone, instantly.
Responsive web development often requires testing on real mobile devices — not just Chrome DevTools. But setting up a way to preview your localhost on your phone can be annoying. PhoneHost eliminates that pain with one simple CLI command.
Whether you're building with:
- Next.js
- Vite
- React
- Vue
- Svelte
-- ...or anything that runs on
localhost
PhoneHost is compatible with a wide range of development tools and frameworks. Here are some officially supported and tested environments:
- ✅ Next.js
- ✅ Vite (requires
--hostflag) - ✅ React (CRA)
- ✅ Vue (Vue CLI and Vite-based)
- ✅ Svelte and SvelteKit
- ✅ Angular
- ✅ Astro
- ✅ Any tool that runs a local server on a specific port
💡 Make sure to run your dev server with a publicly accessible host when necessary (e.g.
vite --host) so PhoneHost can detect and forward traffic correctly. (Note that you may not need this starting with v.1.0.3).
This tool helps you test on real hardware in seconds.
- 🔍 Detects your machine’s local IP automatically
- 📱 Generates a QR code you can scan with your phone
⚠️ Warns you if the port isn't running anything- 🌐 Remote tunneling for public or restricted Wi-Fi
- 📦 Lightweight, zero config, runs instantly
Install it globally via NPM:
npm install -g phonehostOr use it directly via npx:
npx phonehost --port 3000Make sure your local dev server is running (like npm run dev for Next.js) on the port you want (e.g. 3000), then:
phonehost --port 3000or
phonehost -p 3000Note: If you don't specify the port it will search for an active port from theses : [3000, 5173, 8080, 4321, 4200].
You’ll get output like:
📱 Scan this on your phone to preview:
🔗 http://192.168.1.42:3000
[QR CODE]
Open your phone’s camera or a QR app — and you’ll instantly see your site on your mobile browser over your local Wi-Fi.
If your phone is not on the same Wi-Fi or you're on public or restricted networks, you can use PhoneHost's built-in tunneling feature to create a public link using localtunnel.
This option works out-of-the-box — no additional installation required.
phonehost --port 3000 --tunnelor
phonehost -p 3000 -tYou’ll get a public link like:
🔗 https://your-link.loca.lt
⚠️ Note: On some networks,loca.ltmay ask for your public IP as a password to access the link. This is a security feature from the service. The Password will be displated in your Terminal.
By default, PhoneHost uses localtunnel for public access — but this may require entering your public IP as a password when accessing the link from your phone.
To avoid this prompt, you can switch to Cloudflare Tunnel, which provides a clean and password-free experience.
- Install
cloudflared(only once):
npm install -g cloudflaredOr download manually from: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation
- Use PhoneHost with Cloudflare:
phonehost -p 3000 -t --provider cloudflareYou’ll get a public URL like https://your-site.trycloudflare.com without any password screen.
💡 If
cloudflaredis not installed, the CLI will let you know and give you the install command.
Clone the project:
git clone https://github.com/yourusername/phonehost.git
cd phonehost
npm installRun the CLI locally:
npm run start -- --port 3000MIT © 2025 Adil Hussain