Skip to main content

Secure your environment variables โ€” locally, encrypted, and stream-safe.

Project description

EnvLockr - Secure Your Environment Variables Locally

๐Ÿ” EnvLockr CLI

PyPI version npm version License: MIT Python 3.8+ GitHub stars

Secure your environment variables โ€” locally, encrypted, and stream-safe.

EnvLockr CLI is a tool for developers, streamers, and indie hackers who want full control of their secrets without relying on cloud services.

EnvLockr demo: add, run, verify

โœจ Features

  • Local-first: All secrets stored encrypted on your machine โ€” no cloud, no account
  • Keychain-backed key: The master key lives in your OS keychain (Windows Credential Manager / macOS Keychain / libsecret), not a plaintext file beside the vault โ€” real protection if your disk is compromised
  • run injection: envlockr run -- npm run dev injects secrets straight into the process โ€” no .env ever written to disk
  • Liveness verify: envlockr verify checks whether your stored keys are still live (Stripe, OpenAI, Anthropic, GitHub, Slack) โ€” catch revoked/rotated keys
  • Profiles: --env prod for isolated per-environment vaults
  • Offline Mode: Core commands need no internet
  • Stream-Safe: No .env on screen while coding or streaming
  • Cross-Project Friendly: Works with React, Node.js, Python, and more
  • GitHub Action: Scan commits for exposed secrets (Learn more)

๐Ÿš€ Quick Start

1. Install

# Install from PyPI (recommended)
pip install envlockr

# Recommended: keychain-backed key + clipboard support
pip install "envlockr[keychain,clipboard]"

Using an npm-centric workflow? There's an npm wrapper so envlockr works in package.json scripts and with npx (it proxies to the Python CLI above):

npm install -g envlockr   # wrapper โ€” still needs the pip package installed

๐Ÿ’ก Without the keychain extra, the master key falls back to a 0600 file on disk and EnvLockr warns you. Install the extra for real disk-compromise protection, then run envlockr secure-key to migrate an existing key.

Alternative: Install from source
git clone https://github.com/RohanRatwani/envlockr-cli.git
cd envlockr-cli
pip install -e .

2. Commands

Command Example What it Does
add envlockr add STRIPE_KEY Add a new secret
get envlockr get STRIPE_KEY Retrieve a secret
list envlockr list List all stored secrets
copy envlockr copy STRIPE_KEY Copy secret to clipboard
update envlockr update STRIPE_KEY Update an existing secret
delete envlockr delete STRIPE_KEY Delete a secret
export envlockr export --output .env Export all secrets to .env file
import envlockr import .env Import secrets from .env file
run envlockr run -- npm run dev Run a command with secrets injected (no .env)
verify envlockr verify Check whether stored keys are still live
secure-key envlockr secure-key Move the master key into your OS keychain
encrypt-vault envlockr encrypt-vault Password-protect your vault for backup
decrypt-vault envlockr decrypt-vault Restore a password-protected vault
export-vault envlockr export-vault Export vault for team sharing
import-vault envlockr import-vault Import a shared vault file
--env envlockr --env prod list Use an isolated named profile
--version envlockr --version Show version number

By default add prompts securely (hidden input). For scripts and CI, pass the value non-interactively:

envlockr add API_KEY --value "$API_KEY" --force      # from a variable
printf '%s' "$API_KEY" | envlockr add API_KEY --stdin # from stdin (no shell history)

โšก How to Use in Your Projects

๐Ÿ–ฅ Node.js / React / Vite / Next.js

Option 1 (recommended): run โ€” inject secrets, no file on disk

envlockr run -- npm run dev

All your secrets are injected into the process environment. Nothing is written to disk, so there is no .env to accidentally commit or leak on stream.

Option 2: Export to .env file

envlockr export --output .env
npm run dev

Option 3: Inline Injection of a single value

export STRIPE_KEY=$(envlockr get STRIPE_KEY)
npm run dev

Option 3: Import existing .env file

# Migrate your existing .env to encrypted storage
envlockr import .env
rm .env  # Delete the unencrypted file

๐Ÿ›  Compatible with

  • create-react-app
  • Next.js
  • Vite
  • Remix
  • Express
  • NestJS
  • and more!

๐Ÿ‘‰ See framework-specific examples - React, Next.js, Python, Docker, and more!

๐Ÿ“ฆ Local Storage & Security Model

Your secret values are encrypted with Fernet (AES-128-CBC + HMAC) and stored in:

~/.envlockr/vault.json        # encrypted secret values

