crabenv
The simplest, opinionated way to keep .env files, schemas, and examples aligned.
crabenv is an opinionated, language-agnostic CLI that keeps your environment variables aligned across schema, template, and local files. No new config file required. It validates, copies, and checks for drift so your team doesn't have to.
This project will once and for all solve environment variables typesafe schema definition and documentation so it will never drift. This CLI only does what you can already do manually. It doesn't introduce any new config files so if your team doesn't want to use crabenv, it'll be completely fine!
Installation
|
📁 Languages supported:
- TypeScript/Javascript and Monorepos (includes React, Solid, Vue, Svelte, Vite, NextJS, ReactNative, Backends, and Cloudflare apps)
- Python
- Rust
- Flutter
- More? Request an adapter.
🤒 Pains solved:
- CRUD and Documentation drift
- Deployment/sink drift via explicit managed blocks, not arbitrary file inference
-
.env.exampleandenv.tsdrift - Validation
- Client and Server Boundaries
- Local Development (creating the first .env) to Actual Deployment (translating that into the env on deployment) stories
- A better
cp .env.example .envcommand (This is not enough!) Creating envs (local env or for new dev,staging,prod envs).- Use templating patterns like
"RSA_KEY=$(openssl rand -base64 32)- the crabenv copy
- Use templating patterns like
-
Rotating??Kinda impossible actually. - Cloudflare
.dev.varsguidance/docs
Philosophy
- No new config file. Your team doesn't have to install crabenv, but it helps a lot! The CLI just abstracts the manual maintenance.
- Env config is synced across surfaces:
-
- Schema - The validator language-specific schema. Multiple based on apps. i.e.
env.ts,env.private.ts,env.public.ts,config.rs,config.dart.
- Schema - The validator language-specific schema. Multiple based on apps. i.e.
-
- Template (
.env.example) - Safe example/template values for env values. Multiple based on apps.
- Template (
-
- Local (
.env) - The actual local runtime values/secrets. 1 only.
- Local (
-
- Sinks - Reserved for future explicit integrations. crabenv does not currently infer or rewrite arbitrary deployment files.
- More? Make an adapter
-
- Packages in monorepos don't have .env.
Agent skill
Install the crabenv skill for coding agents with:
This installs the crabenv agent skill from skills/crabenv, including language-specific references for TypeScript/JavaScript, Python, Rust, and Flutter/Dart.
Usage
# CRUD
# Type flags
# Custom regex
# ... essentially a cli version of zod
# Special environment overrides
} } } }
Current CLI
This repo currently has a first Rust CLI implementation that works against the sample projects in _checks/sample-projects.