Commands

Reference for running genesis-env from your project root (current working directory). After a global install, use genv for every command below.

Quick workflow

bash
npm i -g genesis-env

genv init
# edit .env.template
genv
genv validate

Default: interactive generate

Running genv with no subcommand is the same as generate: it finds a template, prompts once per variable, then writes .env.

Template discovery, prompts, defaults, and overwrite rules are covered in Templates & .env.

generate (explicit)

Same behavior as the default command:

bash
genv generate

Overwrite an existing .env instead of exiting with an error:

bash
genv --force

You can also pass the short flag:

bash
genv -f

init

Scaffold missing files and keep .gitignore safe:

bash
genv init

Creates .env.template when needed, and ensures .env is listed in .gitignore (no duplicate lines). It does not write your local .env; run genv after init to generate that file.

Typical output on a fresh repo:

bash
$ genv init
✔ .env.template created
✔ .gitignore created
✔ .env added to .gitignore

.gitignore behavior

init handles three cases. You can run it on an existing repo without duplicating entries:

ScenarioWhat happens
No .gitignore existsCreates .gitignore with .env
.gitignore exists, .env not in itAppends .env
.env already ignoredPrints that it is already ignored; no duplicate line added

validate

Check that your local .env matches the committed template (keys and shape):

bash
genv validate

Run this after genv whenever you change the template or want to confirm a teammate's setup before shipping.

Security

genesis-env writes a plain .env file on your local filesystem. It is not a secrets manager. Your .env is unencrypted plaintext — genesis-env helps reduce the risk of committing it via .gitignore setup, but makes no encryption or security guarantees beyond that.

Options / flags

FlagEffect
--force / -fOverwrite an existing .env instead of exiting with an error (with generate or the default command).

Help

bash
genv --help

Sample workflow

  1. genv init (optional): scaffold .env.template, update .gitignore if needed.
  2. Edit .env.template or .env.example with your variable names and optional defaults.
  3. genv: answer prompts to generate .env.
  4. genv validate: confirm .env matches the template.
  5. Run your app with the new .env.

For template file rules and examples, see Templates & .env.