Skip to content
cloudflared-project

Quick Start

This tutorial walks you through creating and deploying a Cloudflare Tunnel for a local web application. By the end, traffic to app.example.com will be securely routed to your local service.

  • cloudflared-project is installed
  • cloudflared binary is installed and in your PATH
  • You have a Cloudflare account with a domain configured
Terminal window
cloudflared-project login

This opens your browser and prompts you to authorize cloudflared to access your Cloudflare account. A certificate is saved to ~/.cloudflared/cert.pem.

Expected output:

A browser window should open at the following URL:
https://dash.cloudflare.com/argotunnel?...
Waiting for login...
You have successfully logged in.

Note: If a browser does not open, copy the URL printed in the terminal and open it manually.

Terminal window
cloudflared-project init myapp --domain app.example.com

This creates a project directory at ~/.cloudflared/projects/myapp/ with a default dev environment configuration.

Expected output:

✓ Project "myapp" initialized
Location: ~/.cloudflared/projects/myapp
Default environment: dev
Domain: app.example.com

The --domain flag pre-populates your ingress rules with the given hostname pointing to http://localhost:8080 by default.

Terminal window
cloudflared-project -p myapp tunnel create myapp

This calls cloudflared tunnel create and stores the tunnel credentials in your project directory.

Expected output:

✓ Tunnel "myapp" created with ID: 550e8400-e29b-41d4-a716-446655440000
Credentials saved to: ~/.cloudflared/550e8400-e29b-41d4-a716-446655440000.json
Config updated: tunnel ID and credentials-file set for env "dev"

Tip: The -p myapp flag tells cloudflared-project which project to operate on. You can also use --project myapp.

Terminal window
cloudflared-project -p myapp config show

This prints the resolved tunnel configuration for the current environment (dev by default):

tunnel: 550e8400-e29b-41d4-a716-446655440000
credentials-file: ~/.cloudflared/550e8400-e29b-41d4-a716-446655440000.json
ingress:
- hostname: app.example.com
service: http://localhost:8080
- service: http_status:404

If you need to adjust the local service URL, use:

Terminal window
cloudflared-project -p myapp config add-ingress --hostname app.example.com --service http://localhost:3000
Terminal window
cloudflared-project -p myapp deploy --route-dns

The --route-dns flag automatically creates the CNAME record in your Cloudflare zone, pointing app.example.com to your tunnel. The tunnel then starts in the foreground.

Expected output:

✓ Configuration validated [dev]
✓ DNS routed: app.example.com
→ Starting tunnel [dev] (Ctrl+C to stop)...

Your application is now accessible at https://app.example.com.

To run the tunnel as a background process:

Terminal window
cloudflared-project -p myapp deploy --detach
# ✓ Tunnel started in background (PID: 12345) [dev]

Check status and logs:

Terminal window
cloudflared-project -p myapp status
cloudflared-project -p myapp logs --follow