Viewing Your Next.js App on Mobile Without ngrok: A Simple Guide

Viewing Your Next.js App on Mobile Without ngrok: A Simple Guide

Are you developing a Next.js application and want to test it on your mobile device or VisionPro headset without exposing it to the internet? There's a simple solution that doesn't require using tools like ngrok.

Here's how you can do it

  1. Run your Next.js app on your Mac using your preferred package manager:
      • npm run dev
      • pnpm dev
      • bun dev
  1. On your Mac, go to: Settings -> General -> Local hostname You'll see a hostname that looks something like "Sheesh-Bae.local".
    1. notion image
  1. On your mobile device or VisionPro headset, simply enter the hostname followed by the port number your Next.js app is running on.
    1. For example: Sheesh-Bae.local:3000
    2. Make sure your mobile device or VisionPro is connected to the same network as your Mac.
  1. If you find the hostname too long to type, you can easily rename it by clicking the "Edit" button next to the hostname in your Mac's settings.
That's it! You can now access your Next.js app on your mobile device or VisionPro headset without exposing it to the internet.
This method is particularly useful when you're developing on a VisionPro and want to quickly test your Next.js sites in the headset while staying on your local network.
By leveraging the local hostname feature, you can streamline your development process and easily test your Next.js applications on various devices without the need for additional tools or internet exposure.