Skip to content
cloudflared-project

Command Reference

These flags are available on every command.

FlagShortDefaultDescription
--project-pProject name (resolved from ~/.cloudflared/projects/)
--env-edevTarget environment (dev, staging, prod)
--project-dirExplicit project directory path (overrides --project)
--verbose-vfalseEnable verbose output
--cloudflared-pathauto-detectExplicit path to cloudflared binary

Environment variable overrides (prefix CLOUDFLARED_PROJECT_):

Terminal window
CLOUDFLARED_PROJECT_ENV=prod
CLOUDFLARED_PROJECT_VERBOSE=true
CLOUDFLARED_PROJECT_CLOUDFLARED_PATH=/usr/local/bin/cloudflared

Initialize a new cloudflared project.

Terminal window
cloudflared-project init <name> [flags]

Creates a project directory at ~/.cloudflared/projects/<name>/ (or in the current directory with --local) with a project.yaml and a default dev environment configuration.

Arguments

ArgumentDescription
<name>Project name (required)

Flags

FlagDefaultDescription
--domainPre-populate ingress rules with this hostname
--tunnel-name<name>-<env>Override the generated tunnel name
--forcefalseOverwrite an existing project
--localfalseCreate in .cloudflared-project/ in the current directory instead of ~/.cloudflared/projects/

Examples

Terminal window
# Basic initialization
cloudflared-project init myapp
# With domain and custom tunnel name
cloudflared-project init myapp --domain app.example.com --tunnel-name my-tunnel
# Local project (useful for monorepos)
cloudflared-project init myapp --local
# Overwrite existing
cloudflared-project init myapp --force

Authenticate with Cloudflare.

Terminal window
cloudflared-project login

Opens a browser window to authorize cloudflared access to your Cloudflare account. Saves a certificate to ~/.cloudflared/cert.pem. This is a thin wrapper around cloudflared tunnel login.

No additional flags beyond global flags.


Manage cloudflared tunnels. Requires --project / -p.

Terminal window
cloudflared-project -p <project> tunnel create <name>

Creates a new Cloudflare Tunnel and stores credentials in the project’s environment directory.

Terminal window
cloudflared-project -p <project> tunnel list

Lists all tunnels associated with your Cloudflare account.

Terminal window
cloudflared-project -p <project> tunnel delete <name>

Deletes a tunnel. The tunnel must not be running.

Terminal window
cloudflared-project -p <project> tunnel info <name>

Shows detailed information about a tunnel, including its ID, creation date, and connector status.


Manage tunnel configuration for a project environment. Requires --project / -p.

Terminal window
cloudflared-project -p <project> [-e <env>] config show

Prints the resolved tunnel configuration for the specified environment as YAML.

Terminal window
cloudflared-project -p <project> [-e <env>] config set <key> <value>

Sets a top-level configuration value. Supported keys: tunnel, credentials-file, warp-routing.

Terminal window
cloudflared-project -p <project> [-e <env>] config add-ingress --hostname <hostname> --service <service> [--path <path>]

Appends an ingress rule. The rule is inserted before the catch-all entry.

Flags

FlagRequiredDescription
--hostnameNoHostname to match (e.g., api.example.com)
--serviceYesBackend service URL (e.g., http://localhost:8080)
--pathNoURL path prefix to match (e.g., /api)
Terminal window
# Route a hostname to a local service
cloudflared-project -p myapp config add-ingress --hostname api.example.com --service http://localhost:8080
# Route with a path prefix
cloudflared-project -p myapp config add-ingress --hostname app.example.com --service http://localhost:3001 --path /api
Terminal window
cloudflared-project -p <project> [-e <env>] config remove-ingress <hostname>

Removes an ingress rule by hostname.

Terminal window
cloudflared-project -p <project> [-e <env>] config validate

Validates the tunnel configuration. Checks for:

  • Tunnel ID is set (valid UUID or name)
  • Credentials file path is configured
  • At least one ingress rule exists
  • Catch-all rule is present and last
  • Every ingress rule has a service field

Exit code 0 on success, non-zero on validation failure.


Validate configuration, optionally route DNS, and start the tunnel.

Terminal window
cloudflared-project -p <project> [-e <env>] deploy [flags]

Flags

FlagDefaultDescription
--detachfalseRun tunnel in the background. Logs are written to <project-dir>/logs/<env>.log
--route-dnsfalseCreate CNAME DNS records in Cloudflare for each ingress hostname before starting

Examples

Terminal window
# Foreground mode (development)
cloudflared-project -p myapp deploy
# Background mode
cloudflared-project -p myapp -e prod deploy --detach
# Full production deploy
cloudflared-project -p myapp -e prod deploy --detach --route-dns

Note: deploy always runs config validate before starting. If validation fails, the tunnel does not start.


Show the current status of a deployed tunnel.

Terminal window
cloudflared-project -p <project> [-e <env>] status [flags]

Displays:

  • Local process state (running / not running, PID)
  • Tunnel ID and credentials file path
  • Active ingress rules
  • Installed cloudflared version

Flags

FlagDefaultDescription
--watchfalseContinuously refresh status every 5 seconds

Examples

Terminal window
cloudflared-project -p myapp status
cloudflared-project -p myapp -e prod status --watch

Tail tunnel logs (only available for tunnels started with --detach).

Terminal window
cloudflared-project -p <project> [-e <env>] logs [flags]

Logs are stored at <project-dir>/logs/<env>.log.

Flags

FlagShortDefaultDescription
--follow-ffalseStream new log lines as they are written
--lines-n0Number of recent lines to display (defaults to last 20 when omitted)

Examples

Terminal window
# Show last 20 lines
cloudflared-project -p myapp logs
# Show last 50 lines
cloudflared-project -p myapp logs --lines 50
# Stream live logs
cloudflared-project -p myapp -e prod logs --follow

Print the cloudflared-project version.

Terminal window
cloudflared-project version