Commands

Generate, validate, and use your Dotenvxfile.

Usage

Create a Dotenvxfile in your project root, then encrypt and run:

dotenvx encrypt
dotenvx run -- node index.js

Use dotenvx run -f .env.production -- node index.js to load a specific environment file and its overrides. Dotenvx validates resolved values before starting the command, and strict true stops startup on validation failures.

To inspect rules without loading values, use the primitives commands:

dotenvx primitives policy --source 'env "PORT", type: "port"' --file .env.production
dotenvx primitives storagepolicy --source 'storage "encrypted"' --file .env.production

See the quickstart for a complete example.