Open your dev server on another device
Bind your development server to the local network and open it from another device on the same Wi-Fi.
Start your dev server on the laptop and open it on your phone to check a layout. On the phone, use the laptop’s local IP address and the server’s port.
diagram
One dev server, every device on the Wi‑Fi
Bind the server to a network interface
A server bound to localhost accepts connections only from the same device. Tell your dev tool to listen on a network interface. For a Vite project with a dev script that runs vite, use the host option.
npm run dev -- --host 0.0.0.0That binds the server to all IPv4 interfaces. You can pass the laptop’s LAN IPv4 address instead if you want a narrower bind. Use a trusted local network.
Open the LAN address
Find the IPv4 address for the adapter you are using. On macOS, look under the connected network’s details, or run ipconfig getifaddr en0 if en0 is that interface. On Windows, run ipconfig. On Linux, run ip address.
If the laptop’s address is 192.168.0.100 and Vite prints port 5173, open http://192.168.0.100:5173 in the other device’s browser.
Check the firewall if the page will not load
Allow incoming connections to the dev server on your private network if your firewall blocks them. Check the port the server printed and verify both devices can communicate. Some guest Wi-Fi networks isolate clients from each other.
diagram
Before and after allowing the port through the firewall