Skip to main content

💻 CLI Commands Overview

Env Checkup provides a simple and intuitive command-line interface (CLI) to help you manage and validate your environment files efficiently.

There are two primary commands:

  • init — Create or update your environment schema interactively
  • validate — Validate .env files against the defined schema

🧩 Command List

CommandDescription
initInteractively generate a .env.schema.json file
validateValidate .env files using the defined schema

🏗️ 1️⃣ env-checkup init

Use this command to generate a schema file based on your environment variables.

npx env-checkup init

Example

? 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

After completion, you’ll have a .env.schema.json file like:

{
"DATABASE_URL": "string",
"PORT": "number",
"JWT_SECRET": "string"
}

Options

FlagDescription
--output <path>Custom path for schema file
--overwriteOverwrite existing schema file

Learn more → init command


🧩 2️⃣ env-checkup validate

Use this command to check whether your .env files match the schema.

npx env-checkup validate

Example Output

✅ Valid variable: PORT = 3000
⚠️ Missing variable: JWT_SECRET
❌ Invalid type: DEBUG_MODE (expected boolean, got string)

Options

FlagDescription
--schema <path>Path to schema file
--dir <path>Directory containing .env files
--strictEnable strict mode (fails build if invalid)
--ignore <vars>Comma-separated variables to skip

Learn more → validate command


🧠 Example Workflow

Here’s a typical workflow using both commands:

# Step 1 — Initialize schema
npx env-checkup init

# Step 2 — Validate .env files
npx env-checkup validate

# Step 3 — Enable strict validation in CI/CD
npx env-checkup validate --strict

🧰 npm Script Integration

Add the commands to your package.json for easy reuse:

"scripts": {
"env:init": "env-checkup init",
"env:check": "env-checkup validate --strict"
}

Then run:

npm run env:init
npm run env:check

🧩 Supported Environments

Env Checkup works on:

  • macOS
  • Linux
  • Windows (PowerShell and CMD)

And supports all standard .env variants automatically:

.env
.env.local
.env.example
.env.development
.env.production

🧭 Summary

CommandPurposeTypical Usage
initGenerate environment schema interactivelynpx env-checkup init
validateValidate .env files against schemanpx env-checkup validate
--strictEnforce full validationnpx env-checkup validate --strict

Next: