Finds every environment variable your code reads and tells you which ones are documented. It can generate a .env.example, print a Markdown table, or fail CI when code references a variable that is missing from your .env.example. No dependencies, no AI.
A new process.env.SOMETHING that never makes it into .env.example is a common cause of "works on my machine". envdoc reads your source the way your runtime does and reports the drift.
npm install -g @bobfromarcher/envdoc
# or run once:
npx @bobfromarcher/envdocenvdoc recognises environment access in JavaScript and TypeScript (process.env.X, process.env['X'], import.meta.env.X), Python (os.environ['X'], os.environ.get('X'), os.getenv('X')), Go (os.Getenv("X"), os.LookupEnv), and Ruby (ENV['X']).
envdoc [path] [options]| Option | Description |
|---|---|
--write |
Write or update .env.example (existing values are kept) |
--check |
Exit 1 if code uses vars missing from .env.example |
--markdown, --md |
Print a Markdown table of all referenced variables |
--json |
Print raw JSON |
--env <file> |
The dotenv file to diff against (default .env.example) |
-h, --help |
Show help |
-v, --version |
Show version |
envdoc # summary for the current directory
envdoc --write # regenerate .env.example, keeping known values
envdoc src --markdown > ENV.md# .github/workflows/env.yml
- run: npx @bobfromarcher/envdoc --checkThe build fails the moment someone references a variable that is not documented, so your code and your .env.example stay in sync.
When ripgrep is on your PATH, envdoc uses it to list files (respecting .gitignore) and scans thousands of files in milliseconds. Without ripgrep it falls back to a built-in Node walk with the same results and still zero npm dependencies.
git clone https://github.com/bobfromarcher/envdoc
cd envdoc
node test/test.jsCI runs the suite on Node 18, 20 and 22 across Linux, macOS and Windows.
MIT, bobfromarcher.