Skip to main content

Smart .env generator with auto-passwords, rich UI, and dotenv-vault support

Project description

envgen-cli — Smart .env File Generator

A smart .env file generator based on a .env.example template. Automatically creates secure secrets, provides an interactive colorized terminal interface, and supports optional encryption using dotenv-vault.

PyPI Version Supported Python Versions License: MIT Downloads

Say goodbye to manually copying, pasting, or guessing environment variable values. Let envgen-cli handle the tedious work while you focus on writing code.

Demonstration

Watch the demo video here: https://ibb.co/JSXRVsb

Key Features

Interactive Interface: Stylish, color-coded terminal user interface (TUI). Auto-generated Secrets: Creates strong random passwords for fields like DB_PASS, SECRET_KEY, API_KEY, and more. Security First: Optional encryption through dotenv-vault for safe team collaboration. Zero Configuration: No config needed — just run envgen inside your project directory. Production Ready: Well-tested and type-safe for production environments. Lightweight: Minimal dependencies.

Installation

Bash

pip install envgen-cli

After installation, follow these three simple steps

Step 1 Create a .env.example in your project

Create a template file with the keys you need

Bash

cat > .env.example <<EOF DB_HOST=localhost DB_NAME= DB_USER=postgres DB_PASS= SECRET_KEY= DEBUG=true EOF

Step 2 Run envgen to generate your .env file

Bash

envgen --auto-generate --force

You will be prompted to enter values for empty fields.
For sensitive fields (like DBPASS, SECRETKEY), a strong generated password will be suggested.
Press Enter to accept it, or type your own value.

Step 3 Use your new .env file

That's it! Your .env is ready. Start your app — it will automatically read the environment variables from this file.

Tip for first-time users Run this quick demo in an empty folder to see how it works

Bash

mkdir demo-envgen && cd demo-envgen echo -e "API_KEY=\nDB_NAME=\nSECRET_KEY=" > .env.example envgen --auto-generate --force

Example

Assume you have a .env.example file like this

text

DB_HOST=localhost DB_PORT=5432 DB_USER=app_user DB_PASS= SECRET_KEY= API_ENDPOINT=https://api.example.com

After running envgen --auto-generate, you will get an interactive prompt for each empty field. For DBPASS and SECRETKEY, the tool will suggest generated values.

The resulting .env file will look something like this

text

DB_HOST=localhost DB_PORT=5432 DB_USER=app_user DB_PASS=Ahngaey7aezee2Oo SECRET_KEY=!hz$@vz9x4%f&s#l+0vqo@%d&e^p$*a@ API_ENDPOINT=https://api.example.com

When to use --force (and when not to)

Use --force when

  • You are testing or developing and want a clean start every time.
  • You are giving a demo and need predictable output.
  • You changed your .env.example and want to regenerate the .env file from scratch.

Bash

envgen --auto-generate --force

Do NOT use --force when

  • You are in a team project — others may have custom settings in their .env file.
  • You are in a production or staging environment — never overwrite live configs!
  • You have already configured your .env file manually — you will lose your changes!

Safe mode recommended for most cases

Bash

envgen --auto-generate

In this mode, the utility will not overwrite an existing .env file.

Think of it like this

--force = "I know what I'm doing — overwrite everything!"
No --force = "Be careful — if a config exists, leave it alone."

Available Commands & Options

text

envgen [OPTIONS]

Options

  • -a, --auto-generate Enable automatic generation of values for empty/secret fields
  • -f, --force Force overwrite of an existing .env file
  • --help Show this help message and exit

Development and Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

envgen_cli-0.2.2.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

envgen_cli-0.2.2-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file envgen_cli-0.2.2.tar.gz.

File metadata

  • Download URL: envgen_cli-0.2.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0a5

File hashes

Hashes for envgen_cli-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e292e210b11e66cba7fd0c76850d0471c998ecbf65f782ade47d206cac7cb28d
MD5 c88325288fd18036213605f0bd62ddd8
BLAKE2b-256 01ea1e3ef93a447c46d796f8afcd9ea910bb84253dc2ce76f06766da3ccc98c9

See more details on using hashes here.

File details

Details for the file envgen_cli-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: envgen_cli-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0a5

File hashes

Hashes for envgen_cli-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2fb687cb9a47638d1d0e0f866489afe19c869a05c6a6a8baff4430571afaa308
MD5 d13d589fa1540996219680817b2ee7ff
BLAKE2b-256 d787a4005906a26c0561a667f379caaad0586cac608d7853b68db7cb086220ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page