The master key is stored in one of two places:

  • OS keychain (when envlockr[keychain] is installed) โ€” the key never touches the filesystem, so reading vault.json alone is useless to an attacker.
  • ~/.envlockr/key.key (0600) as a fallback when no keychain is available. In this mode the key sits next to the vault, so disk access = full access โ€” EnvLockr warns you and you can upgrade with envlockr secure-key.

For backups and team sharing, encrypt-vault bundles the vault + key behind a password using PBKDF2-HMAC-SHA256 (600k iterations) with a random per-file salt.

  • โœ… No external cloud or server dependency
  • โœ… Honest about where the key lives โ€” no false "uncrackable" claims

๐Ÿ” GitHub Action - Prevent Secret Leaks

EnvLockr includes a GitHub Action that automatically scans your repository for exposed secrets!

Quick Setup

Add this to .github/workflows/envlockr-scan.yml:

name: EnvLockr Secret Scan
on: [pull_request, push]

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Scan for secrets
        run: |
          curl -sSL https://raw.githubusercontent.com/RohanRatwani/envlockr-cli/main/.github/scripts/scan-secrets.sh | bash

What it does:

  • โœ… Scans commits for API keys, tokens, and passwords
  • โœ… Blocks PRs if secrets are detected
  • โœ… Posts helpful comments with fix instructions
  • โœ… Detects AWS, Stripe, GitHub, Google, OpenAI, and more

๐Ÿ‘‰ Full GitHub Action Documentation

๐Ÿ†š How EnvLockr is different

There are great tools in this space โ€” EnvLockr fills the gaps they leave:

EnvLockr dotenvx SOPS gitleaks
Key off-disk (OS keychain) โœ… โŒ (.env.keys on disk) โš ๏ธ external KMS/age setup n/a
Run cmd with no .env written โœ… run -- โš ๏ธ decrypts to env, needs config โŒ n/a
Check if stored keys are still live โœ… verify โŒ โŒ โŒ
Zero-config, single command โœ… โš ๏ธ multi-step workflow โŒ steep โœ… (scan only)
Manages secrets and scans for leaks โœ… โŒ (manager only) โŒ โŒ (scanner only)
  • vs dotenvx โ€” dotenvx keeps the decryption key in a .env.keys file on disk; EnvLockr puts it in your OS keychain and can run your app with nothing written to disk.
  • vs gitleaks/trufflehog โ€” those are scanners, not managers. trufflehog can verify secrets it finds by scanning; EnvLockr's verify does that for the vault you actively manage โ€” plus it gives you a place to put the secrets (and wraps gitleaks for scanning when present).
  • vs SOPS/Vault โ€” no KMS, no server, no YAML โ€” one pip install and you're running.

๐Ÿ’ฌ Why EnvLockr?

  • ๐Ÿ”’ Protect your keys without trusting the cloud
  • ๐ŸŽฅ Stream coding sessions without leaking environment secrets
  • โšก Speed up local development with simple, fast secret management

๐Ÿ“š Documentation

๐Ÿ“ฅ What's Next?

We're exploring new features for EnvLockr, including:

  • Advanced environment injection (envlockr inject -- npm run dev)
  • Desktop UI app
  • IDE integrations (VS Code, JetBrains)

๐Ÿ‘‰ Join the Waitlist and share your thoughts!

๐Ÿ’ก We Want Your Feedback!

Which features would you love to see in EnvLockr?

๐Ÿ›ก๏ธ License

This project is licensed under the MIT License.


Made with โค๏ธ by Rohan Ratwani
Website ยท GitHub ยท Twitter

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

envlockr-2.0.0.post1.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

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

envlockr-2.0.0.post1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file envlockr-2.0.0.post1.tar.gz.

File metadata

  • Download URL: envlockr-2.0.0.post1.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for envlockr-2.0.0.post1.tar.gz
Algorithm Hash digest
SHA256 ee331c58e650ebac12b6c7a9742a88f60c4694bde6bc20fca2049c18477bd39c
MD5 a5e843585bf87eeda1ef90f742874c36
BLAKE2b-256 0a67ef6866952fae74042404ac3cb74e4af155407235c27d6fccc0668dcede9c

See more details on using hashes here.

File details

Details for the file envlockr-2.0.0.post1-py3-none-any.whl.

File metadata

  • Download URL: envlockr-2.0.0.post1-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for envlockr-2.0.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 2555afefa7f03ea54a3fa1a3132ea3d26a210231d9fe4ed2da2475362d9831b5
MD5 7749aef3c2f9dcd6798b802fe118b8a7
BLAKE2b-256 2d0c471d54ba476943d645dcec0a1e4532ef678ad87bb589351c590dd46109f8

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