Top 3 Free ngrock alternatives
1. LocalTunnel
LocalTunnel is a free and open-source tunneling solution that allows you to expose your local development server to the internet. It provides a simple command-line interface and supports custom subdomains, making it easy to share your work with others.
How to setup LocalTunnel
# 1. Install LocalTunnel globally
npm install -g localtunnel
# 2. Run LocalTunnel on specific port
lt --port 3000 # Generates a random subdomain for port 3000
# 3. Open tunnel url and insert password as per instructions
# 4. Confirm tunnel works by visiting `/api/health` endpoint
If you're using Vite, You may want to add the tunnel url to allowedHosts in your Vite configuration:
$development: {
vite: {
server: {
allowedHosts: ['nuxtstart.loca.lt'],
},
},
},
Most of the time, You want fix tunnel url so that you can whitelist it in third party services like Polar for webhooks. You can do that by using --subdomain flag:
# Exposes your app at myapp.loca.lt
lt --port 3000 --subdomain myapp
However, LocalTunnel may have some reliability issues and occasional downtime, so to ensure it's always up and running, you can use a process manager like PM2 to automatically restart the tunnel if it goes down or use a simple bash script to keep it alive.
# Run tunnel and restart if it goes down
while true; do lt --port 3010 --subdomain nuxtstart; sleep 1; done

