https://github.com/mgks/env-must-exist
CLI to assert that environment variables are present. Fails fast in CI/CD if missing.
https://github.com/mgks/env-must-exist
automation ci cli failsafe nodejs npm
Last synced: 5 months ago
JSON representation
CLI to assert that environment variables are present. Fails fast in CI/CD if missing.
- Host: GitHub
- URL: https://github.com/mgks/env-must-exist
- Owner: mgks
- License: mit
- Created: 2025-12-28T09:10:29.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-12-30T08:25:40.000Z (6 months ago)
- Last Synced: 2025-12-30T18:48:37.218Z (6 months ago)
- Topics: automation, ci, cli, failsafe, nodejs, npm
- Language: JavaScript
- Homepage:
- Size: 135 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# env-must-exist
**Assert that environment variables are present. Fail fast in CI.**
A tiny pre-flight check that stops broken deploys before they happen. It verifies required environment variables like `DATABASE_URL` at deploy time and fails fast with a clear error if anything is missing, instead of letting your app crash later in production in confusing ways.
## Installation
```bash
npm install env-must-exist
```
## Usage
### CLI (Recommended for CI)
Add this to your build or start script:
```bash
{
"scripts": {
"build": "env-must-exist DATABASE_URL STRIPE_KEY && next build"
}
}
```
If `STRIPE_KEY` is missing, you get:
```bash
❌ Missing required environment variables:
- STRIPE_KEY
```
### API
```js
import { assertEnv } from 'env-must-exist';
assertEnv(['DATABASE_URL', 'API_KEY']);
```
## License
MIT
> **{ github.com/mgks }**
>
>  