How to preview next.js app on your mobile phone?

May 17, 2024

Previewing nextjs app on android phone

If you’re working with Next.js, chances are you would like to test your app on your mobile device before publishing it on the internet. To preview your Next.js app on your android or iOS device, follow these simple steps below.

First, you’ll have to find your local IP address. If you don’t know how to find your local IP, then simply search “find local ip on [your os]” on the web, it will tell you how to find it.

Once you have your IP address, make sure your next.js dev server is running, if not, then run npm run dev on your terminal inside the project directory, the dev server will probably run on port 3000.

Make sure your computer and the phone are connected to the same network.

Now on your mobile phone, type your local IP address followed by a colon and the port (example: 192.168.1.4:3000), and you’ll see your nextjs website or app on your mobile phone.