@aalexis.dev/cfx
v1.0.2
Published
Ultra-lightweight multi-account Cloudflare Wrangler wrapper CLI with encrypted local storage
Downloads
48
Maintainers
Readme
⚡ cfx (@aalexis.dev/cfx)
Ultra-lightweight, secure CLI wrapper for managing multiple Cloudflare accounts with Wrangler.
🔒 Encrypted local storage with
AES-256-GCM| ⚡ 0 runtime dependencies | 🌐 Cross-platform (Windows, macOS, Linux).
🚀 Features
- Multi-Account Switching: Switch between Cloudflare accounts instantly using
--acc=<name>or-a <name>. - Batch Execution: Run commands sequentially across all registered accounts with
--all. - Transparent Wrangler Proxy: Forwards all arguments, flags, and real-time outputs (
stdio: inherit) directly to thewranglerbinary. - Zero Runtime Dependencies: Built exclusively on Node.js native modules (
node:crypto,node:child_process,node:readline,node:fs,node:os). - Cryptographic Security: Credentials (
accountIdandapiToken) are encrypted locally withAES-256-GCMusing a 256-bit master key with strict permissions (0600/0700). - Cross-Platform: Works seamlessly across Windows (CMD, PowerShell, Windows Terminal), macOS, and Linux.
🛠️ Global Installation (Recommended)
Install globally once to use the clean and short cfx command anywhere in your terminal:
# With pnpm
pnpm add -g @aalexis.dev/cfx
# With npm
npm install -g @aalexis.dev/cfxOnce installed globally, you can simply run:
cfx --add
cfx --list
cfx --acc=production deploy📦 Direct Execution (Without Installation)
You can also run @aalexis.dev/cfx directly using your preferred package manager:
# With pnpm dlx
pnpm dlx @aalexis.dev/cfx --add
pnpm dlx @aalexis.dev/cfx --list
pnpm dlx @aalexis.dev/cfx --acc=production deploy
# With npx
npx @aalexis.dev/cfx --acc=staging tail📖 Command Reference
1. Register an Account (--add)
Starts an interactive prompt to enter the account identifier name, Cloudflare Account ID, and Cloudflare API Token (the token input is securely masked in the terminal):
cfx --add
# or
cfx add2. List Registered Accounts (--list)
Displays a formatted list of all configured accounts:
cfx --list
# or
cfx list
# or
cfx ls3. Remove an Account (--remove)
Deletes an account from your local encrypted storage:
cfx --remove <name>
# or
cfx rm <name>4. Run Wrangler on a Specific Account (--acc or -a)
Decrypts credentials in memory, injects CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN, and invokes wrangler:
# Deploy a Worker
cfx --acc=production deploy
# Stream real-time logs
cfx -a staging tail
# Inspect current authenticated user and permissions
cfx --acc=client1 whoami
# Generate Cloudflare Worker / D1 / KV types
cfx --acc=prod types5. Run Across All Accounts (--all)
Sequentially executes the specified command on every registered account and presents a summary table:
cfx --all deploy
cfx --all whoami🔐 Security & Storage
- Storage Location:
~/.cfx/accounts.json - Master Encryption Key:
~/.cfx/.key(generated locally withcrypto.randomBytes(32)and protected with0600permissions on Unix systems). - Algorithm:
AES-256-GCMwith a unique 16-byte initialization vector (iv) and 16-byte authentication tag (authTag) per encrypted value. - Credentials are never transmitted over the network or stored in plain text.
💻 Local Development & Publishing
1. Clone and Install Dev Dependencies
git clone https://github.com/your-username/cfx.git
cd cfx
pnpm install2. Build the Project (TypeScript)
pnpm build3. Run Automated Tests
pnpm test4. Link Locally for Testing
pnpm link --globalYou can now test the cfx command directly from any terminal window.
5. Publish to the NPM Registry
# 1. Log in to your npm account (if not already authenticated)
pnpm login
# 2. Publish package with public access
pnpm publish --access public📄 License
MIT © 2026
