TestingPod

How to Demo Your App without Deployment 100% Free

Written by Naman Garg | September 03, 2024

It is now fairly common among developers to set up a local environment for testing web applications.

Whether you’re using Apache, Mongrel, or the App Engine SDK, it has become apparent that having a production-like environment on your local machine is beneficial as It allows you to iteratively code and debug without needing to deploy to a production server.

But you can take it a step further with a tool like LocalTunnel.

What is LocalTunnel?

LocalTunnel is an open-source network tool that allows you to share your Localhost with the world for quick, easy testing. It's easy to set up, and it provides you with a unique, publicly accessible URL that will proxy all requests to your locally running web server. No more sharing screens to demo a product to your team members!

How to Setup LocalTunnel — Short Guide

This guide assumes that you have Nodejs installed and that you can run bash commands on your terminal. If you don’t have Node installed, you can do so with the npm documentation.

Install LocalTunnel with NPM

To start working with LocalTunnel, install the LocalTunnel client on your machine using the command npm install -g localtunnel which installs LocalTunnel globally on your machine.

After running the command, you should see terminal messages indicating the progress of the installation and a message confirming that the installation was successful if it was successfully installed.

You can verify your installation by running the command lt —-version, which should return the LocalTunnel client's version number.

Run LocalTunnel

Once you have successfully installed the tool, run lt—-port 3000 in your terminal to start a LocalTunnel session. This command should generate LocalTunnel’s default URL, which looks like this: “https://[random-characters].loca.lt”.

Visiting this address in your browser should prompt you for a password. Your password is the public IP of your machine (or VPN public IP, if you’re connected to one). You can get your public IP by visiting https://loca.lt/mytunnelpassword in your browser.

Note: You don’t necessarily have to use port 3000 when running the LocalTunnel command. You can route it to any port running on your local machine. To use LocalTunnel through an API for integration or other automation tests, refer to the official documentation.

How LocalTunnel Works

Here’s an overview of how LocalTunnel works:

  1. Running the LocalTunnel command on your computer tells your machine that you want to make your local website or server accessible online, which creates a LocalTunnel session.
  2. LocalTunnel on your computer talks to a server.
  3. The server assigns a special, unique web address (URL) for your local website.
  4. LocalTunnel sets up a secure connection between your computer and the server.
  5. When someone visits the unique URL assigned to your local website, the server forwards their request to your computer.
  6. The tunnel created by LocalTunnel is temporary. It will stay active as long as you keep the LocalTunnel program running on your computer. Once you stop it or shut down your computer, you can't access that URL anymore.

Why Use Local Tunnels?

  1. It’s Free! Unlike other tunnelling services like Ngrok which requires you to pay for more advanced features, LocalTunnel is completely free.
  2. Secure connection. LocalTunnel ensures that all connections between your computer and the internet are secure.
  3. Testers can quickly share their local testing environments with colleagues or clients using LocalTunnel, enabling seamless collaboration and feedback gathering during the testing process.
  4. Easy webhook simulation. LocalTunnel provides a simple way to test webhooks, which are essential for many modern applications. Testers can easily simulate webhook events and verify that the application responds correctly.
  5. Cost efficient. Setting up a dedicated test server might be expensive for smaller companies. LocalTunnel provides a cost-efficient way of sharing test environments with team members or stakeholders.

LocalTunnel Alternatives

Of course, LocalTunnel isn’t the only tool available to make your local applications public. Other tools include Ngrok which I mentioned earlier, Serveo, PageKite and SSH Tunneling.

  1. Ngrok is the most popular of the four. It offers more customization than LocalTunnel, which is only available with paid plans.
  2. Serveo: Serveo is an SSH server just for remote port forwarding. When a user connects to Serveo, they get a public URL that anybody can use to connect to their Localhost server.
  3. PageKite: If what you need is a consistent URL, then PageKite is a better choice. However, regarding simplicity and setup cost, LocalTunnel comes out on top.
  4. SSH Tunneling: If you have a remote server, you can set up SSH tunnelling to share your local website securely with the world. However, it’s a bit more complicated to use and requires more effort and time to set up.

Conclusion

LocalTunnel is a go-to tool for sharing your local websites or testing setups with others. It's easy to set up and doesn't cost money, helping teams collaborate without hassle.

It is important to note, though, that using LocalTunnel comes with security risks since you’ll be exposing your local machine to the public. So ensure that you only use it for development and testing.

With that being said, Happy Testing!