envfix icon

envfix

envfix is a zero-dependency Node.js CLI for checking .env files against .env.example, fixing missing keys, and syncing example files for local dev and CI.

envfix

Overview

envfix is a small Node.js command-line tool for checking and repairing environment file drift. Its primary job is to compare .env against .env.example, identify missing or malformed configuration, and help keep the two files aligned without leaking secrets.

The README presents it as zero-dependency and CI friendly. Beyond the basic check-and-fix flow, it can generate or sync example files, inspect Git safety around .env, and scan multiple environment file pairs in a project directory.

Core capabilities

Environment drift checks

Compare a local .env file against .env.example to surface missing variables and empty values, then guide the user toward a fix.

Safe repair workflow

Append missing keys to .env without overwriting existing lines or values; the file is created if it does not exist.

Example file generation and sync

Generate a .env.example from .env, or sync new keys into an existing example file while reporting stale entries.

Doctor mode

Run a broader health check that covers file presence, syntax, consistency, and Git safety, including whether .env is ignored or tracked.

Multi-environment coverage

Scan every .env*.example ↔ env pair in a directory with --all so multiple environment files can be checked in one run.

Output and workflow controls

Use flags such as --dry-run, --json, --strict, and GitHub annotation controls to fit local review and CI workflows.

Common use cases

  • Catch local config drift

    Use envfix after pulling a repository or merging changes to find environment variables that were added to .env.example but are missing from your local .env.

  • CI validation for environment files

    Run the doctor command in a CI job to check file presence, syntax, consistency, and whether .env is tracked or ignored by Git before code is merged.

  • Repair or regenerate environment files

    Use fix when you want to add only the missing keys to .env, or use example / example --sync when maintaining an example file for teammates.

  • Review multiple environment pairs

    Enable --all in projects with several environment variants so one command can inspect each .env*.example pair in the directory.

  • Automated reporting

    Use --json or GitHub annotation flags when the output needs to be consumed by automation rather than read manually.

Pros and Cons

Pros

  • Zero-dependency CLI design keeps setup simple.
  • Can detect missing keys, empty values, duplicates, malformed declarations, and Git safety issues.
  • Supports repair workflows that avoid overwriting existing values by default.
  • Can generate or sync .env.example files while omitting secret values.
  • Offers CI-friendly options including JSON output, dry-run mode, and GitHub annotations.

Cons

  • The source material is strongest on README examples; detailed command references and edge-case behavior are not fully documented in the supplied pages.
  • It is focused on Node.js projects and .env-style workflows, so it is not a general-purpose configuration manager.

FAQ

Can envfix be used in CI?

Yes. The README shows envfix as a Node.js command-line tool that can be run with npx, including on GitHub Actions where annotations are automatically enabled.

What can envfix do?

envfix can compare .env with .env.example, append missing keys to .env, run a broader doctor check, generate an example file from .env, or sync an example file with new keys.

Does envfix require installation?

The README says envfix has zero dependencies and is meant for Node.js projects. It is distributed through npm and can be run without a local install using npx envfix.

Does envfix support machine-readable output?

The README describes a --json option for a single JSON document, and a doctor mode that reports files, syntax, consistency, and Git safety. It also notes GitHub annotations can be forced on or off.

Is envfix a paid product?

The source only shows envfix as a public GitHub repository and does not describe paid tiers or licensing terms beyond the repository contents provided here.

Quick Facts

Category
Developer Tool
Platform
Node.js command-line tool
Primary use
Check and repair .env vs .env.example drift
Distribution
Run with npx; repository includes package.json
Repository
github.com/gokhanozgezer/envfix
Cost signal
Open-source repository with no paid plan described in the supplied sources