If you need to access your desktop's localhost from your phone but don't want to deal with USB connections, you can use ADB over Wi-Fi with adb reverse to make it happen. This enables you to seamlessly and wirelessly run the Mini app on Telegram’s test environment on your phone. No nasty local IPs, no Internet forwarding, no nonsense. Pure efficacy. This guide will walk you through the setup process step by step.
Normally, localhost on your phone refers to the phone itself. But by using ADB reverse port forwarding, you can make your phone's localhost:PORT actually point to your desktop's localhost:PORT, enabling seamless access to your development server.
- Open Settings on your Android device.
- Go to About phone > Tap Build number multiple times to enable Developer Mode.
- Go back to Developer options (now available in settings) and enable USB Debugging.
- Connect your phone to your desktop using a USB cable.
- Open a terminal or command prompt on your desktop and check if ADB detects your device:
If your device appears in the list, you're good to go.
adb devices
- Run the following command to switch ADB to listen over TCP/IP:
adb tcpip 5555
- Find your phone's local IP address:
- Go to Wi-Fi Settings > Tap on the connected network > Note down the IP Address.
- Connect to your phone over Wi-Fi:
Example:
adb connect <PHONE_IP>:5555
adb connect 192.168.1.100:5555
- Disconnect USB (ADB should remain connected over Wi-Fi):
Your device should still be listed.
adb devices
Now that your phone is connected via ADB over Wi-Fi, set up port forwarding:
adb reverse tcp:5173 tcp:5173 # For frontend (Vite, React, Vue, etc.)
adb reverse tcp:8000 tcp:8000 # For backend (Node.js, Python, etc.)Now, open your mobile browser or app and enter:
http://localhost:5173 # Frontend
http://localhost:8000 # Backend
It will now correctly reach your desktop's localhost instead of your phone’s.
If you need to remove previous port forwarding rules, run:
adb reverse --remove-allIf you previously set up adb forward, remove those as well:
adb forward --remove-allYour phone is now able to access your desktop’s localhost over Wi-Fi, just like Chrome's USB debugging but without the cable! 🚀