Skip to main content

EnvShield 🛡️ – The Environment Contract CLI for Python & TypeScript

CI PyPI version License: MIT Downloads Website Stars

EnvShield turns env.schema.toml into your project's Environment Contract — one schema that generates your docs, validates every local setup, and compiles into typed, secret-masked config code for Python or TypeScript. It's your caffeine-proof way to avoid the "oops, I just leaked prod keys" nightmare.

📚 Full Documentation

Table of Contents

  1. Why Secure Environment Management Matters

  2. Key Features of the EnvShield CLI

  3. Installation

  4. The EnvShield Philosophy: Schema-First Configuration

  5. CLI Commands

  6. Competitor Comparison: Choosing the Right Tool

  7. The Brains of the Operation: The Core Files

  8. Future Roadmap: Teams & Enterprise

  9. Community & Support

  10. TL;DR

Why Secure Environment Management Matters

Managing .env files by copy-pasting them around like a hot potato is fun… until a secret lands in a public repo, or os.getenv("MAX_RETIRES") (typo and all) silently returns None in production. EnvShield solves the “dotenv dumpster fire” by giving you a single Environment Contractenv.schema.toml — that generates your documentation, validates every local setup, compiles into typed config code, and blocks secrets before they're ever committed. All wrapped in a workflow lazy enough for a 3 a.m. commit.

Key Features of the EnvShield CLI

Demo of EnvShield scanning secrets

  • One Environment Contractenv.schema.toml becomes the single source of truth every other command reads from.

  • Typed Config Generationenvshield generate compiles your schema into real, importable pydantic-settings (Python) or zod (TypeScript) code — secrets are masked by default (SecretStr / Secret<T>), everything else is a validated, correctly-typed value instead of a raw string.

  • Open-Source Secret Scanner – Detects API keys, private keys, and other credentials before you push.

  • Local Development Workflow – Automatic .env.example syncing and onboarding that even future-you will thank you for.

  • Git Pre-commit Hook – Blocks secret leaks faster than you can say git push --force.

  • Configuration as Code – Your environment config is version-controlled and documented like real code.

(Translation: EnvShield is that overprotective friend who checks the door lock five times so you can sleep.)

Installation

Requires Python 3.10+.

pip install envshield
envshield --help

Done. Your project is now 72 % less combustible.

The EnvShield Philosophy: Schema-First Configuration

EnvShield's power comes from a simple idea: your configuration should be treated like code. It introduces a single source of truth, the env.schema.toml file.

This file is a "configuration contract" that explicitly defines every environment variable your project needs. By defining your variables here, you get:

  • Automated Documentation: Your .env.example is always perfectly in sync with your schema.
  • Ironclad Validation: Catch typos and missing variables before you even run your app.
  • Proactive Security: A built-in scanner and Git hook prevent secrets from ever being committed.

CLI Commands

Command Purpose Demo
envshield init Auto-detects framework, creates env.schema.toml, installs the Git hook. Demo of EnvShield init
envshield scan Scans files or staged commits for secrets. Demo of EnvShield scan
envshield install-hook Manually install or update the Git pre-commit hook. For when you skipped step one because YOLO.
envshield check <file> Validates a local .env file against the schema. Demo of EnvShield check
envshield schema sync Regenerates .env.example from the schema. Demo of EnvShield sync
envshield setup Interactive onboarding to create a local env. Demo of EnvShield setup
envshield doctor Runs a full health check (and can auto-fix). Demo of EnvShield check
envshield import <file> Intelligently converts an existing .env file into a new env.schema.toml. The fastest way to adopt EnvShield for an existing project.
envshield generate Compiles your schema into a typed, validated config module — pydantic-settings (Python) or zod (TypeScript), auto-detected or set via --lang. Turns the contract into the actual code your app imports.

Competitor Comparison: Choosing the Right Tool

A scanner is a smoke detector. A cloud vault is an off-site bank. EnvShield is the fireproof, self-organizing house you should have been living in all along. It provides the complete local workflow that developers need to prevent secret leaks in the first place.

