๐ก๏ธ A command-line tool to validate .env files against a defined schema to ensure correct environment variable configurations.
npm install env-verifier-cli
A lightweight and powerful CLI tool to validate your .env files against a defined schema.
Very easy to configure with minimal setup.

Validate .env files for:
- โ Missing or invalid required keys
- โ ๏ธ Unused keys not defined in your schema
- ๐งช Type checking: string, number, boolean, array, JSON (object), Object, Date
- ๐งฉ Support for optional keys, allowing flexible configurations
- ๐ Works with multiple .env files (e.g., .env.production, .env.staging, .env.test) and supports type-specific validation for each
- ๐ ๏ธ Customizable schema for defining required and optional keys with specific types (string, number, boolean, array, JSON)
- ๐ Multi-environment support with easy-to-understand validation for complex configurations
Global:
``bash`
npm install -g env-verifier-cli
Local (as dev dependency):
`bash`
npm install --save-dev env-verifier-cli
`bash`
env-verifier --env .env --schema env.schema.json
Or
`bash`
env-verifier --env .env.staging --schema env.schema.json
Or for different folder paths
`bash`
env-verifier --env %USERPROFILE%\Downloads\.env --schema %USERPROFILE%\Downloads\env.schema.json --exit true
env-verifier --env $HOME/Downloads/.env --schema $HOME/Downloads/env.schema.json --exit 1
env-verifier --env ~/Downloads/.env --schema ~/Downloads/env.schema.json --exit false
`bash`
--env Path to the .env file to validate (default: .env)
--schema Path to the schema JSON file (default: env.schema.json)
--exit Set true, 'true' or 1 if you want to throw on invalids or warnings (default: true)
).env file:`json`
API_KEY=abc123
DEBUG_MODE=true
PORT=3000
env.schema.json file:`json
{
"REQUIRED_KEYS": {
"API_KEY": "string",
"DEBUG_MODE": "boolean"
},
"OPTIONAL_KEYS": {
"PORT": "number"
}
}
`
- string โ my-api-key, https://example.com, debug3000
- number โ , 42, 3.14true
- boolean โ , false["https://myapp.com", "https://admin.myapp.com"]
- array โ , ["feature1", "feature2", "feature3"]{"theme": "dark", "notifications": true}
- JSON (object) โ , {"maxRetries": 3, "timeout": 5000}2025-01-01
- date โ , 2023-05-01T15:30:00Z
Don't worry, the .env` files provided in this repository contain dummy data only.