Observed since 20 Oct, 23:05 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
CLI & API to validate .env files
@0xdaniiel/env-checker 🛡A fast, CI-friendly CLI & API to validate
.envfiles — checks for missing/extra variables, type/format errors, and sensitive values. Includes.env.examplegenerator.
@0xdaniiel/env-checker helps you catch configuration issues early — before they break production.
It compares your .env against .env.example, validates formats, detects secrets, and can auto-generate .env.example from your current config.
Environment variables often cause bugs, confusion, and security leaks when they are missing, outdated, misformatted, or leaked to version control.
📄 Read more: docs/problem.md
Validate, enforce, and sanitize your .env files — locally and in CI/CD — so bad configs never make it to production.
📄 Read more: docs/solution.md
.env ↔ .env.example..env.example generator (strips secrets)..env.local, .env.production, etc.).npm install -g @0xdaniiel/env-checker
# or locally
npm install --save-dev@0xdaniiel/env-checker
npx @0xdaniiel/env-checker [options]
| Flag | Description |
| ------------------ | -------------------------------------------------- |
| `--ci` | Run in CI mode (non-zero exit code on failure) |
| `--generate` | Create `.env.example` from `.env` (strips secrets) |
| `--path <file>` | Specify `.env` file path |
| `--example <file>` | Specify `.env.example` path |
| `--json` | Output results in JSON |
| `--help` | Show help menu |
After building the project (npm run build), you can run the compiled CLI directly with Node.js:
node dist/cli.js --path ".env" --example ".env.example"
You can use @0xdaniiel/env-checker programmatically in your Node.js or TypeScript projects.
import { checkEnv } from "@0xdaniiel/env-checker";
function runCheck() {
const result = checkEnv({
envPaths: [".env", ".env.local"], // Paths to your .env files
examplePath: ".env.example", // Path to your .env.example file
});
console.log("Missing variables:", result.missing);
console.log("Extra variables:", result.extra);
console.log("Type errors:", result.typeErrors);
console.log("Sensitive warnings:", result.sensitiveWarnings);
if (
result.missing.length ||
result.extra.length ||
result.typeErrors.length ||
result.sensitiveWarnings.length
) {
throw new Error("Environment variables validation failed");
}
}
try {
runCheck();
} catch (err) {
console.error(err);
process.exit(1);
}
| Option | Description |
| ------------- | ----------------------------------------- |
| `envPaths` | Array of paths to `.env` files to merge |
| `examplePath` | Path to `.env.example` file for reference |
The checkEnv function returns an object containing:
missing: Array of variable names missing in your env files but present in example.extra: Array of variable names present in env files but missing from example.typeErrors: Array of strings describing type or format validation errors.sensitiveWarnings: Array of strings warning about sensitive values detected.--ci flag for automatic failure on issues.This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
We welcome contributions!
git checkout -b feature-name)git commit -m 'Add some feature')git push origin feature-name)Please open an issue to discuss major changes before submitting a pull request.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.0.0Registry latest | 11 Aug 2025 | 11 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 23:05 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:19d9ee7244f44d78fc18006fdfc952b0fb2e1564ec793ccf8dbfe47d50c302aa