Star on GitHub - 5.8k

define

Create an Envfile to validate your project's environment variables:

Usage

Create an Envfile to validate your project’s environment variables:

$ dotenvx define
≡ defined (Envfile)

Merges variable names from both .env.example and .env, skipping missing files and including each name once. If neither default file exists, it creates a starter. An existing Envfile is always left unchanged.

The first line is encrypted false by default, or encrypted true if any application variable assignment in either input starts with encrypted:. Duplicate assignments are all inspected. This sets the encryption requirement for all declarations; use encrypted: false on individual variables that should remain plaintext.

Generated declarations are required by default. Review them and mark optional variables with optional: true.

Only names are copied: values are never included, decrypted, expanded, or fetched from secret providers. Dotenvx public and private key entries are excluded. Your env files are unchanged.

Run dotenvx validate (or dotenvx validate -f .env.production for another file) to check your configuration. Once Envfile exists, dotenvx run validates automatically before starting your command.

Options