Skip to main content

Command Palette

Search for a command to run...

Stop Saying "It Works on My Machine": A Quick Intro to Ngrok

By: Aarjit Adhikari

Updated
2 min read

We’ve all been there. You spend hours building a web app for a project. It looks great. It works perfectly on your laptop. You turn to your teammate or a friend and say, "Hey, check this out," and then realize you can’t send them a link because it’s only on your computer (I sure hope you didn’t try sending a localhost URL).

That’s because localhost is just that, local. It’s literally on your computer. For anyone else to see your work, you usually have to "deploy" it to a server, which can take a long time to set up and debug.

This is where Ngrok saves the day.

What is it?
Put simply, Ngrok creates a secure tunnel from the public internet directly to your computer.

When you run Ngrok, it gives you a weird-looking public URL (something like https://a1b2-c3d4.ngrok-free.app). When someone clicks that link on their phone or laptop, Ngrok catches the request, pushes it through the tunnel, and forwards it to your local server running on port 3000.

Basically, it tricks the internet into thinking your laptop is a public server.

Why is this actually useful?

You might be thinking, "I’ll just deploy my site when I’m done." That’s fine for the final product, but Ngrok is a lifesaver during development for a few reasons:

Testing on mobile: Chrome’s "mobile view" is okay, but it’s not the real thing. With Ngrok, you can send the link to your actual iPhone or Android, open it in Safari or Chrome, and see exactly how your site feels in your hand.

Demos: If you’re at a hackathon or a showcase, Wi-Fi can be spotty. Sometimes, deploying fails at the last minute. With Ngrok, you can just run your code locally and give the judges the link. It’s the fastest way to show off a "work in progress."

Webhooks (The big one): This is a bit more technical, but super important. If you are building an app that uses something like Stripe for payments or Twilio for SMS, those services need to "talk" to your app. They can’t talk to the local host. But they can talk to an Ngrok URL. It’s the only easy way to test those features without deploying.

How hard is it to use?

It’s surprisingly simple. You install it, and then run one command in your terminal:

ngrok http 3000

That’s literally it. It gives you a web address, and you’re live.

It’s a small tool, but it solves one of the most annoying problems in development: getting your code off your machine and into the world.