Local Tunnel: Test Your Applications Without Deploying to a Live Server

Harshdeep Singh
4 min readMar 6, 2023

--

Source: — Unsplash.

As we all know, the software development world is mysterious and awe-inspiring. It’s a world of zeroes and ones, of lines of code that somehow make our devices come alive. It’s a world where a small mistake can cause a catastrophic failure and a simple typo can bring down an entire system.

As a developer, there are many times when you need to test your applications on a live server. However, what do you do if you don’t have access to a server or if you don’t have any data to test with?

My Story

As I love to explore new technologies and work on them. Recently, I was working on the backend Django server to create and deliver API. Now, as soon as the development at my end was done, I asked a fellow front-end developer to integrate APIs and test the flow. Since the flow has some integration with third-party APIs and I was not allowed to share the credentials. Having the code on my system I had two choices:-

1. Either as the developer to do the coding on my system (the dumb idea).
2. To take the code on some server and let the developer test the flow and integrate apis.

Now, I cannot do the second as it is costly. In case I need to change some data points or some flow from the backend I need to again deploy the whole code.

And here the Localtunnel comes to the rescue.

What is Local Tunnel?

Local Tunnel is a backend service that provides developers with a public URL for their locally hosted websites. This means that developers can test their applications without having to deploy them to a live server. The best part is that it’s completely free and easy to use.

or in more simple words

It allows us to share any kind of service (for example web service, local storage service) on our local machine to the person from different corners of the world.

How it works

Local Tunnel allows us to easily share a web service on our local development machine without any server modifications. It will assign a unique URL that can be publicly accessible that will proxy all requests to our locally running web server.

Let's set this up now……

1. Lets first install the Local Tunnel.

2. Now lets start some server… I have started a demo dart server and below is the screenshot on chrome.

Localhost server

3. Now using the command we will start our server and generate a public URL from terminal/cmd.

Since i have started a dart server, my localhost server started at 4040. So, using lt — port 4040 to host my server on web

Now, you server is hosted with the random URL shared with you when command is run.

When you host your server, when you hit the URL, you'll get a screen like this. Click to continue and you can see the same localhost server details as localhost:4040
When we click to continue. here we got our server.
Screenshot of chrome from my mobile device on mobile data network

So, with three easy steps you can actually provide your server over HTTPS connection to anyone (Mostly, developers working with you :P)

Benefits of Local Tunnel

One of the main benefits of using Local Tunnel is that it allows frontend developers to test their applications with real data. For example, if you’re building an e-commerce website, you can use Local Tunnel to test the checkout process with real payment data. This is a much more accurate way of testing your application than using dummy data.

On the backend side, Local Tunnel allows developers to test their APIs and webhooks without having to deploy them to a live server. This makes it much easier to debug and test your code in a controlled environment.

Another benefit of Local Tunnel is that it provides a secure way to test your applications. The tool uses HTTPS encryption to protect your data, which is essential for applications that handle sensitive information. This means that you can test your application with confidence, knowing that your data is secure.

Conslusion: — Using Local Tunnel is also incredibly easy. All you need to do is install the tool, start your local server, and run the Local Tunnel command. The tool will then provide you with a public URL that you can use to access your locally hosted website.

Resources:-

a. Local Tunnel (https://localtunnel.me/)

I hope you enjoyed this article and found it useful, if so please hit the Clap button. Let me know your thoughts in the comments section.
Happy coding! Thanks for reading!

Note — This will work till the local server is working on the machine.
Also, to test the API on the server try putting Bypass-Tunnel-Reminder and some value in the header.

--

--

Harshdeep Singh
Harshdeep Singh

Written by Harshdeep Singh

Senior Software Engineer @ One Impression | Django REST Framework, Python, MySQL, Flutter, Android, IOS, Any Tech Stack!

No responses yet