πΏ Env Checkup
Env Checkup is a developer-friendly CLI tool that helps you validate, audit, and generate schemas for your environment configuration files (.env, .env.local, .env.example, etc.).
It ensures your team never misses critical environment variables again β in development, staging, or production.
π‘ Why Env Checkup?β
Environment variables are essential, but they can easily become messy:
- Missing
.envkeys cause runtime errors - Outdated
.env.examplefiles confuse new developers - Typos lead to unpredictable bugs
Env Checkup solves all of this by enforcing consistency and validation.
β
Detects all .env files recursively
β
Validates keys against a schema
β
Generates schema automatically via CLI prompts
β
Supports CI/CD integration
β
Works with any JavaScript or TypeScript project
π What It Doesβ
Env Checkup provides two main commands:
1οΈβ£ env-checkup initβ
Creates an environment schema interactively:
npx env-checkup init
Youβll be prompted to define your environment variables and their expected types:
? Enter variable name: DATABASE_URL
? Type of value (string/number/boolean): string
? Enter variable name: PORT
? Type of value: number
? Add another variable? (y/n): n
The tool then creates a .env.schema.json file like this:
{
"DATABASE_URL": "string",
"PORT": "number"
}
2οΈβ£ env-checkup validateβ
Validates your environment variables against the generated schema.
npx env-checkup validate
Example output:
β
Valid variable: PORT = 3000
β οΈ Missing variable: JWT_SECRET
β Invalid type: DEBUG_MODE (expected boolean, got string)
βοΈ Supported File Typesβ
Env Checkup automatically detects and validates all standard .env formats:
.env
.env.local
.env.example
.env.development
.env.production
.env.test
.env.bat
You can even specify custom file patterns using CLI flags or config.
π§ Example Project Structureβ
Hereβs how a typical project looks with Env Checkup:
my-app/
β£ .env
β£ .env.example
β£ .env.schema.json
β£ package.json
β£ src/
β β index.ts
π§© Configuration Optionsβ
You can customize Env Checkup via a .envcheckuprc.json file in your root directory.
Example configuration:
{
"schemaPath": "./.env.schema.json",
"envDir": "./",
"strict": true,
"ignore": ["NODE_ENV"]
}
CLI Flagsβ
You can also override these settings directly:
env-checkup validate --schema ./.env.schema.json --strict
π Integration with CI/CDβ
Add Env Checkup to your CI pipeline to catch missing environment variables before deployment:
# GitHub Actions example
- name: Validate environment
run: npx env-checkup validate --strict
If any variables are missing or invalid, the build will fail with a clear error message.
π§° Example npm Scriptsβ
To make validation easy for your team, add scripts to package.json:
"scripts": {
"env:init": "env-checkup init",
"env:validate": "env-checkup validate"
}
Now developers can run:
npm run env:init
npm run env:validate
π οΈ Installationβ
You can install Env Checkup globally or locally.
Globalβ
npm install -g env-checkup
Local (recommended)β
npm install env-checkup --save-dev
Run it using npx:
npx env-checkup validate
π§ When to Use Env Checkupβ
Use Env Checkup whenever:
- You have multiple
.envfiles - You onboard new developers frequently
- You deploy across multiple environments
- You want to catch missing configuration early
Itβs especially useful for:
- Next.js / Node.js / Express projects
- Monorepos with shared environment variables
- CI/CD validation before production builds
π§Ύ Example Validation Error Outputβ
$ npx env-checkup validate
β οΈ Missing variables:
- DATABASE_URL
- JWT_SECRET
β Invalid types:
- PORT (expected number, got string)
β
3/5 variables valid
This makes it easy to identify and fix environment configuration issues immediately.
π§© Summaryβ
| Feature | Description |
|---|---|
init | Creates .env.schema.json interactively |
validate | Checks .env files against schema |
--strict | Exits with error if validation fails |
--schema | Use a custom schema path |
--dir | Validate .env files from a specific directory |
π¬ Support & Contributingβ
We welcome contributions! If you find a bug or want to add a feature:
git clone https://github.com/tier3guy/Env-Checkup.git
cd Env-Checkup
npm install
npm run dev
Then open a pull request π
β€οΈ Creditsβ
Built with π by tier3guy who was tired of losing hours to broken .env files.