Developer Pain Point EnvShield 🛡️ TruffleHog / Gitleaks Doppler / Infisical direnv
Preventing Secret Commits Built-in. init sets up an automated pre-commit hook. Core feature. Specialized tools for just finding secrets. Indirectly. Doesn't actively scan commits. Not addressed.
Migrating Existing Projects ✅ One-command import. import command auto-generates a schema from an existing .env file. ❌ Not addressed. ❌ Not addressed. (They manage, but don't import your old files) ❌ Not addressed.
Streamlining Developer Onboarding Automated. The setup command interactively creates a local .env file from the project's template. Not addressed. Strong. Provides a central place to get secrets, but doesn't manage local files. Not addressed.
Preventing Configuration Drift Solved. The schema is the source of truth. schema sync and check enforce consistency. Not addressed. Solved. The cloud is the single source of truth. Not addressed.
Typed, Validated Config Code generate. Compiles your schema straight into pydantic-settings (Python) or zod (TypeScript), with secrets masked by default. Not addressed. Not addressed. (SDKs fetch secrets; they don't generate a typed module from a governed schema.) Not addressed.
Primary Focus Complete Local Workflow. Manages files, documents schemas, validates setups, scans for leaks, and generates typed code. Secret Detection Engine. Cloud-Based Secret Vault. Shell Environment Automation.

Think of scanners as smoke detectors and cloud vaults as off-site banks. EnvShield is the fire-proof, self-organizing house you should have been living in all along.

The Brains of the Operation: The Core Files

envshield is managed by two simple files you commit to your repository.

  • env.schema.toml: The source of truth. This is where you define every variable your project needs.
    # env.schema.toml

    [DATABASE_URL]
    description = "The full connection string for the PostgreSQL database."
    secret = true # Marks this as sensitive

    [LOG_LEVEL]
    description = "Controls the application's log verbosity."
    secret = false
    defaultValue = "info" # Provides a fallback
  • envshield.yml: The workflow config. In Phase 1, it's very simple and mainly points to your schema and defines scanner exclusions.

Future Roadmap: Teams & Enterprise✨

Phase 1 is the free, powerful "Local Guardian." But the journey doesn't end there. Upcoming paid tiers will turn envshield into a complete collaboration and automation platform.

Phase 2: The Team Collaborator (Paid Tier)

  • envshield use <profile>: Instantly switch your entire project's configuration between different environments (e.g., local, staging).

  • envshield onboard <profile>: A supercharged setup that can also run scripts like docker compose up and database migrations for a true one-command setup.

  • envshield share: Securely share a secret with a teammate via an encrypted, one-time-use link.

  • envshield docs: Generate beautiful Markdown or HTML documentation from your schema.

Phase 3: The Enterprise-Grade System (Paid Tier)

  • envshield login, pull, push: Full integration with a centralized, cloud-based secret vault.

  • envshield export: Securely inject secrets into your CI/CD pipelines for automated deployments.

  • Audit Logs & RBAC: A complete, compliant, and auditable history of all secret access and team permissions, managed through a web dashboard.

Community & Support

Got questions? Have a brilliant idea? Come hang out with us!

  • 🤔 Ask a question on GitHub Discussions:Discussions

Or, Follow us on our socials:

🌍 Community & Links

Contributing (Don't Be Shy)

Spotted a bug? Think our jokes are terrible? We want to hear it all. Check out CONTRIBUTING.md to get started.

TL;DR

EnvShield = one Environment Contract that gives you docs, validation, secret scanning, and typed Python/TypeScript config code — plus just enough sarcasm to keep you awake. Stop leaking secrets. Start shipping securely.

Download files

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

Source Distribution

envshield-3.1.0.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

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

envshield-3.1.0-py3-none-any.whl (45.7 kB view details)

Uploaded Python 3

File details

Details for the file envshield-3.1.0.tar.gz.

File metadata

  • Download URL: envshield-3.1.0.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for envshield-3.1.0.tar.gz
Algorithm Hash digest
SHA256 dfa89a6d8e39f56681db1e0744fc7b8a2da1dfd0e52e8738a1b00d998027fb58
MD5 1f62f16693a355f8184dd03009420839
BLAKE2b-256 6e3765b57c016168cc59368c845a92b4cd595900454a325ce057bc065b89040e

See more details on using hashes here.

File details

Details for the file envshield-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: envshield-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for envshield-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dcb34abd37721c0b94cc7847d30016b4d32583408e6456bea11af9d0af14e735
MD5 f2fbd460ee3bd5b6b1f18d4a6dda6564
BLAKE2b-256 94f78a8afd8791b4df1df834e99d1ac02def4edeb0235c74fcfa3ae8043bf421

See more details on using hashes here.

Release history Release notifications | RSS feed

4.7.1

2 files

4.7.0

2 files

4.6.2

2 files

4.6.1

2 files

4.6.0

2 files

4.5.1

2 files

4.5.0

2 files

4.4.0

2 files

4.3.0

2 files

4.2.0

2 files

4.1.0

2 files

4.0.1

2 files

4.0.0

2 files

3.1.1

2 files

This release

3.1.0 This release

2 files

3.0.0

2 files

2.1.0

2 files

2.0.1

2 files

2.0.0

2 files

1.4.0

2 files

1.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page