Cloudflare Wrangler
Wrangler is the CLI for Cloudflare Workers, Pages, R2, D1, and other Cloudflare developer platform services.
Install
npm install -g wrangler
Or via the prerequisites script:
just prereqs
Authenticate
Log in to your Cloudflare account (opens a browser):
just cf-login
# or: wrangler login
Verify your auth:
just cf-whoami
# or: wrangler whoami
This stores an OAuth token at ~/.wrangler/config/default.toml. The token is per-machine and not committed to the repo.
API Token (CI/CD)
For non-interactive environments, create an API token in the Cloudflare dashboard:
- Go to My Profile > API Tokens > Create Token
- Use the Edit Cloudflare Workers template (or customize permissions)
- Set the token as an environment variable:
export CLOUDFLARE_API_TOKEN="your-token-here"
Wrangler picks up CLOUDFLARE_API_TOKEN automatically — no wrangler login needed.
Common Commands
# Deploy a Worker
wrangler deploy
# Start local dev server
wrangler dev
# List recent deployments
wrangler deployments list
# Tail Worker logs
wrangler tail <worker-name>