New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details โ†’ โ†’
Socket
Book a DemoSign in
Socket

envcf

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

envcf

๐Ÿš€ Beautiful CLI tool to push environment variables to Cloudflare Pages/Workers

latest
Source
npmnpm
Version
1.1.9
Version published
Maintainers
1
Created
Source

๐ŸŒฅ๏ธ EnvCF

Beautiful CLI tool to push environment variables to Cloudflare Pages/Workers

npm version License: MIT

EnvCF is a modern, user-friendly CLI tool that makes it super easy to sync your environment variables from .env files to Cloudflare Pages or Workers. No more manual copying and pasting!

โœจ Features

  • ๐Ÿ” Auto-discovery - Automatically finds your wrangler.toml or wrangler.jsonc configuration
  • ๐Ÿ“ Multiple file support - Handle .env, .env.local, .env.production, etc.
  • ๐ŸŽฏ Environment targeting - Deploy to production or preview environments
  • ๐ŸŽจ Beautiful interface - Interactive prompts with colors and emojis
  • ๐Ÿ”’ Type-safe - Built with TypeScript for reliability
  • ๐Ÿƒโ€โ™‚๏ธ Dry run mode - Preview changes before applying them
  • โšก Fast & lightweight - Minimal dependencies, maximum performance
  • ๐ŸŒฉ๏ธ Multi-account support - Seamlessly integrates with cfman for managing multiple Cloudflare accounts

๐Ÿš€ Installation

npm install -g envcf
# or
pnpm add -g envcf
# or
yarn global add envcf

Use without installing

npx envcf

๐Ÿ“– Usage

Basic Usage

Navigate to your project directory and run:

envcf

The CLI will guide you through:

  • ๐Ÿ” Finding your wrangler config - Automatically detects wrangler.toml or wrangler.jsonc
  • ๐ŸŽฏ Choosing environment - Select between production and preview
  • ๐Ÿ“ Selecting env files - Pick which .env files to use
  • โœ… Confirmation - Review variables before pushing
  • ๐Ÿš€ Deployment - Push variables to Cloudflare

Advanced Options

# Dry run - see what would happen without making changes
envcf --dry-run

# Use custom env file
envcf --file .env.custom

# Use custom wrangler config
envcf --config wrangler.custom.toml

# Show help
envcf --help

Multi-Account Management

EnvCF integrates seamlessly with cfman for managing multiple Cloudflare accounts:

# First, set up your accounts with cfman
npx cfman token add --name production --token cf_your_production_token
npx cfman token add --name staging --token cf_your_staging_token

# Then use envcf with specific accounts
envcf --account production     # Deploy to production account
envcf --account staging        # Deploy to staging account

# You can combine with other options
envcf --account production --dry-run --file .env.prod

Benefits of cfman integration:

  • ๐Ÿ” Secure token management - Store multiple API tokens safely
  • ๐Ÿš€ One-command deployment - No manual token switching
  • ๐Ÿ›ก๏ธ Isolated accounts - Each account's tokens are kept separate
  • ๐ŸŽฏ Environment specific - Perfect for agencies or multi-client setups

๐Ÿ—๏ธ Prerequisites

  • Wrangler CLI installed and authenticated:

    npm install -g wrangler
    wrangler login
    
  • Optional: cfman for multi-account management:

    npm install -g cfman
    cfman token add --name production --token your_token
    
  • Project structure with either:

    • wrangler.toml file
    • wrangler.jsonc file
  • Environment files like:

    • .env
    • .env.local
    • .env.production
    • .env.preview

๐Ÿ“ Example Workflow

$ envcf

๐ŸŒฅ๏ธ  EnvCF - Environment Variables to Cloudflare

๐Ÿ” Looking for wrangler configuration...
โœ… Found config: wrangler.toml
๐Ÿ“ฆ Project: my-awesome-app

? Which environment do you want to deploy to? 
โฏ ๐Ÿš€ Production
  ๐Ÿงช Preview

๐Ÿ” Looking for environment files...
? Which environment files do you want to use? 
โฏ โ˜‘ ๐Ÿ“„ .env
  โ˜‘ ๐Ÿ“„ .env.local
  โ˜ ๐Ÿ“ All files

๐Ÿ“ Parsing environment variables...
โœ… Found 12 environment variables

๐Ÿ“‹ Environment variables to be pushed:
  โ€ข DATABASE_URL (from .env)
  โ€ข API_KEY (from .env)
  โ€ข SECRET_TOKEN (from .env.local)
  ...

? Push these 12 variables to production? Yes

๐Ÿš€ Pushing to Cloudflare...
๐Ÿ”‘ Authenticated with Cloudflare
  โœ… DATABASE_URL
  โœ… API_KEY
  โœ… SECRET_TOKEN
  ...

๐Ÿ“Š Results:
  โœ… Success: 12

โœจ All environment variables pushed successfully!

๐Ÿ”ง Configuration

Wrangler Configuration

EnvCF works with standard Wrangler configuration files:

wrangler.toml:

name = "my-app"
compatibility_date = "2023-12-01"

[env.preview]
# Preview environment config

[env.production]
# Production environment config

wrangler.jsonc:

{
  "name": "my-app",
  "compatibility_date": "2023-12-01",
  "env": {
    "preview": {},
    "production": {}
  }
}

Environment Files

Standard .env file format:

# Database
DATABASE_URL=postgresql://localhost:5432/mydb
DATABASE_POOL_SIZE=10

# API Keys
STRIPE_SECRET_KEY=sk_test_...
SENDGRID_API_KEY=SG....

# Feature Flags
ENABLE_ANALYTICS=true
DEBUG_MODE=false

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

MIT ยฉ Shayan Moradi

๐Ÿ™ Acknowledgments

  • Built with โค๏ธ using TypeScript
  • Powered by Wrangler
  • Made beautiful with Chalk and Inquirer

Happy deploying! ๐Ÿš€

Keywords

cloudflare

FAQs

Package last updated on 27 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts