https://softwareengineeringstandard.com/2024/03/19/ngrok-alternative-open-source/ [favicon] Software Engineering Standard * Home * All Articles * Latest Articles * Popular Articles * JavaScript * TypeScript * Productivity Tunnelmole, an ngrok alternative (open source) [tunnelmole] By Robbie Cahill March 19, 2024 [hacker-new] follow us in feedly Tunnelmole is an ngrok alternative (open source and free). Making applications publicly accessible from your local machine is an increasingly important feature for software developers. From automating life with webhooks, using your phone for mobile site testing or even sharing your work over the internet - the applications are endless. Amidst available software utilities that aid in these tasks, one has particularly secured its place as an industry favorite: ngrok. However, as an open-source enthusiast, I'm thrilled to introduce you to Tunnelmole - an open-source alternative to ngrok!. Why choose Tunnelmole? Tunnelmole is free and open-source. Unlke some other ngrok alternatives, there is no SSH port forwarding, no NAT/networking config and you are not required to run anything on a server, unless of course you want to self host the Tunnelomole service. A Quick Demo This demo sets up a Public URL tunneling to the tunnelmole website which is running locally tunnelmole demo Installation There are a few ways to install Tunnelmole. Universal Installer for Linux, Mac and Windows Subsystem for Linux Copy and paste the following into a terminal: curl -O https://install.tunnelmole.com/n3d5g/install && sudo bash install The script will detect your OS and install the right version. If you have NodeJS 16.10 or later, you can install Tunnelmole by running sudo npm install -g tunnelmole Windows 1. Download tmole.exe 2. Put it somewhere in your PATH. I'd like to have the install script for Linux and Mac also working in Cygwin and Mingw. Let me know if you're willing to help test!. Using Tunnelmole First, verify that the install went fine by running tmole This command should print the help and doesn't connect to any external services. If instead you got an error and you installed with npm, you probably have an older version of Node (lower than 16.10) installed. Check your NodeJS version with node --version and then reinstall using one of the above copy/paste install commands to get the pre compiled binary for your platform. If you got an error and are running a supported NodeJS version, be sure to Raise an issue. Now that you have a working installation: * Start your web application locally and note down the port number its listening on * Run tmole , replacing with your applications port number. For example, if your application listens on port 8080, run tmole 8080. Here's what it should look like $ tmole 8080 http://evgtkh-ip-49-145-166-122.tunnelmole.net is forwarding to localhost:8080 https://evgtkh-ip-49-145-166-122.tunnelmole.net is forwarding to localhost:8080 Using Tunnelmole as a dependency in your code To use Tunnelmole as a dependency for your project you need Node 16.10 or later. Add the dependency Add Tunnelmole as a dependency with npm install --save tunnelmole Starting tunnelmole using code First import tunnelmole. Both ES and CommonJS modules are supported. Importing tunnelmole as an ES module import { tunnelmole } from 'tunnelmole'; Importing tunnelmole as a CommonJS module const tunnelmole = require('tunnelmole/cjs'); Once the module is imported you can start tunnelmole with the code below, changing port 3000 to the port your application listens on if it is different. const url = await tunnelmole({ port: 3000 }); // url = https://idsq6j-ip-157-211-195-169.tunnelmole.net Tunnelmole will start in the background and you'll see output in the console log similar to the Tunnelmole command line application which will include the public URLs that now point to your application. The function is async and won't block execution of the rest of your code. If you want to use a custom subdomain, you could also pass the domain as an option. const url = await tunnelmole({ port: 3000, domain: '' }); // url = mydomain.tunnelmole.net Again if you are using the hosted service (which is the default) and you want to use a custom subdomain you'll need to purchase a subscription Learn More. Otherwise, you can self host. To learn more about this option go to the Tunnelmole Service GitHub repo. To Sum Up Tunnelmole is a powerful new tool in the toolbox of every node developer. It supercharges your node productivity by exposing your localhost to the external network in a secure, convenient and easy-to-implement manner. Written and maintained by open-source enthusiasts, it's an excellent alternative to ngrok. If you're on a quest for a simple to use, open-source and highly effective way to expose your localhost, you might find that your search ends at Tunnelmole. Give it a try and see first-hand how it can benefit you in your development workflow. With Tunnelmole, get ready to embark on a more productive, more efficient journey in software development. Happy Coding! [hacker-new] Categories All Articles Latest Articles Popular Articles JavaScript TypeScript Best Practice Productivity Follow Twitter Contact us Send a Message Copyright (c) 2022, Robbie Cahill; All rights reserved. Terms of use | Privacy Policy