How many times have you deployed to production only to get a runtime crash because process.env.DATABASE_URL was undefined? ultraenv eliminates that entire class of bug.
What is ultraenv?
A TypeScript-first environment variable manager that validates all your env vars at application startup.
npm install ultraenv
bun add ultraenv
The Problem
// Without ultraenv - crashes at runtime in production!
const db = new Database(process.env.DATABASE_URL); // Could be undefined!
The Solution
import { defineEnv } from 'ultraenv';
const env = defineEnv({
DATABASE_URL: { type: 'string', required: true },
PORT: { type: 'number', default: 3000 },
NODE_ENV: { type: 'enum', values: ['development', 'production', 'test'] },
API_SECRET: { type: 'string', required: true, secret: true }
});
// All vars are fully typed and guaranteed!
const db = new Database(env.DATABASE_URL); // string!
const port = env.PORT; // number!
Features
- Startup validation with clear error messages
- Automatic type coercion (string to number/boolean)
- Secret masking in logs
- Zero dependencies
- Works with Node.js, Bun, Deno, Docker, Vercel
GitHub: https://github.com/Avinashvelu03/ultraenv
What's your biggest env var horror story? Share below!
Top comments (0)