EnvLint is a local-first CLI, library API, and GitHub Action for finding environment variable contract drift before staging or production.
It scans code, env example files, runtime validation schemas, and deployment configuration to catch missing variables, unused variables, unsafe defaults, public frontend secret exposure, dynamic access, duplicate definitions, and other env contract problems.
npm install --save-dev envlint
npx envlint init
npx envlint scan . --format tableUpdate .env.example safely:
npx envlint fix . --update-example --sort --preserve-commentsGenerate a starter runtime schema:
npx envlint schema --from .env.example --format zodenvlint initcreatesenvlint.config.yaml.envlint scan [path] --format table|json|markdown|sarif|junit --strict --ciscans the project. Add--redact-secret-namesfor public artifacts or--allow-read-valuesfor local-only value checks.envlint fix [path] --update-example --sort --preserve-commentsupdates env examples without touching real.envfiles.envlint explain NAME [path]shows references and findings for one variable.envlint schema --from .env.example --format zod|json-schema|pydanticgenerates starter validation schemas.envlint diff [path] --base origin/main --head HEADreports findings tied to changed files.
import { scanProject, formatFindings } from 'envlint';
const result = await scanProject(process.cwd());
console.log(formatFindings(result.findings, result, { format: 'markdown' }));EnvLint reads only variable names from real .env files by default. Example values are read so unsafe defaults can be detected. Real values are only read when files.readRealValues: true, envlint scan --allow-read-values, or the equivalent API option is enabled. Reports mask read real env values as <redacted-env-value>.
Enable report.redactSecretNames: true when report artifacts should hide secret-like variable names.
npm run release:check
npm run publish:dry-runSee RELEASE.md before publishing to npm or tagging v1.
GitHub Action:
- uses: BoSuY0/EnvLint@v1
with:
config: envlint.config.yaml
fail-on-error: trueSee docs/ for CLI, configuration, GitHub Action, supported language, rule, autofix, and security details.