Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EnvGuardian 🛡️

Smart schema-based validation for your .env files – across environments, stacks, and teams.

Why?

Environment variables are the backbone of your configuration, but:

  • There is no single source of truth for what should exist
  • Missing or invalid values are often discovered only in production
  • Different services use different .env files with no validation

EnvGuardian fixes this by letting you define a single schema and validate all your .env files against it.

Features

  • Single YAML schema for all environments
  • Type checking (string, number, boolean)
  • Constraints: required, enum, min, max, regex
  • Validate multiple .env files in one run
  • CI‑friendly exit codes
  • Human‑readable output

Install

 npm install -g https://registry.npmjs.org/@saarors/envguardian/-/envguardian-0.1.1.tgz

Quick start

1. Create a schema file

# config.schema.yml
APP_PORT:
  type: number
  required: true
  min: 1024
  max: 65535

APP_ENV:
  type: string
  required: true
  enum: [development, staging, production]

JWT_SECRET:
  type: string
  required: true
  minLength: 32

ENABLE_METRICS:
  type: boolean
  required: false

2. Validate your .env files

envguardian validate \
  --schema config.schema.yml \
  --env .env.local \
  --env .env.production

If any required variable is missing or invalid, EnvGuardian will:

Print a detailed report

Exit with a non‑zero status code (perfect for CI)

GitHub Actions example

name: Env Validation

on: [push, pull_request]

jobs:
  validate-env:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run:  npm install -g https://registry.npmjs.org/@saarors/envguardian/-/envguardian-0.1.1.tgz
      - run: envguardian validate --schema config.schema.yml --env .env.example

About

Smart schema-based validation for your .env files – across environments, stacks, and teams

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages