dmno-dev /varlock
AI-safe .env files: Schemas for agents, Secrets for humans.
★ 4,969⑂ 144👁 10⑃ 994● 282▤ 496
+6
日增长
4,969
stars
144
forks
10
watchers
994
prs
282
issues
496
releases
README
Varlock
AI-safe .env files: Schemas for agents, Secrets for humans.
- 🤖 AI-safe config — agents read your schema, never your secrets
- 🔍 proactive leak scanning via varlock scan + git hooks
- 🔏 runtime protection — log redaction and leak prevention
- 🛡️ validation, coercion, type safety w/ IntelliSense
- 🌐 flexible multi-environment management — auto .env. loading and explicit import
- 🔌 plugins to pull data from various backends (1Password, Infisical, AWS, Azure, GCP, HCP Vault, more!)
Unlike .env.example, your .env.schema is a single source of truth, built for collaboration, that will never be out of sync.
bash
@defaultSensitive=false @defaultRequired=infer @currentEnv=$APP_ENV
---
our environment flag, will control automatic loading of .env.xxx files
@type=enum(development, preview, production, test)
APP_ENV=development default value, can override
@type=port
API_PORT=8080 non-sensitive values can be set directly
API url including _expansion_ referencing another env var
@type=url
API_URL=http://localhost:${API_PORT}
sensitive api key, with extra validation
@required @sensitive @type=string(startsWith=sk-)
OPENAI_API_KEY=
Flexible plugin system: adds new decorators, functions, types - enables secure declarative secret loading.
bash
@plugin(@varlock/1password-plugin)
@initOp(token=$OP_TOKEN, allowAppAuth=forEnv(dev), account=acmeco)
---
@type=opServiceAccountToken @sensitive
OP_TOKEN=
Fetch secrets using 1Password secret references
DB_PASS=op(op://my-vault/database-password/password)
API_KEY=op(op://api-vault/stripe/api-key)
Installation
You can get started with varlock by installing the CLI:
bash
Run the installation wizard, which will install as a dependency in a JavaScript project
npx varlock init
Or install as standalone binary
brew install dmno-dev/tap/varlock via homebrew
curl -sSfL https://varlock.dev/install.sh | sh -s via cURL
Or use the official Docker image
docker pull ghcr.io/dmno-dev/varlock:latest
See the full installation docs or the Docker guide for more information.
Workflow
Validate your .env.schema and pretty print your environment variables with:
bash
varlock load
If you need to pass resolved env vars into another process, you can run:
bash
varlock run -- python script.py
In many cases you can use our drop-in integrations for seamless experience - with additional security guardrails, like log redaction and leak prevention.
AI-Safe Config
Your .env.schema gives AI agents full context on your config — variable names, types, validation rules, descriptions — without ever exposing secret values. Combined with varlock scan to catch leaked secrets in AI-generated code, varlock is purpose-built for the AI era. Learn more in the AI-safe config guide.
@env-spec
Varlock is built on top of @env-spec, a new DSL for attaching a schema and additional functionality to .env files using JSDoc style comments. The @env-spec package contains a parser and info about the spec itself.
- @env-sTop issues
#819[BUG]: varlockEnclave cannot read secrets created in keystore via secrets CLI16 comments · 2026-06-22#345[Feature Request] age encryption11 comments · 2026-03-09#359[Feature Request] Support for Laravel Framework?10 comments · 2026-03-10#1096[Feature Request] Extend @optional decorator with groups8 comments · 2026-09-17#833[Feature Request] Cloud Compute Defined Environment Variables8 comments · 2026-06-24#1254[Feature Request] server-only environment variables should not be sent to client6 comments · 2026-10-28#1071Single-binary / distroless deployments: document `load()` or ship a glibc build6 comments · 2026-09-06#469[Feature Request] Full built-in `.env.schema` parity in the VS Code extension6 comments · 2026-03-23
Discussions
#1272Make the local-encryption daemon inactivity timeout configurable1 comments · 2026-11-03#1102Is the local plugin authoring API (varlock/plugin-lib) stable?1 comments · 2026-09-18#1070Help me understand encryption1 comments · 2026-09-06#1041How can I access an environment variable in package.json when using varlock?1 comments · 2026-08-27#751Recommended approach for claude code "agents view"?1 comments · 2026-06-05#642Add @deprecated decorator2 comments · 2026-04-22#611InitVarlockEnv failed on vite & cloudflare integration2 comments · 2026-04-14#579Unintuitive: $VARLOCK_IS_CI is not boolean4 comments · 2026-04-10
Latest release
@varlock/proton-pass-plugin v2.0.3 @varlock/[email protected] 2026-11-13- 1271 (patch) Fix CLI calls occasionally losing stdout/stderr when the command exits quickly under load, which could surface as a vague "unknown" error instead of the real one Published to - ✅ npm