envalid_validate
Validate .env files against envalid schemas to catch missing variables, type mismatches, and range errors before app startup or during CI.
Instructions
Validate a project's .env files against its envalid schema — catch missing required variables, type mismatches, and values outside allowed ranges.
When to use: before booting the app locally, during CI, after a teammate adds a new required env var, or when switching between development and production configs. Pass environment to validate a specific .env.{env} file.
Side effects: reads .env, .env.local, and .env.{environment} from the project root, and reads the envalid schema (typically src/env.ts or a similar file exporting cleanEnv(...)). Does not write or transmit env values anywhere — validation is local-only.
Returns: plain-text, JSON, or markdown report listing each declared variable, whether it is present, whether its value matches the expected type, and any schema-level validation errors with file:line references. Exit 1 on any validation failure.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Absolute or relative path to the project root to scan. Defaults to the current working directory. | |
| format | No | Response format: "terminal" for human-readable ANSI-colored output, "json" for machine-parseable structured data, "markdown" for rendered tables (where supported). Defaults to "terminal". | |
| environment | No | Environment name to validate (e.g. "production", "staging", "test"). Controls which .env.{environment} file is loaded and which conditional schema rules apply. Omit to validate the default .env/.env.local pair. |