Go Global with Your Localhost

Have you ever built a web app on your local computer and wished you could share it with someone across the world without deploying it to a server? Or maybe you want to test webhooks from Stripe or WhatsApp on your localhost?
That’s where Ngrok comes in as a powerful solution.

Recently, I created an API and needed a temporary link for my backend. I wanted to share the cURL of my API with someone in a different location, but since my server was running on localhost, I wasn’t sure how to do it.

After searching online for ways to temporarily deploy my backend server, I discovered that Ngrok provides a simple solution. I used it, and the other person was able to successfully test my API—it worked perfectly!

This experience was really helpful in testing my API, and it inspired me to write a blog post and share it with the coding community. I know there are already many blogs on this topic, but I love documenting and sharing whatever I build or learn.

So, that’s the story behind this post!

Let’s break it down in a super simple, step-by-step way.

What is Ngrok?

Ngrok is a free tool that lets you expose your local server to the internet. It creates a secure tunnel from your local machine to a public URL.

In plain English:

You build something on your computer → Ngrok gives you a link → Anyone can open that link in their browser to see your local project.

Why use Ngrok?

  • Test your app on other devices

  • Demo your project to someone remotely

  • Use services like Stripe, Twilio, or WhatsApp that require a public URL

  • Debug APIs easily from anywhere

How to Use Ngrok (Step-by-Step)

Follow the steps and Let’s get Ngrok up and running in just 5 minutes!

Step 1: Sign Up on Ngrok

  1. Go to https://ngrok.com

  2. Click on "Sign Up" (you can use GitHub, Google, or email)

  3. Once logged in, go to your Dashboard

Step 2: Install Ngrok

Ngrok is a command-line tool. You can install it based on your operating system.

For Windows:

  1. Download the installer from https://ngrok.com/download

  2. Unzip the downloaded file

  3. Move ngrok.exe to a location like C:\\ngrok\\ or add it to your PATH

For Mac/Linux:

brew install ngrok   # For Mac (if you use Homebrew)

Or download directly:

wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
sudo mv ngrok /usr/local/bin

Step 3: Connect Your Account (Set Auth Token)

  1. In your Ngrok dashboard, you'll see your Auth Token

    (something like ngrok authtoken 1a2b3c4d...)

  2. Copy it and paste in your terminal:

ngrok config add-authtoken YOUR_AUTH_TOKEN

Step 4: Start a Tunnel

Let’s say you’re running a local server on port 3000 (like a React or Node.js app):

ngrok http 3000

You’ll now see something like:

Forwarding    <https://abcd1234.ngrok.io> -> <http://localhost:3000>

Open that https://abcd1234.ngrok.io in any browser — or send it to someone else. It points directly to your local app!

Step 5: Test It Out!

Try accessing it from:

  • Your phone (make sure it’s not on localhost)

  • A friend’s computer

  • Postman or CURL for API testing

  • Tools like Stripe or WhatsApp webhook testers

Bonus: A Few Pro Tips

  • Secure tunnels: Ngrok uses HTTPS out of the box.

  • Custom subdomains: With a paid plan, you can use your own subdomain like https://myapp.ngrok.io

  • Inspect requests: Ngrok gives you a cool web UI at http://127.0.0.1:4040 where you can see all incoming requests and responses.

Stop Ngrok

Just press Ctrl + C in the terminal where Ngrok is running.


Use Cases (In Real Life)

  • Stripe Webhooks testing

  • WhatsApp bot development

  • Client demos without deployment

  • Backend API debugging on mobile


Ngrok is like having a magic bridge between your local computer and the internet. Whether you're testing, demoing, or debugging it just works.

If you're a developer, this tool will save you hours of pain. And the best part? It's free to start.

Found this helpful? Drop a comment below — I’d love to hear your thoughts or experiences! Happy coding!

0
Subscribe to my newsletter

Read articles from Mohd Ahsan Raza Khan directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mohd Ahsan Raza Khan
Mohd Ahsan Raza Khan

👋 Hi, I'm Mohd Ahsan Raza Khan! I know you might be thinking my name is quite long, right? Don't worry, you can call me MARK. I'm a software developer with a passion for building web applications and sharing knowledge through writing. Currently, I work as a Web Developer at Kepler Voice, where I specialize in full-stack development. I love exploring new technologies and frameworks, and I'm particularly interested in JavaScript, ReactJS, NodeJS, ExpressJS, and MongoDB. In my free time, I enjoy learning about new technologies and writing tutorials to help others learn and grow in their coding journey. I'm always excited to connect with fellow developers, so feel free to reach out to me on LinkedIn. Let's build something amazing together!