v1.0.0 — Type-Safe Environment Variables for TypeScript
Ctrotech
release
v1.0.0 — Type-Safe Environment Variables for TypeScript
CtroEnv v1.0.0 is live — a TypeScript-first environment variable management toolkit with zero runtime dependencies.
What is CtroEnv?
Define, validate, and infer types for environment variables. 4 KB gzipped, zero dependencies, full TypeScript inference, no code generation step.
Why Another Env Library?
Existing solutions have tradeoffs:
- dotenv: Loads
.envfiles but provides no validation or type safety - t3-env: Great pattern but requires Zod (50 KB+ dependency)
- envalid: Solid but lacks TypeScript-native inference
CtroEnv is built from scratch with zero dependencies, native TypeScript inference, and errors grouped by category with actionable suggestions.
What's Included
| Package | Description |
|---|---|
@ctroenv/core | Schema engine with validators and type inference |
@ctroenv/shared | Internal shared utilities |
@ctroenv/cli | CLI tooling (validate, generate, check, docs, init) |
@ctroenv/node | Node.js .env file loading |
@ctroenv/vite | Vite build-time validation plugin |
@ctroenv/nextjs | Next.js client/server env splitting |
Example
import { defineEnv, string, number, pick } from "@ctroenv/core"
const env = defineEnv({
DATABASE_URL: string().url(),
PORT: number().port().default(3000),
NODE_ENV: pick(["dev", "staging", "prod"]),
JWT_SECRET: string().secret().min(32),
})Get Started
npm install @ctroenv/coreDocumentation: ctroenv.vercel.app GitHub: github.com/ctrotech-tutor/ctroenv