dev-lan
v0.1.1
Published
Open your PC's dev servers on real Android phones as localhost, over USB or Wi-Fi, with Chrome DevTools for each tab. Includes the devhost desktop app (Windows).
Maintainers
Readme
dev-lan
Open your PC's dev servers on real Android phones as http://localhost:3000,
over USB or Wi-Fi, and inspect each phone tab with Chrome DevTools. One command:
dev.
npm install -g dev-lan
dev dev ports 3000, 4173 · 2 devices ready
DEVICE MODEL LINK ADDRESS INSPECT
● Pixel 8 Pixel 8 USB #38031FDJH00ABC inspect · built-in :3000/checkout
Wi-Fi #192.168.1.23:5555
● Galaxy Tab SM-X710 Wi-Fi #192.168.1.31:5555 no tab
You can unplug Pixel 8 now: it stays connected over Wi-Fi.- localhost on the phone: the phone opens
http://localhost:3000and reaches your PC (Android'sadb reverse). That includes service workers, secure cookies and OAuth redirects, which treat localhost as secure, so you need no certificates or LAN addresses. - Wi-Fi that stays up: plug a phone in once and
devmoves it to Wi-Fi. Unplug it and keep working. Android's own Wireless debugging switches itself off whenever the phone changes access point; dev's connection doesn't. - Inspect links: for every phone tab showing one of your ports, open
Chrome DevTools (
inspect, orbuilt-infor Chrome's own DevTools). - Desktop app: live phone screens, every tab and WebView, and reconnects
phones by itself after they sleep.
dev appinstalls it.
Windows 10 or 11 for now (macOS and Linux are planned). Needs Node.js 18 or later.
Install
npm install -g dev-lanThis gives you the dev command everywhere (devlan is the same command,
in case another tool already uses the name dev).
The first dev checks for adb, the tool that talks to Android phones. If
your PC has none, it offers to download Google's platform-tools (about 7 MB)
into ~/.devhost. You can also do that ahead of time with dev setup.
Connect an Android phone
With a USB cable (easiest, once per phone)
- On the phone, turn on Developer options: Settings › About phone, tap Build number 7 times. Some phones put it under Software information.
- Settings › System › Developer options › turn on USB debugging.
- Plug the phone into the PC and run:
dev - The phone asks "Allow USB debugging?". Tick Always allow from this
computer and tap Allow, then run
devagain if the phone isn't in the table yet. devswitches the phone to Wi-Fi as well. When it prints "You can unplug … now", take the cable out.- On the phone, open
http://localhost:3000in Chrome.
The Wi-Fi link lasts until the phone restarts. After a restart, plug the phone in once more, or pair it over Wi-Fi as below.
Without a cable (Wireless debugging, Android 11+)
The phone and the PC must be on the same Wi-Fi.
- Turn on Developer options (step 1 above).
- Settings › System › Developer options › Wireless debugging: turn it on.
- Run:
dev pair - On the phone, inside Wireless debugging, either:
- Pair device with QR code, and scan the QR code
dev pairshows in the terminal; or - Pair device with pairing code.
dev pairfinds the phone and asks for the 6-digit code it shows; type it in.
- Pair device with QR code, and scan the QR code
- The phone appears in the table, already on stable Wi-Fi.
Phones paired this way are found again by themselves the next time you run
dev.
Every day
devThis connects every phone it knows: USB, Wi-Fi and phones paired earlier. It opens your ports on each, shows the table, and stops. Run it again whenever a phone wakes up or you plug one in. The desktop app does this continuously.
Ports
dev opens ports 3000 and 4173 by default. Other ports:
dev --ports 3000,5173,8080Each phone can then open http://localhost:<port> for each of them.
Inspect a phone tab
The table's INSPECT column lists each phone tab showing one of your ports. In Windows Terminal each tab gets two links:
- inspect opens Google's web DevTools for that tab;
- built-in shows an address to paste into Chrome for Chrome's own DevTools.
Other terminals show just the tab's path (:3000/checkout); the desktop app
has DevTools for every tab too. The links go through a small relay on
127.0.0.1:9299 that dev starts in the background, reachable from this PC
only.
The desktop app
dev app # install or update it, and open it
dev app open # open it
dev app uninstall # remove it (Settings › Apps works too)The app comes inside this package; nothing else is downloaded, and no admin
rights are needed. It installs into %LOCALAPPDATA%\Programs\devhost, adds a
Start menu entry and starts with Windows. It shows:
- every connected phone and tablet, with its live screen (touch and keys work);
- every Chrome tab and WebView, with DevTools;
- phones that need attention (asleep, not allowed, not paired), with what to do.
It also keeps phones connected: when one sleeps and wakes, it gets its ports
back without you running dev.
Android live screens and recordings use scrcpy's server. Install it once:
winget install Genymobile.scrcpyiPhones and iPads
dev ios # what works, and your dev server's address for the iPhone
dev ios setup # once: what the desktop app needs to show an iPhone- No
localhoston iPhones. On an iPhone,localhostis always the iPhone itself, and iOS has no equivalent of Android'sadb reverse. Open your dev server by the PC's address instead (dev iosprints it), with your dev server listening on all addresses (for examplevite --host). - Live screen in the desktop app (iOS 27 or later, with Developer Mode on).
You get touch, keyboard, Home and the side buttons, and full screen.
- Run
dev ios setuponce. It installs the open-source pymobiledevice3 and needs Python 3.9+. - Plug the iPhone in, unlock it and tap Trust.
- Run
dev appand choose the iPhone. After this first USB connection, the iPhone also works over Wi-Fi. If you pull the cable, the screen moves to Wi-Fi by itself.
- Run
- While its screen is shown, iOS keeps the iPhone's camera and microphone off. That's Apple's rule for remote viewing.
For scripts and agents
dev --jsonThis prints one JSON document instead of the table and never stops to ask. The exit code is 0 when every phone is ready, 1 when there's no phone, and 2 when something needs attention.
Troubleshooting
| What you see | What to do |
| --- | --- |
| No phone found over USB or Wi-Fi. | Check the cable and that USB debugging is on, or run dev pair. |
| … is unauthorized | Unlock the phone and tap Allow on the USB debugging prompt, then run dev again. |
| … is offline | Unlock the phone; if that doesn't help, unplug and replug it. |
| … has wireless debugging on but is not paired | Run dev pair. |
| A phone that worked yesterday is missing | It restarted, so plug it in once or run dev pair. |
| localhost:3000 doesn't load on the phone | Make sure your dev server is running on the PC, and on that port. |
| This PC has no adb | Let dev download it, or run dev setup. |
Uninstall
dev app uninstall # if you installed the desktop app
npm uninstall -g dev-lanSettings and remembered phones are kept in ~/.devhost; delete that folder
to remove them too.
Licence
MIT
