DEV Community

Viraj Shoor
Viraj Shoor

Posted on

Built envguard to solve a stability itch.

Built envguard to solve an itch

Every developer has broken a local build or a deployment at least once because of a missing environment variable.

You pull the latest code, run the start script, and the application immediately crashes because someone added a new API key or database URL to the codebase but forgot to tell the team to update their local .env files.

I got tired of tracking down vague runtime errors caused by mismatched environments, so I built envguard to solve this exact bottleneck. It ensures your .env completely satisfies your requirements before your app even tries to start, guaranteeing a stable run.

The Problem: Silent Configuration Failures

Standard .env management usually relies on documentation or a .env.example file that quickly goes out of date. There is no automated bridge between what your code expects and what your actual file provides.

When a variable is missing, your app might fail silently until a specific code path is hit, causing unpredictable behavior right when you're trying to run the application.

How envguard Fixes This

envguard introduces a strict validation step using a .env.schema file. It acts as a structural gatekeeper for your configuration right at execution time.

  • Schema-Based Validation: It parses your .env and matches it against a defined .env.schema template.
  • Fail-Fast Mechanics: If a variable is missing or structurally invalid, envguard blocks the application startup and outputs a clean, explicit error showing exactly what is missing.
  • Stable Execution: By embedding this check directly into your application setup, you guarantee that the app cannot spin up unless its environment is 100% complete. Completely Open-source, forever.

Github:

GitHub logo virajshoor / envguard

Validate .env files against a typed .env.schema before bad config breaks your deploy. Offline-first CLI.

######## ##    ## ##     ##  ######   ##     ##    ###    ########  ########
##       ###   ## ##     ## ##    ##  ##     ##   ## ##   ##     ## ##     ##
##       ####  ## ##     ## ##        ##     ##  ##   ##  ##     ## ##     ##
######   ## ## ## ##     ## ##   #### ##     ## ##     ## ########  ##     ##
##       ##  ####  ##   ##  ##    ##  ##     ## ######### ##   ##   ##     ##
##       ##   ###   ## ##   ##    ##  ##     ## ##     ## ##    ##  ##     ##
######## ##    ##    ###     ######    #######  ##     ## ##     ## ########

Validate your env config before it breaks your deploy.

npm version npm downloads license node dependencies offline PRs welcome


A missing DATABASE_URL, a blank JWT_SECRET, a port set to banana, or a production-only typo can take down a release after the code was already fine envguard catches those mistakes where they belong: locally, in CI, and before runtime.

It validates a…

Quick Start

Install the package:



npm install -g @virajshoor/envguard
Enter fullscreen mode Exit fullscreen mode

Top comments (0)