
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
easyenvguard
Advanced tools
Developers often forget to define required environment variables (.env files). This package will automatically validates required environment variables on startup (Now supports TS).
EasyEnvGuard is a lightweight and easy-to-use environment variable validator for Node.js applications. It ensures that required environment variables are defined and have the correct data types, preventing runtime errors due to missing or incorrectly formatted variables.
Built with simplicity and reliability in mind, EasyEnvGuard is an essential tool for developers looking to enhance the robustness of their applications.
string, number, boolean).require) and ES Modules (import)..env files.Install EasyEnvGuard using npm:
npm install easyenvguard
Or with yarn:
yarn add easyenvguard
.env file (if using dotenv)PORT=3000
DATABASE_URL=mongodb://localhost:27017
JWT_SECRET=mysecret
DEBUG_MODE=true
easyenvguard in your Node.js projectrequire) Usersrequire("dotenv").config(); // Load .env file
const { validateEnv } = require("easyenvguard");
validateEnv({
PORT: "number",
DATABASE_URL: "string",
JWT_SECRET: "string",
DEBUG_MODE: "boolean",
});
console.log("✅ All required environment variables are valid!");
import) Usersimport "dotenv/config"; // Load .env file
import { validateEnv } from "easyenvguard";
validateEnv({
PORT: "number",
DATABASE_URL: "string",
JWT_SECRET: "string",
DEBUG_MODE: "boolean",
});
console.log("✅ All required environment variables are valid!");
| Expected Type | Accepted Values Example |
|---|---|
string | Any text ("example") |
number | Numeric values (3000, 42) |
boolean | true or false (as strings) |
If an environment variable is missing or has the wrong type, EasyEnvGuard will throw an error:
EnvGuardError: Missing required environment variable: JWT_SECRET
EnvGuardError: Invalid type for PORT. Expected number, but got string.
.env.example files: Maintain a template of required environment variables for better collaboration.dotenv or environment managers to manage environment variables across different stages (development, staging, production).| Node.js Version | Support |
|---|---|
| 18.x+ | ✅ Fully Supported |
| 16.x | ✅ Fully Supported |
| 14.x | ⚠️ Limited Support (End-of-Life soon) |
| < 14.x | ❌ Not Supported |
MIT License. Feel free to use and contribute!
Contributions are welcome! If you have ideas for improvements, submit an issue or a PR.
feature-branch).git commit -m "Added a new feature").⭐ Star this repo if you find it useful! 🚀
FAQs
Developers often forget to define required environment variables (.env files). This package will automatically validates required environment variables on startup (Now supports TS).
We found that easyenvguard demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.