Cloudflare’s new cf CLI is a unified command-line tool that will eventually replace Wrangler, the current CLI for Cloudflare Workers and Pages. For existing Wrangler users, the key takeaway is that cf is designed to be a more comprehensive and future-proof interface, but it’s not a drop-in replacement yet — you’ll need to learn new commands and migrate your workflows gradually.
Background: Why a New CLI?
Wrangler has been the go-to CLI for Cloudflare Workers since 2019. Over time, Cloudflare expanded its platform to include Pages, Durable Objects, R2 storage, and AI features, and Wrangler grew organically with each addition. This led to a somewhat fragmented experience: some commands were specific to Workers, others to Pages, and the tool’s architecture made it harder to add new features quickly.
The cf CLI is Cloudflare’s answer to this. It’s built from the ground up to be a single, unified interface for all Cloudflare products — not just Workers and Pages, but also DNS, Zero Trust, and other services. Think of it as the next generation of Wrangler, with a cleaner design and better long-term maintainability.
How cf CLI Differs from Wrangler
The most obvious difference is the command name: wrangler becomes cf. But under the hood, there are several important changes:
- Unified commands: Instead of separate
wrangler pages deployandwrangler deploy,cfuses a singlecf deploycommand that works for both Workers and Pages. - New configuration format:
cfuses a newcf.jsonconfiguration file instead ofwrangler.toml. This is a breaking change — you’ll need to convert your existing configuration. - More granular permissions:
cfsupports OAuth tokens and API keys with more fine-grained scopes, giving you better control over what the CLI can access. - Improved output: The new CLI provides more structured output (JSON by default) and better error messages, making it easier to script and debug.
- Plugin system:
cfis designed to be extensible, so you can add custom commands or integrate with other tools.
How to Migrate from Wrangler
Migration isn’t automatic — you’ll need to manually update your workflows. Here’s a step-by-step approach:
- Install
cf: It’s available via npm (npm install -g @cloudflare/cf) or as a standalone binary. - Authenticate: Run
cf loginto authorize the CLI with your Cloudflare account. You can also usecf auth loginfor OAuth. - Convert your configuration: Use
cf initto generate a newcf.jsonfile, then manually copy over settings from yourwrangler.toml. Pay attention to differences in field names (e.g.,namebecomesnamein the top-level, butcompatibility_datestays the same). - Update your scripts: Replace any
wranglercommands in your CI/CD pipelines with the equivalentcfcommands. For example,wrangler publishbecomescf deploy. - Test thoroughly: Run your deployments in a staging environment first to catch any issues with the new configuration format.
Cloudflare provides a migration guide in their documentation, but it’s not fully automated — you’ll likely need to manually adjust some settings, especially if you use advanced features like bindings or custom build steps.
Which Should You Use Now?
For most users, the answer is: stick with Wrangler for now, but start learning cf for new projects. Here’s why:
- Wrangler is still fully supported and will receive bug fixes for the foreseeable future.
cfis in beta and may have missing features or bugs.- If you’re starting a new project, using
cffrom the beginning avoids a migration later. - If you have existing projects, migrating them now might be premature — wait until
cfreaches stable status and the migration tools improve.
That said, if you’re heavily invested in Cloudflare’s broader ecosystem (e.g., Zero Trust, R2), cf might be worth adopting early because it offers a single interface for all services.
Common Migration Pitfalls
When moving from Wrangler to cf, users often encounter these issues:
- Missing environment variables:
cfhandles environment variables differently — they’re defined incf.jsonunder thevarskey, and you must specify which environments they apply to. - Bindings syntax: KV namespaces, R2 buckets, and Durable Objects are declared differently. For example,
kv_namespacesin Wrangler becomesbindingsincf. - Scripts and assets: The way
cfhandles static assets (like those in Pages) has changed — you may need to adjust your build commands. - Custom domains: If you use custom domains, the configuration for routes might be slightly different.
Always check the output of cf deploy for warnings — they often point out missing or misconfigured fields.
Cost and Support Considerations
The cf CLI itself is free and open-source, just like Wrangler. There are no additional costs for using it — you only pay for the Cloudflare services you use (e.g., Workers requests, R2 storage). However, there are some practical considerations:
- Support: Wrangler is stable and well-documented;
cfis beta, so you may encounter bugs that aren’t yet fixed. - Community resources: Most tutorials and blog posts still reference Wrangler commands, so you’ll need to translate them.
- Security: Both CLIs require an API token or OAuth. For
cf, you can create scoped tokens with limited permissions, which is a security improvement.
If you’re a heavy user of Wrangler, consider keeping it installed alongside cf during the transition period — you can use both on the same project, though you’ll need to maintain two configuration files.
Alternatives to cf CLI
Besides Wrangler and cf, there are other ways to manage Cloudflare resources:
- Cloudflare Dashboard: The web UI is fine for one-off tasks, but it’s not suitable for automation.
- Cloudflare API: You can use
curlor any HTTP client to interact with the REST API directly. This gives you full control but requires more effort. - Terraform: If you use Infrastructure-as-Code, the Cloudflare Terraform provider is a robust option, especially for managing multiple resources.
For most developers, cf will become the standard, but it’s good to know these alternatives exist if you need them.
Frequently Asked Questions
Will my existing Wrangler projects stop working?
No. Wrangler will continue to work for the foreseeable future. Cloudflare has committed to maintaining it, and you can keep using it without any issues. The cf CLI is an addition, not a replacement that will break things overnight.
Can I use both Wrangler and cf on the same project?
Technically yes, but you’ll need to maintain two configuration files (wrangler.toml and cf.json). This can lead to drift and confusion. It’s better to pick one and stick with it, at least until you fully migrate.
Is cf CLI ready for production use?
It’s in beta, so it’s not recommended for critical production pipelines yet. However, many developers are using it for side projects and testing. Wait for the stable release before making it your primary tool.
How do I install cf CLI?
You can install it via npm: npm install -g @cloudflare/cf. Alternatively, you can download a pre-built binary from the official GitHub releases page. Make sure you have Node.js 18 or later.
Does cf CLI support all Wrangler features?
Not yet. Some advanced features, like wrangler tail for live logs, have been reimplemented, but others may be missing. Check the official documentation for a feature comparison table.
What happens to wrangler.toml when I switch to cf?
You’ll need to create a new cf.json file. The old wrangler.toml won’t be read by cf. You can keep it for reference, but it won’t be used unless you switch back to Wrangler.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Mac Start Up Automatically After Power Failure?
- Expose Self-Hosted Service Securely Without Cloudflare Tunnel
- Nano Delivery for Functional Foods: What It Can and Can’t Do4.00
- Disable Apple Watch Turn-by-Turn Vibration While Driving
- Convert Play FLAC in iTunes: Full Guide
- Soda Foundation Charter: What It Means