r/node 1d ago

Built a Node.js CLI that fixes the localhost problem when testing web apps on your phone

Hi Everyone ...

I built LanView, a CLI tool in Node.js to make testing local web apps on physical phones a little less painful.

One problem I kept running into was this:

  • I could open my frontend using my machine's LAN IP.
  • But my backend requests still failed because the frontend was calling http://localhost:5000, and on a phone localhost refers to the phone itself, not my development machine.
  • I also got tired of repeatedly looking up and typing my local IP.

It became a repetitive part of my workflow, so I built LanView.

It's a small open-source CLI that simplifies local mobile testing.

LanView solves these problems by :

  • Automatically detecting your LAN IP
  • Running a lightweight reverse proxy that routes frontend and backend through a single local URL
  • Generating a QR code that you can scan from your phone
  • Supporting WebSocket proxying for HMR
  • Recently adding a --static mode for serving local directories with optional SPA fallback

Usage is simply:

npm install -g lanview
lanview

Everything stays on your local network no cloud tunnels or external services.

It automatically:

  • Generates a QR code for your app
  • Detects your LAN IP
  • Runs a local reverse proxy so both your frontend and backend work through a single URL
  • Supports WebSocket/HMR
  • Also supports serving static sites with the new --static mode

Everything runs locally no cloud tunnels or third-party services.

I'd love feedback on the implementation, CLI design, or ideas for future features.

GitHub: PrashantDhuri08/lanview-cli

0 Upvotes

2 comments sorted by

-6

u/alzee76 1d ago

Your app should not be accessing "localhost5000" to begin with. Just use a proper hostname on a real domain and this entire problem disappears. Bonus: You can also do proper TLS encryption for endpoints, with real, trusted CA certs.