@kushal124/env-manager
v1.0.0
Published
A simple environment variable manager with CLI and web interface
Maintainers
Readme
Environment Variable Manager 🔧
A powerful, secure, and user-friendly environment variable manager with CLI and web interface. Perfect for developers juggling multiple projects, API keys, and configuration environments.
✨ Features
🔐 Security First
- Encryption Support: Encrypt sensitive variables with individual passwords or master password
- Smart Masking: Automatically masks sensitive values (API keys, tokens, passwords)
- Secure Storage: Variables stored locally with optional encryption
- Password Validation: Strong password requirements for encrypted variables
📁 Profile Management
- Multiple Profiles: Organize variables by project, environment, or client
- Easy Switching: Quick profile switching with context awareness
- Session Tracking: Load/unload variables in current shell session
- Profile Metadata: Add descriptions and track creation dates
🔄 Import/Export System
- Multiple Formats: JSON, dotenv, shell exports, key-value pairs, YAML
- Auto-Detection: Smart format detection for seamless imports
- Bulk Operations: Import hundreds of variables at once
- Merge Support: Combine with existing variables or replace entirely
⏰ Advanced Features
- Variable Expiration: Set TTL for temporary tokens and credentials
- Cleanup Tools: Automatically remove expired variables
- Shell Integration: Native support for bash, zsh, and fish
- Web Interface: Modern, responsive web UI for visual management
- Session Management: Track loaded variables across shell sessions
🌐 Multi-Interface
- CLI: Full-featured command-line interface
- Web UI: Clean, intuitive web interface at
http://localhost:3000 - REST API: Complete API for integration with other tools
🚀 Quick Start
Installation
Option 1: NPM (Recommended)
npm install -g @kushal124/env-managerOption 2: Quick Install Script
curl -fsSL https://raw.githubusercontent.com/kushal124/envman/main/install.sh | bashOption 3: Manual Installation
git clone https://github.com/kushal124/envman.git
cd env-manager
npm install && npm install -g .First Run Setup
envman setupThe setup wizard will guide you through:
- Choosing storage location (
~/.env-manager/recommended) - Setting up your first profile
- Optional master password configuration
📖 Usage Guide
Basic Operations
# Add variables to current profile
envman add OPENAI_API_KEY "sk-..." --encrypt
envman add DATABASE_URL "postgresql://localhost:5432/db"
# List all variables with smart masking
envman list
# Get a specific variable
envman get OPENAI_API_KEY --decrypt
# Remove variables
envman remove DATABASE_URLProfile Management
# Create profiles for different projects
envman profile create azure -d "Azure development environment"
envman profile create openai -d "OpenAI/ChatGPT projects"
# Switch between profiles
envman profile switch azure
# List all profiles with active indicator
envman profile list
● azure - Azure development environment
○ openai - OpenAI/ChatGPT projects
○ default - Default profile
# View current profile status
envman profile currentAdvanced Variable Management
# Add encrypted variables with individual passwords
envman add STRIPE_SECRET_KEY "sk_test_..." --encrypt
# Add variables with expiration
envman add TEMP_TOKEN "temp_value" --expires 2h
# List variables showing encryption and expiration status
envman list
🔐 STRIPE_SECRET_KEY=[ENCRYPTED]
⏰ TEMP_TOKEN=temp_value (expires in 118m)Master Password System
# Set up master password for bulk encryption
envman master set
# Encrypt all current profile variables with master password
envman master encrypt-all
# Decrypt all master-encrypted variables
envman master decrypt-all
# Change master password (re-encrypts all variables)
envman master changeImport/Export System
# Import from various formats (auto-detected)
echo 'export API_KEY="value"' | envman import
cat .env | envman import -f dotenv
curl -s https://api.example.com/config.json | envman import -f json
# Import to specific profile with merge
envman import -p production -m < production.env
# Preview imports without saving
echo '{"api": {"key": "value"}}' | envman import --dry-run
# Export for shell loading
eval "$(envman export)"
eval "$(envman export -p azure -s fish)"Session Management
# Load profile variables into current session
envman load azure
# Check what's currently loaded
envman status
Active profile: azure
Session ID: sess_abc123
Loaded profiles: azure, openai
Loaded variables (5):
AZURE_CLIENT_ID (from azure)
AZURE_CLIENT_SECRET (from azure)
OPENAI_API_KEY (from openai)
# Unload specific profile or all variables
envman unload azure
envman unloadWeb Interface
# Start web interface
envman web
# Custom port
envman web -p 8080Features in Web UI:
- 📊 Dashboard: Overview of all profiles and variables
- 🔧 Variable Management: Add, edit, delete with real-time validation
- 📁 Profile Management: Create, switch, delete profiles
- 📥 Import Interface: Drag-and-drop or paste variables
- 🔐 Encryption Controls: Encrypt/decrypt individual variables
- 📤 Export Tools: Generate shell commands for any profile
🎯 Real-World Examples
Development Workflow Setup
Multi-Cloud Development
# AWS Profile
envman profile create aws -d "AWS development resources"
envman profile switch aws
envman add AWS_ACCESS_KEY_ID "AKIA..."
envman add AWS_SECRET_ACCESS_KEY "..." --encrypt
envman add AWS_DEFAULT_REGION "us-west-2"
# Azure Profile
envman profile create azure -d "Azure development resources"
envman profile switch azure
envman add AZURE_CLIENT_ID "..."
envman add AZURE_CLIENT_SECRET "..." --encrypt
envman add AZURE_TENANT_ID "..."
# Quick switching between clouds
alias awsenv="envman profile switch aws && eval \"\$(envman export)\""
alias azureenv="envman profile switch azure && eval \"\$(envman export)\""API Integration Projects
# OpenAI Project
envman profile create openai-project
envman add OPENAI_API_KEY "sk-..." --encrypt
envman add OPENAI_ORG_ID "org-..."
envman add MODEL_NAME "gpt-4"
# Stripe Integration
envman profile create stripe-integration
envman add STRIPE_PUBLIC_KEY "pk_test_..."
envman add STRIPE_SECRET_KEY "sk_test_..." --encrypt
envman add STRIPE_WEBHOOK_SECRET "whsec_..." --encryptEnvironment-Specific Configurations
# Development Environment
envman profile create development
envman add NODE_ENV "development"
envman add DEBUG "true"
envman add LOG_LEVEL "debug"
# Staging Environment
envman profile create staging
envman add NODE_ENV "staging"
envman add API_BASE_URL "https://api-staging.example.com"
envman add RATE_LIMIT "1000"
# Production Environment (with expiring tokens)
envman profile create production
envman add NODE_ENV "production"
envman add DEPLOY_TOKEN "temp_token" --expires 1h --encryptTeam Collaboration
Sharing Configuration Templates
# Export configuration template (values masked)
envman export > project-template.sh
# Team member imports and customizes
envman import < project-template.sh
envman add PERSONAL_API_KEY "their-key" --encryptEnvironment Synchronization
# Export non-sensitive configuration
envman export --skip-encrypted > shared-config.sh
# Import shared config and add personal secrets
source shared-config.sh
envman add PERSONAL_DB_PASSWORD "secret" --encrypt🛠️ Shell Integration
Bash/Zsh Setup
Add to your .bashrc or .zshrc:
# Environment Manager Aliases
alias envload="eval \"\$(envman export)\""
alias envstatus="envman status"
# Project-specific aliases
alias devenv="envman profile switch development && envload"
alias prodenv="envman profile switch production && envload"
alias stageenv="envman profile switch staging && envload"
# Quick profile switching function
switchenv() {
envman profile switch "$1" && envload
echo "Switched to $1 environment"
}Fish Shell Setup
Add to your ~/.config/fish/config.fish:
# Environment Manager Functions
function envload
eval (envman export -s fish)
end
function switchenv
envman profile switch $argv[1]
envload
echo "Switched to $argv[1] environment"
end
# Aliases
alias envstatus="envman status"
alias devenv="switchenv development"
alias prodenv="switchenv production"🏗️ File Structure
~/.env-manager/
├── profiles/ # Profile-specific variable storage
│ ├── default.json # Default profile variables
│ ├── aws.json # AWS profile variables
│ ├── azure.json # Azure profile variables
│ └── openai.json # OpenAI profile variables
├── profile-meta.json # Profile metadata and descriptions
├── session.json # Current session state and loaded variables
├── master-password.json # Master password hash and metadata
└── settings.json # Global settings and configuration🔐 Security Features
Encryption Options
- Individual Encryption: Each variable can have its own password
- Master Password: Bulk encrypt/decrypt entire profiles
- Smart Masking: Automatically masks sensitive variables in output
- Secure Storage: All encrypted data uses AES-256-GCM encryption
Security Best Practices
- Variables stored locally (never transmitted)
- Strong password validation for encrypted variables
- Automatic masking of API keys, tokens, and passwords
- Optional master password for additional security layer
- Secure key derivation using PBKDF2 with 100,000 iterations
📡 API Reference
The web interface exposes a REST API for integration:
Variables API
GET /api/variables- List all variablesPOST /api/variables- Create variablePUT /api/variables/:key- Update variableDELETE /api/variables/:key- Delete variablePOST /api/variables/:key/encrypt- Encrypt variablePOST /api/variables/:key/decrypt- Decrypt variable
Profiles API
GET /api/profiles- List profilesPOST /api/profiles- Create profilePOST /api/profiles/:name/switch- Switch profileDELETE /api/profiles/:name- Delete profile
Master Password API
GET /api/master/status- Check master password statusPOST /api/master/set- Set master passwordPOST /api/master/change- Change master passwordPOST /api/master/encrypt-all- Bulk encrypt with master password
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
git clone https://github.com/kushal124/envman.git
cd env-manager
npm install
npm run devRunning Tests
npm test
npm run test:coverage📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙋♂️ Support
- 📧 Email: [email protected]
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📚 Documentation: Full Documentation
🎉 Acknowledgments
- Built with ♥️ by Kushal Khandelwal
- Inspired by the need for better developer environment management
- Thanks to all contributors and users for feedback and improvements
Made with ❤️ for developers who manage multiple environments and API keys
Star ⭐ this repository if you find it helpful!
