dev utility
envguard icon

envguard.

validate .env against a typed schema. catch PORT=foo before prod does.

21 types: url, uuid, semver, duration, json, ip, enum, regex, secret, + min/max constraints. secret-leak scanner (gitignore check + shape detection). JSON envelope for CI, --fail-if-leaked for pre-commit.

npm install -g @v0idd0/envguard

what it is

envguard is a validation tool for environment variables. it parses your .env and .env.example files, comparing the keys. if the active environment is missing a required variable, envguard throws an error and halts the process.

finding out you are missing an api key because a production endpoint just threw a 500 error is an amateur mistake. relying on application code to manually check for process variables scales poorly. envguard enforces the contract defined in your example file at boot time.

it is designed for ci/cd pipelines and Docker entrypoints. by running envguard before your start script, you guarantee that the application has the configuration it needs to run properly.

core features

+

strict validation

compares your active .env against the .env.example template. fails immediately if keys are missing.

+

ci/cd ready

exits with a non-zero status code on failure. prevents broken builds from deploying to production.

+

empty value detection

flags variables that are defined but left blank. catches silent configuration errors.

+

custom paths

specify non-standard file names if you use multiple environment files. adapts to your project structure.

+

zero dependencies

runs as a standalone binary. does not bloat your node_modules or require a specific runtime.

how to use it

validate your environment variables before starting the server.

// input

envguard check && node server.js

// output

error: missing required variable 'DATABASE_URL' defined in .env.example.
process exited with code 1.

the boot sequence was aborted because a required configuration key was missing.

why we built it

we took down a staging environment because someone added a new required environment variable and forgot to tell the rest of the team. the application booted fine but crashed on the first request.

relying on developers to manually read the .env.example file is a failed strategy. envguard forces the issue by failing the boot process immediately if the contract is broken.

frequently asked questions

can i mark variables as optional?

yes. if you append a specific comment flag to the key in the example file, envguard will allow it to be missing.

does it read from the system environment?

yes. it checks both the local .env file and the active system environment variables before failing.

does it validate values?

no. it checks for existence and non-empty strings. it does not verify if your database url is actually valid.

what languages does it support?

it is language agnostic. it parses standard dotenv syntax and can be used with any tech stack.

// stop crashing production because of a typo in your env file.