Turn localhost into production URLs with one command.
Cloudflare Tunnels are free, unlimited, and enterprise-grade but the manual setup (YAML editing, DNS commands for each subdomain and manual cleanup) is so tedious that developers turn to paid alternatives just to avoid the friction.
Moley automates everything so you get all the Cloudflare benefits on your custom domain without the manual work.
# 1. Authenticate with Cloudflare
cloudflared tunnel login
# 2. Create tunnel manually
cloudflared tunnel create my-tunnel
# 3. Configure tunnel YAML file with ingress rules
vim ~/.cloudflared/config.yml
# (figure out tunnel ID, credentials path, hostnames, services, catch-all rule...)
# 4. Route DNS via CLI for each subdomain
cloudflared tunnel route dns my-tunnel api.example.com
cloudflared tunnel route dns my-tunnel app.example.com
# (repeat for every subdomain... wait for DNS propagation...)
# 5. Run tunnel
cloudflared tunnel run my-tunnel
# 6. Manually delete tunnel and DNS records from dashboard when done
# (or forget and accumulate zombie tunnels...)
moley tunnel run
That's it. Moley handles everything automatically:
- ✅ Authenticates with Cloudflare API
- ✅ Creates tunnels programmatically
- ✅ Generates config with ingress rules (no YAML editing)
- ✅ Creates DNS records for all subdomains (no CLI gymnastics)
- ✅ Runs tunnel in foreground or background (
--detach
) - ✅ Cleans up tunnels and DNS when stopping (no zombie tunnels)
One command. Multiple apps. Zero manual configuration.
brew install --cask stupside/tap/moley
go install github.com/stupside/moley@latest
Download the latest binary from the releases page.
-
Authentication
# Authenticate cloudflared with your account cloudflared tunnel login # Option 1: Set API token in config file moley config set --cloudflare.token="your-api-token" # Option 2: Use environment variable (recommended for CI/CD) export MOLEY_CLOUDFLARE_TOKEN="your-api-token"
-
Initialize your project
moley tunnel init
-
Configure your apps
# Option 1: Edit the generated moley.yml file # Option 2: Use environment variables (great for containers/CI) export MOLEY_TUNNEL_INGRESS_ZONE="yourdomain.com" export MOLEY_TUNNEL_INGRESS_APPS_0_TARGET_PORT="8080" export MOLEY_TUNNEL_INGRESS_APPS_0_EXPOSE_SUBDOMAIN="api"
-
Start tunneling
# Foreground mode moley tunnel run # Background mode moley tunnel run --detach # Or run with everything configured via environment variables MOLEY_CLOUDFLARE_TOKEN="token" MOLEY_TUNNEL_INGRESS_ZONE="yourdomain.com" moley tunnel run
Your app is now accessible at https://api.yourdomain.com
! 🎉
💡 Pro tip: Environment variables take precedence over config files and are perfect for CI/CD, Docker containers, and keeping secrets secure.
For complete documentation including configuration options, troubleshooting, and advanced usage, visit our documentation site.
- 📖 Installation Guide - Detailed installation instructions
- ⚡ Quick Start - Get up and running in minutes
- ⚙️ Configuration - Advanced configuration options
- 🔧 Troubleshooting - Common issues and solutions
- Go 1.23+
- Cloudflared installed
git clone https://github.com/stupside/moley.git
cd moley
go mod download
go build -o moley .
We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.
- Cloudflare for providing the tunnel infrastructure
- Cloudflared team for the tunnel client