DEV Community

Shayan
Shayan

Posted on

I Created CFMan, Cloudflare Wrangler Multi Account Manager

Hey folks 👋
So… I built a little thing called CFMan — short for Cloudflare Manager.

If you’ve ever juggled multiple Cloudflare accounts, workers, or pages, you know the pain.
Switching tokens manually, exporting env vars, praying Wrangler doesn’t mix accounts… 😩
Yeah, been there.

That’s why I made CFMan — a beautiful, colorful, emoji-filled CLI that makes it dead simple to manage multiple Cloudflare accounts and deploy Workers or Pages from one place.


🪄 What It Does

CFMan basically wraps around Wrangler, but smarter.

  • 🔐 Manages multiple API tokens — securely stored, encrypted, per-account
  • 🚀 Deploys Workers/Pages with a single clean command
  • Runs any Wrangler command but with --account flag
  • 🧠 Automatically uses npx wrangler if Wrangler isn’t installed globally
  • 🎨 Pretty CLI output (because yes, even your terminal deserves good design)

🖼️ Here’s What It Looks Like

That’s literally npx cfman --help.
It gives you colors, emojis, examples, and everything you actually need to remember how your tool works. 😅


🚀 Quick Start

# install globally (recommended)
npm install -g cfman

# or just try it
npx cfman --help
Enter fullscreen mode Exit fullscreen mode

Now add your first account:

cfman token add --name production --token cf_xxx
Enter fullscreen mode Exit fullscreen mode

Check what’s going on:

cfman status
Enter fullscreen mode Exit fullscreen mode

And deploy anything:

cfman wrangler --account production pages deploy out
Enter fullscreen mode Exit fullscreen mode

That’s it.
No more exporting tokens or switching profiles like a maniac.


💡 Before CFMan vs After CFMan

Before:

export CLOUDFLARE_API_TOKEN=cf_token_for_client_a
wrangler deploy --env production

export CLOUDFLARE_API_TOKEN=cf_token_for_client_b
wrangler pages deploy out
Enter fullscreen mode Exit fullscreen mode

After:

cfman wrangler --account client-a deploy --env production
cfman wrangler --account client-b pages deploy out
Enter fullscreen mode Exit fullscreen mode

That’s the whole magic.
You keep your sanity, your tokens are isolated, and your deployments stay clean.


🧰 Under the Hood

Built entirely in TypeScript, bundled with tsup, and designed to be fast, tiny, and safe.
CFMan stores your tokens locally under:

  • macOS/Linux → ~/.config/cfman/tokens.json
  • Windows → %APPDATA%/cfman/tokens.json

All with file permissions set to 600 (so only you can read/write them).

And starting v0.4.0 → CFMan supports Package Provenance, meaning you can cryptographically verify the npm package comes straight from GitHub source.
No shady npm nonsense. 🛡️


📦 Wrangler Integration

You can literally run any Wrangler command:

cfman wrangler --account prod d1 list
cfman wrangler --account staging pages project list
cfman wrangler --account demo kv namespace create test
Enter fullscreen mode Exit fullscreen mode

Even if Wrangler isn’t installed globally.
CFMan falls back to npx wrangler automatically.


⚙️ Setup Wizard

If you’re new, just run:

cfman setup
Enter fullscreen mode Exit fullscreen mode

It walks you through everything interactively — adding tokens, naming accounts, verifying access, etc.
Like a friendly little terminal assistant.


🧠 Why I Built It

Honestly, I got tired of exporting tokens, messing up deployments, and switching environments like some kind of Cloudflare juggler.
There had to be a clean, developer-friendly way to handle all accounts — and make it look nice while doing it.

So here we are.
CFMan. It’s open-source, MIT licensed, and you can grab it here:
👉 github.com/novincode/cfman


💬 Final Thoughts

If you work with Cloudflare Workers or Pages and have multiple accounts (clients, staging, production, whatever), this tool will literally save your life.

Give it a try:

npx cfman --help
Enter fullscreen mode Exit fullscreen mode

And if you like it, drop a ⭐ on the repo — it helps a ton 💜
Let’s make Cloudflare dev experience a little more magical ✨

Top comments (0)