@varshiljpatel/nenv
v0.0.5
Published
No need to manage .env files. Just use nenv!
Maintainers
Readme
nenv
Problem Statement
Managing .env files in modern applications can be cumbersome and error-prone. Developers often face challenges such as:
- Accidentally committing sensitive
.envfiles to version control. - Manually managing
.envfiles across multiple environments (e.g., development, staging, production). - Lack of encryption for
.envfiles, leaving sensitive data exposed.
These issues can lead to security vulnerabilities, inefficiencies, and unnecessary complexity in managing environment variables.
Solution: nenv
nenv is a CLI tool designed to simplify and secure the management of .env files. With nenv, you can:
- Encrypt your
.envfiles into.nenvfiles, ensuring sensitive data is protected. - Decrypt
.nenvfiles back into.envfiles when needed. - Specify custom paths and filenames for
.envand.nenvfiles. - Automatically update your
.gitignorefile to exclude.nenvfiles from version control.
nenv ensures that your environment variables are secure and easy to manage across different environments.
Features
- 🔒 Encryption: Securely encrypt
.envfiles into.nenvfiles using AES-256 encryption. - 🔓 Decryption: Decrypt
.nenvfiles back into.envfiles when needed. - 📂 Custom Paths: Specify custom paths and filenames for
.envand.nenvfiles. - 🛠️ Cross-Platform: Works seamlessly on Windows, macOS, and Linux.
- 📜 Automatic
.gitignoreUpdates: Automatically adds.nenvfiles to your.gitignorefile to prevent accidental commits.
Installation
You can install nenv using your favorite package manager:
npm
npm install -g @varshiljpatel/nenvpnpm
pnpm add -g @varshiljpatel/nenvyarn
yarn global add @varshiljpatel/nenvbun
bun add -g @varshiljpatel/nenvYou can also access the cli via
nenv ...andno.env ...command.
Usage
Encrypting .env Files
To encrypt a .env file into a .nenv file, use the encrypt command:
nenv encrypt <password>Options:
--env <path>: Path to the.envfile (default:./).--name <filename>: Name of the.envfile (default:.env).--output <path>: Directory where the.nenvfile will be saved (default:./).
Example:
nenv encrypt mypassword --env=./src/frontend --name=.env.local --output=./src/frontendThis command:
- Encrypts the
.env.localfile located in./src/frontend. - Saves the encrypted
.nenvfile in the./src/frontenddirectory.
Decrypting .nenv Files
To decrypt a .nenv file back into a .env file, use the decrypt command:
nenv decrypt <password>Options:
--env <path>: Path to the.nenvfile (default:./).--name <filename>: Name of the output.envfile (default:.env).
Example:
nenv decrypt mypassword --env=./src/frontend --name=.env.localThis command:
- Decrypts the
.nenvfile located in./src/frontend. - Saves the decrypted
.env.localfile in the same directory.
Automatic .gitignore Updates
nenv automatically updates your .gitignore file to include the .nenv file. This ensures that encrypted files are not accidentally committed to version control.
How It Works
Encryption
- Reads the contents of the
.envfile. - Encrypts the contents using AES-256 encryption with a user-provided password.
- Saves the encrypted data as a
.nenvfile in the specified output directory.
Decryption
- Reads the contents of the
.nenvfile. - Decrypts the contents using AES-256 decryption with the same password used for encryption.
- Saves the decrypted data as a
.envfile in the specified directory.
Supported Platforms
nenv is built using Rust and Node.js, making it compatible with the following platforms:
- Windows
- macOS
- Linux
License
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Contributing
Contributions are welcome! If you'd like to contribute, please:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Submit a pull request.
Author
This project is developed and maintained by Varshil J Patel.
- GitHub: @varshiljpatel
- Email: [email protected]
Acknowledgments
- Built with ❤️ using Rust and Node.js.
- Inspired by the need for secure and efficient environment variable management.
Feedback
If you encounter any issues or have suggestions for improvement, please open an issue on the GitHub repository.
Keywords
nenv.nenvenvironment variablessecure env managementencryptiondecryptionnode.jsrust
Future Plans
- Add support for additional encryption algorithms.
- Provide a GUI for managing
.envand.nenvfiles. - Add integration with cloud-based secret management tools.
Thank you for using nenv! 🎉
