Validate .env files against schema. No more undefined in production.
npm install checkenvwtfValidate .env files against schema. No more undefined in production.


Documentation · Report Bug · All Tools
``bash`
npm install -g envguard
`bashvalidate .env against .env.schema
envguard✓ valid. 12 variables checked.
Schema Format
Create
.env.schema:`bash
Required variables (no default)
DATABASE_URL
API_KEYWith type validation
PORT=port
DEBUG=boolean
API_URL=url
ADMIN_EMAIL=email
MAX_CONNECTIONS=numberOptional variables (with ?)
OPTIONAL_VAR?
ANALYTICS_ID?With default value
NODE_ENV=string:development
TIMEOUT=number:30
`Types
| Type | Description | Example |
|------|-------------|---------|
|
string | Any string (default) | hello |
| number | Numeric value | 42, 3.14 |
| boolean | true/false/1/0/yes/no | true |
| url | Valid URL | https://example.com |
| email | Valid email | user@example.com |
| port | Port number (1-65535) | 3000 |Commands
| Command | Alias | Description |
|---------|-------|-------------|
|
check | c | Validate .env against schema (default) |
| diff | d | Compare two .env files |
| init | i | Generate schema from .env |
| list | l | List all variables |Options
| Flag | Description | Default |
|------|-------------|---------|
|
-e, --env | Path to .env file | .env |
| -s, --schema | Path to schema file | .env.schema |
| -o, --output | Output file for init | .env.schema |
| --strict | Fail on extra variables | false |
| --quiet | Only output errors | false |CI/CD Integration
`yaml
GitHub Actions
- name: Validate environment
run: envguard check --strictPre-commit hook
envguard check || exit 1
``- cronwtf — cron expression explainer
- depcheck — dependency security scanner
- logparse — log parser and searcher
MIT © rtfm.codes
---
rtfm.codes — it works. the docs explain why.