npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jaketig/envcrypt

v3.0.0

Published

Encrypt ENV variables so they are safe to store in version control

Downloads

252

Readme

ENVCRYPT

envcrypt is an encrypt/decrypt CLI tool that was built for the purpose of storing encrypted (AES-256) .env files in version control. By default, envcrpyt will take any .env files and create an encrypted .envcrypt file. The unencrypted .env files should not be committed to version control. The .envcrypt file can be.

Overwrite Protection

To prevent accidentally overwriting changes pulled from version control, envcrypt encrypt includes a safety check. It compares the state of the current .envcrypt file (based on its content hash) with the state recorded when the local .env files were last created (via envcrypt decrypt). If they don't match, it suggests the .envcrypt file might have been updated remotely.

This check uses a local .envcrypt.config file to track the last decrypted state via the last_decrypted_hash property.

If the check fails, you will be prompted to run envcrypt decrypt first to integrate any remote changes into your local .env files before encrypting again. You can bypass this check using the --force flag, but be cautious as this might overwrite changes from others.

Configuration (.envcrypt.config)

You can optionally store your encryption key and manage state within a .envcrypt.config JSON file in your project root. This file should be added to your .gitignore file.

Example .envcrypt.config:

{
  "key": "your-super-secret-key",
  "last_decrypted_hash": "a1b2c3d4..."
}
  • key (Optional): If present, envcrypt will use this key instead of prompting. The --key command-line argument still takes precedence.
  • last_decrypted_hash (Managed by envcrypt): Stores the hash of the .envcrypt content the last time decrypt was successfully run. Used for the overwrite protection check.

Usage

  1. Add @jaketig/envcrypt as a dev dependency
npm install @jaketig/envcrypt --save-dev
  1. Add .envcrypt.config to your .gitignore file.

  2. Use the CLI

envcrypt <command>

Commands

encrypt

e, enc

Encrypt the contents of .env files. Includes overwrite protection.

decrypt

d, dec

Decrypt the contents of .envcrypt file to original files and update local state.

Options

--key

--force

Examples

Bare Minimum Encryption

envcrypt e
  • will prompt for secret key
  • will encrypt .env to .envcrypt (if overwrite check passes)

Bare Minimum Decryption

envcrypt d
  • will prompt for secret key
  • will decrypt .envcrypt to .env
  • will update .envcrypt.config

Pass Key

envcrypt d --key=supersecret
  • will decrypt .envcrypt to .env

Force Encryption (Overwrite)

envcrypt e --key=supersecret --force
  • will encrypt .env to .envcrypt, ignoring potential state mismatch.