env-must-exist
v0.1.0
Published
A short, honest description of what this package does.
Maintainers
Readme
env-must-exist
Assert that environment variables are present. Fail fast in CI.
Problem: You deploy to production, but forgot to add DATABASE_URL to the dashboard. Your app crashes silently or in a weird way 5 minutes later.
Solution: Add a pre-flight check script. If the var is missing, the deploy fails immediately with a clear error.
Install
npm install env-must-existUsage
CLI (Recommended for CI)
Add this to your build or start script:
{
"scripts": {
"build": "env-must-exist DATABASE_URL STRIPE_KEY && next build"
}
}If STRIPE_KEY is missing, you get:
❌ Missing required environment variables:
- STRIPE_KEYAPI
import { assertEnv } from 'env-must-exist';
assertEnv(['DATABASE_URL', 'API_KEY']);License
MIT
{ github.com/mgks }
![]()
