Manage environment variables with confidence
$ npm install -g env-mage
$ env-mage init
✓ Created .env.example from .env
✓ Added required variable annotations
$ env-mage validate
✓ All required variables present
✓ All variables match expected format
$ env-mage typegen
✓ TypeScript definitions generated at src/env.d.ts
$ env-mage json
✓ JSON structure generated at .env.json
$ env-mage scan
✓ Found 12 environment variables in codebase
✓ All used variables are defined in .env
Why choose EnvMage?
Intuitive CLI
Simple, powerful command-line interface that integrates seamlessly with your development workflow.
Template Management
Create and manage .env.example templates with required and optional variable annotations.
TypeScript Integration
Generate TypeScript definitions for your environment variables with full type safety.
Variable Validation
Validate your environment variables against templates to ensure all required values are present and correctly formatted.
Sync Management
Keep your .env files in sync with your templates across different environments and development stages.
Variable Scanning
Scan your codebase to identify all used environment variables and verify they're properly defined.
JSON Export
Convert your .env files to JSON format with optional value preservation for easier integration with frontend apps.
Perfect For Every Project
API Keys
Secure external services
Databases
Connection strings
Authentication
Auth credentials
Endpoints
Service URLs
Integrations
Third-party services
Features
Feature flags
Cache
Cache settings
Logging
Log levels
Files
Storage paths
Runtime
Runtime configs
Works With Your Tools
Version Control
Works seamlessly with Git workflows, ensuring .env files are properly gitignored while templates are tracked.
CI/CD Pipeline
Validate environment variables in your CI/CD workflow to catch missing or invalid configurations early.
Popular Frameworks
Integrates with Next.js, Express, NestJS, and other popular Node.js frameworks and toolchains.