Thanks to visit codestin.com
Credit goes to pkg.go.dev

moley

command module
v2.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 3 Imported by: 0

README ΒΆ

Moley Logo

Latest Release Go Reference Homebrew License Build Status

Moley

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.

What Moley Does

Without Moley (manual cloudflared setup)
# 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...)
With Moley
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.

πŸ“¦ Installation

brew install --cask stupside/tap/moley
Go Install
go install github.com/stupside/moley@latest
Manual Download

Download the latest binary from the releases page.

πŸš€ Quick Start

  1. 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"
    
  2. Initialize your project

    moley tunnel init
    
  3. 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"
    
  4. 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.

πŸ“š Documentation

For complete documentation including configuration options, troubleshooting, and advanced usage, visit our documentation site.

πŸ› οΈ Development

Prerequisites
Building from Source
git clone https://github.com/stupside/moley.git
cd moley
go mod download
go build -o moley .
Contributing

We welcome contributions! Please see our Contributing Guide for details.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
cmd
internal
core/application/tunnel
Package tunnel provides tunnel orchestration functionality.
Package tunnel provides tunnel orchestration functionality.
core/domain
Package domain provides core domain models for Moley.
Package domain provides core domain models for Moley.
core/ports
Package ports declares provider-agnostic interfaces.
Package ports declares provider-agnostic interfaces.
platform/adapters/cloudflare
Package cloudflare provides Cloudflare-specific implementations.
Package cloudflare provides Cloudflare-specific implementations.
platform/framework
Package framework provides resource lifecycle management.
Package framework provides resource lifecycle management.
platform/infrastructure/logger
Package logger provides structured logging for Moley.
Package logger provides structured logging for Moley.
platform/infrastructure/paths
Package paths provides utilities for managing file system paths in Moley.
Package paths provides utilities for managing file system paths in Moley.
shared
Package shared provides common utilities used across Moley.
Package shared provides common utilities used across Moley.
version
Package version provides build-time version information.
Package version provides build-time version information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL