πŸ›‘οΈ EnvShield

Your .env File,
But It's a Contract.

One schema describes every variable your app needs β€” its type, whether it's secret, when it's required. EnvShield uses it to onboard new developers, catch drift before production, generate typed config code, and validate the deployment manifest that actually ships it. Free, open source, and it never leaves your machine.

pip install envshield
EnvShield compiling env.schema.toml into a typed, secret-masked TypeScript config module

Configuration as a Contract

.env.example drifts out of date. Nobody's sure which variables are secret. A new hire spends their first afternoon guessing. Config that works locally breaks in staging because nobody told the worker service about the new API key. EnvShield fixes this with one schema β€” and it scales to a monorepo with a dozen services just as well as it works for one.

🧬 Real Types, Not Just Strings

Declare type = "port", an enum, a regex pattern, or a conditional requiredIf on any variable. check/doctor/setup enforce it; a typo'd log level or an out-of-range port gets caught before you run the app.

πŸ“¦ Validates Your Deployment, Not Just Your Laptop

envshield check reads a docker-compose file or a Kubernetes manifest directly β€” the config that actually ships, checked the same way your local .env is.

πŸ”— Scales to a Monorepo

One env.schema.toml per service, one envshield.yml tying them together, and extends for variables every service shares. envshield service discover finds every service and seeds all their schemas in one command.

⚑ Onboarding That Knows What's Missing

New dev runs envshield setup. Prompted with descriptions, secrets hidden, enum fields shown as a picker. It tells you exactly which variables you need and which are secret β€” you still get the actual secret values from your team the way you always have.

🩺 Prevents Drift

envshield doctor catches config mismatches β€” including in your deployment manifest, if one's registered β€” before they reach production. envshield check makes a solid CI gate.

βš™οΈ Typed Config Code

Generate real Python (pydantic) or TypeScript (zod) code straight from your schema. Type-safe, validated on startup, secrets masked by construction, not convention.

πŸ” Diff-Aware Secret Scanning

Pre-commit hook scans only newly-added lines in excluded files. Allows intentional baseline secrets while catching real ones. Line-level, positional diff β€” not a text-content guess.

πŸ”„ Git Hooks That Behave

Installed with one prompt, never repeated. Respects a configured core.hooksPath (e.g. Husky) instead of assuming .git/hooks. Overwriting always tells you what would be lost first.

πŸ“š Fresh Documentation

envshield schema sync regenerates .env.example from schema. One source of truth. Documentation never rots.

A Secure Foundation, From First Commit to Production

EnvShield transforms your most painful workflows into a secure, automated process.

πŸ—οΈ Bootstrap a Secure Project in Seconds

Run `envshield init` in a new or existing project. EnvShield intelligently detects your framework (Next.js, Django, Flask) and scaffolds a complete, best-practice foundation: a schema, a `.gitignore` update, and an automated security hook, all in one command.

envshield init
EnvShield initializing a new project
$ envshield service discover

                     Discovered Services
┏━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name   ┃ Directory      ┃ Format ┃ Config File           ┃
┑━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ api    β”‚ services/api   β”‚ dotenv β”‚ (default .env)        β”‚
β”‚ web    β”‚ services/web   β”‚ dotenv β”‚ (default .env)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
? Add these services to envshield.yml? Yes
βœ“ Registered api β†’ services/api/env.schema.toml
βœ“ Registered web β†’ services/web/env.schema.toml

✨ Added 2 service(s) to envshield.yml.

πŸ”­ Already Have Multiple Services? Find Them All At Once

envshield init sets up one schema for one service. In a monorepo, run envshield service discover instead: it scans for every service with its own real config β€” a dotenv file or a recognizable Python config module β€” registers each one, and seeds its schema from its actual current values. Run it again later and it only picks up what's new, leaving already-configured services untouched.

envshield service discover

How EnvShield Compares

EnvShield isn't trying to replace any of these β€” it's the schema/contract/codegen layer that sits alongside whichever you already use.

EnvShield Gitleaks dotenvx Doppler / Infisical
Schema-driven validation (types, enums, conditional requirements) βœ… ❌ ❌ ❌
Multi-service schemas, with shared/composed definitions βœ… ❌ ❌ Partial (multi-environment, not a documented shared contract)
Typed config code generation βœ… ❌ ❌ ❌
Validates deployment manifests (compose, Kubernetes) βœ… ❌ ❌ ❌
Interactive onboarding βœ… ❌ ❌ βœ… (hosted)
Secret detection depth/accuracy ⚠️ Good enough for most teams βœ… Best in class, actively maintained βœ… Varies by plan
Syncs real secret values across a team ❌ (never touches real values) ❌ Encrypts values in the file βœ…
Works fully offline βœ… Always βœ… βœ… Depends on plan/self-hosting

The honest version: if raw secret-detection accuracy matters most to you, run Gitleaks alongside EnvShield rather than relying on scan alone. If syncing real secret values across a team is what you need, Doppler/Infisical do that and EnvShield deliberately doesn't. What EnvShield does that none of these do: one schema, in your own repo, that's a validation contract, a codegen input, and something your deployment manifests get checked against.

Everything You Need

Comprehensive commands for schema management, validation, code generation, secret scanning, and onboarding. Works with single-service or multi-service projects.

πŸ—οΈ `init` - The Architect

Scaffolds a new project with a schema, config, and security hook in one command.

🚚 `import` - The Migrator

Converts a messy, existing `.env` file into a clean `env.schema.toml`, inferring each variable's type where the value's shape is unambiguous.

πŸ”­ `service discover` - The Scout

Finds every service in a monorepo, registers them, and seeds each schema from its real config β€” one command instead of hand-writing envshield.yml and importing each service one by one.

πŸ’ͺ `scan` - The Bouncer

Scans for hardcoded secrets and undeclared variables used in your code, preventing leaks.

πŸ“š `schema sync` - The Librarian

Auto-generates a perfect `.env.example` from your schema, keeping documentation in sync.

πŸͺ„ `setup` - The Assistant

An interactive wizard to help new developers create their local `.env` file in minutes.

βœ… `check` - The Validator

Validates your local `.env` β€” or your docker-compose file, or a Kubernetes manifest β€” against the schema, catching type mismatches, typos, and missing variables.

🩺 `doctor` - The Medic

Runs a full health check on your setup and provides interactive fixes with the `--fix` flag.

🧬 `generate` - The Compiler

Compiles your schema into a typed, validated `pydantic-settings` or `zod` config module β€” auto-detected for your stack, or set with `--lang`.

πŸ›‘ `install-hook` - The Guardian

Installs a Git pre-commit hook that automatically runs secret scanning before each commit. Prevents secrets from ever reaching your repository.

Why EnvShield?

Three different jobs. Pick based on which one is actually yours β€” or use more than one together.

Developer Pain Point πŸ›‘οΈ EnvShield TruffleHog / Gitleaks Doppler / Infisical
Detecting Secrets in Commits ⚠️ Built-in hook, good enough for most teams βœ… Core feature, best-in-class detection ❌ Not their job β€” they store secrets, they don't scan commits for them
Validating Deployment Manifests βœ… `check` reads compose/Kubernetes files directly ❌ Not addressed ❌ Not addressed
Migrating Existing Projects βœ… `import` command ❌ Not addressed ❌ Not addressed
New Developer Setup βœ… `setup` command, works offline ❌ Not addressed βœ… Hosted dashboard
Handling Config Drift βœ… Solved via schema (`doctor`/`check`) ❌ Not addressed βœ… Solved via cloud sync
Typed, Validated Config Code βœ… `generate` (Python & TypeScript) ❌ Not addressed ❌ Not addressed
Syncing Real Secret Values Across a Team ❌ Not addressed β€” see the Roadmap ❌ Not addressed βœ… Their whole job
Primary Focus Schema, Validation & Codegen Secret Detection Engine Cloud-Based Secret Vault

Works With Your Stack

Python TypeScript Node.js Next.js Django Flask

Is This For You?

Probably yes if you have more than a couple of environment variables, more than one person touching the project, or more than one environment (dev/staging/prod) β€” that's when a plain .env file starts drifting.

Probably not yet if you need to distribute real secret values to a team securely right now β€” EnvShield doesn't do that (see the Roadmap) β€” Doppler or Infisical's free tiers solve that today. And if raw secret-detection accuracy is your top priority, pair EnvShield's scanner with Gitleaks rather than relying on it alone.

What's Being Explored Next

Everything on this page is free today and stays that way β€” nothing here moves behind a paywall later. What's below has no committed timeline; it's driven by what real projects actually ask for.

Team Coordination

  • Environment Profiles: dev/staging/prod overrides on one schema.
  • Team Secret Sharing: a hosted way to share real secret values across a team β€” the one thing EnvShield is explicit about not doing today.
  • Schema Diffing: see exactly what changed between environments.

Deeper Integrations

  • Cross-Repo Schema Sharing: today's `extends` is local-path-only, within one project.
  • Secret Manager Integrations: pull real values from Vault/AWS/GCP Secrets Manager for local `setup`/`check`, without EnvShield ever storing them.
  • CI/CD Templates: ready-made pipeline steps beyond the README's example.

Have a real project that needs one of these sooner? Open a discussion β€” that's what actually decides the order.