I built a CLI tool to stop .env file chaos across environments
Source: Dev.to
The Problem
Every team I’ve worked with has had the same issue: someone adds a new environment variable, forgets to inform the rest of the team, and suddenly staging breaks because a required variable like DATABASE_URL is missing.
Introducing env‑doctor
env‑doctor is a zero‑dependency CLI tool that helps keep .env files consistent across environments.
Features
check– Validates your.envagainst a.env.exampleor a schema file, detecting missing variables, type mismatches, and bad formats.diff– Compares two.envfiles side‑by‑side, highlighting missing, extra, or changed entries.mask– Outputs your.envwith values hidden, safe for sharing in Slack or pull‑request comments.init– Generates a.env.exampleautomatically from an existing.envfile.
It also supports a .env.schema format where you can define types, patterns, required fields, enums, and min/max constraints, allowing validation to catch real issues before deployment.
Installation & Usage
npx @atyahassis/env-doctor check
The tool works with Node 18+ and has no external dependencies.
License
MIT licensed.