Managed Environment Variables for Node.js projects.
Official Website // npm Package
Menv is a lightweight CLI designed to bring consistency, safety, and automation to environment variable management. It ensures that your development, production, and example environment files stay in sync while proactively protecting against accidental secret leaks.
- Automated .env.example Generation: Create and maintain example files that mirror your actual environment configuration without exposing sensitive values.
- Environment Synchronization: Detect and report inconsistencies between your local environment and documented templates.
- CI-Ready Validation: Validate that all required variables exist before deployment, preventing runtime crashes.
- Real-time Watcher: Automatically update your example files as you modify your local environment.
- Security Scanning: Detect potential secret leaks (AWS, Stripe, GitHub, etc.) within your environment files.
- Auto-Protection: Automatically ensures your environment files are added to .gitignore to prevent accidental commits.
npm install -g menv-npmBootstrap your project by discovering environment variables from the source code:
npx menv-npm generate --scan --commentThis scans your .ts, .js, .tsx, etc., for process.env references and creates a documented .env.example.
Keep your template in sync with your actual configuration:
npx menv-npm syncEnsure all required variables are present before deployment:
npx menv-npm check --format json| Command | Usage | Description |
|---|---|---|
generate |
npx menv-npm generate |
Creates .env.example from .env or source code (--scan) |
sync |
npx menv-npm sync |
Checks for template inconsistencies (exits 1 on discrepancies) |
check |
npx menv-npm check |
Validates that all variables in the example file exist locally |
watch |
npx menv-npm watch |
Monitors .env for changes and updates the example file in real-time |
doctor |
npx menv-npm doctor |
Scans all environment files (.env*) for potential secret leaks |
--scan: Discover variables from source files (supports JS, TS, React, etc.)--comment: (Used with--scan) Adds source location (file:line) as a comment above each key.--format json: Output results as structured JSON (perfect for CI/CD and scripts).--env <file>: Override the default environment file path.--template <file>: Specify a custom template/example file path.--dir <dir>: Restrict scanning to a specific directory (default: project root).
| Documentation | Description |
|---|---|
| Contributing | Learn how to get started with contributing |
| Code of Conduct | Our standards for a healthy community |
| Security | Procedures for reporting security issues |
| License | MIT Open Source License by TheDanielDallas.com |