dotenvy – VS Code Environment Manager

🚀 dotenvy makes it effortless to manage and switch between your .env files directly inside VS Code. No more manual renaming or copy-pasting—just pick your environment and start coding immediately!
📥 Install from VS Code Marketplace • 📖 Documentation • 🐛 Report Issues
✨ Features
🔄 Environment Switching
Effortlessly switch between .env.development, .env.staging, .env.production, or any custom .env.* file with a single click.
📂 Auto Detection & Sync
Automatically scans your workspace for .env files and syncs seamlessly across multi-workspace setups.
🌿 Git Branch Auto-Switching
Automatically switch environments based on Git branch changes (develop → .env.development, staging → .env.staging, etc.)
✅ Environment Validation
Validate .env files for syntax errors, required variables, and type checking with custom regex patterns.
📄 Diff View
Compare environment files side-by-side before switching to preview changes and avoid surprises.
🛡️ Git Commit Security
Prevent committing sensitive data with pre-commit hooks that scan for secrets, validation errors, and block .env files.
☁️ Cloud Sync Support
Bidirectional cloud sync with Doppler Secrets Manager for team-based environment variable management.
💾 Backup & Recovery
Automatic backup creation before switching, with configurable backup paths and encryption options.
📊 Status Bar Integration
Real-time environment indicator in status bar showing current configuration, validation status, and cloud sync state.
🔍 Secrets Guard 🧠
Advanced secret detection powered by custom Large Language Model (LLM) for superior accuracy in identifying potential sensitive data exposure. Features:
- AI-Powered Analysis: Custom transformer model trained specifically for secret patterns
- Confidence Scoring: High/Medium/Low confidence classification
- Real-time Scanning: Instant detection during file changes
- Learning Capability: Improves accuracy from user feedback
- Fallback Protection: Traditional entropy-based analysis when AI unavailable
📋 Commands
dotenvy provides a comprehensive set of commands to manage your environment files. All commands are accessible via the Command Palette (Ctrl+Shift+P / ⌘+Shift+P).
🔄 Environment Manager
Core commands for managing and switching between environment files:
dotenvy: Switch Environment - Switch between different .env files (development, staging, production, etc.)
dotenvy: Open Environment Panel - Open the interactive environment management panel
dotenvy: Validate Environment Files - Validate .env files for syntax errors and required variables
dotenvy: Diff Environment Files - Compare environment files side-by-side before switching
📊 Environment History
Track and manage environment file changes over time:
dotenvy: View Environment History - View historical changes to environment files with timestamps and git integration
🛡️ Git Integration
Secure your commits with pre-commit hooks:
dotenvy: Install Git Commit Hook - Install pre-commit hook to prevent committing secrets and validation errors
dotenvy: Remove Git Commit Hook - Remove the installed git commit hook
☁️ Cloud Sync
Bidirectional synchronization with cloud secret managers:
dotenvy: Pull Environment from Cloud - Pull environment variables from Doppler (or other cloud providers)
dotenvy: Push Environment to Cloud - Push local environment variables to Doppler
🔍 Security
Advanced security scanning for sensitive data:
dotenvy: Scan for Secrets - Scan workspace for potential secrets using AI-powered analysis
💬 Support
Get help and provide feedback:
dotenvy: Feedback & Support - Access feedback form and support resources
⌨️ Keyboard Shortcuts
To improve productivity, consider setting up keyboard shortcuts for frequently used commands:
- Open Keyboard Shortcuts (
Ctrl+K Ctrl+S / ⌘+K ⌘+S)
- Search for "dotenvy"
- Assign shortcuts to your most-used commands (e.g.,
Ctrl+Alt+E for Switch Environment)
🎮 List Commands Feature
For easy command discovery and execution, use dotenvy: List Commands which provides:
- Interactive Quick Pick Menu: Browse all commands organized by category
- Command Descriptions: Detailed explanations of what each command does
- Direct Execution: Click to run any command immediately
- Keyboard Shortcuts Setup: Built-in assistance for setting up shortcuts
📦 Installation
Quick Install
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X / ⌘+Shift+X)
- Search for "dotenvy"
- Click Install
Alternative Methods
Requirements
- VS Code 1.74.0 or later
- Node.js (for cloud sync features)
🏗️ Supported Environments
Default environment files are automatically detected:
.env.development
.env.staging
.env.production
.env.test
Custom environments can be configured in .dotenvy.json.
🚀 Usage
Place your environment files in your project root:
.env.development
.env.staging
.env.production
Open the Command Palette (Ctrl+Shift+P / ⌘+Shift+P).
Search for:
dotenvy: Switch Environment
Pick the environment you want to activate.
The selected file will be copied into .env automatically.
✅ The status bar will update to show the active environment.
⚙️ Configuration
You can add a config file to define custom environments, git branch auto-switching, and validation rules:
// .dotenvy.json
{
"environments": {
"local": ".env.local",
"qa": ".env.qa",
"prod": ".env.production"
},
"gitBranchMapping": {
"develop": "development",
"staging": "staging",
"master": "production",
"main": "production"
},
"autoSwitchOnBranchChange": true,
"validation": {
"requiredVariables": ["API_KEY", "DATABASE_URL"],
"variableTypes": {
"PORT": "number",
"DEBUG": "boolean",
"API_URL": "url"
},
"customValidators": {
"EMAIL": "^[^@]+@[^@]+\\.[^@]+$"
}
},
"gitCommitHook": {
"blockEnvFiles": true,
"blockSecrets": true,
"blockValidationErrors": true,
"customMessage": "Commit blocked due to security concerns"
}
}
☁️ Cloud Sync Setup
Doppler Integration
dotenvy supports bidirectional sync with Doppler for team-based environment variable management.
Setup Steps:
- Create Doppler Account and project at doppler.com
- Generate Service Token from Doppler dashboard
- Add to .dotenvy.json:
{
"cloudSync": {
"provider": "doppler",
"project": "your-project-name",
"config": "development",
"token": "dp.pt.your_token_here"
}
}
Available Commands:
- Pull from Cloud:
dotenvy: Pull Environment from Cloud
- Push to Cloud:
dotenvy: Push Environment to Cloud
Note: Doppler tokens are stored securely using VS Code secrets storage.
🗺️ Roadmap
[x] Auto-switch env based on Git branch
[x] Environment validation
[x] Diff view
[x] Multi-workspace support
[x] Git commit hook to block secrets
[x] Cloud sync with Doppler
[ ] Support for other cloud providers (Vault, AWS Secrets Manager)
[ ] Environment variable encryption at rest
[ ] Shareable environment templates
[ ] Integration with Docker environments
🤝 Contributing
PRs are welcome! If you have ideas for features, open an issue.
📜 License
MIT © 2025 Kareem Ehab
Development
This extension is built with TypeScript. To get started:
- Clone the repository
- Run
npm install
- Open in VS Code
- Press F5 to start debugging