{"repo":"af/envalid","free":true,"listed":false,"github":"https://github.com/af/envalid","clone":"git clone https://github.com/af/envalid.git","description":"Environment variable validation for Node, Bun, and other compatible JS runtimes","language":"TypeScript","stars":1583,"topics":["node","nodejs","environment","validation","javascript","bun"],"license":"MIT","category":"machine-learning","readme_excerpt":"Envalid is a small library for validating and accessing environment variables in Node.js programs Envalid is a small library for validating and accessing environment variables in Node.js programs, aiming to: - Ensure that your program only runs when all of its environment dependencies are met - Give you executable documentation about the environment your program expects to run in - Give you an immutable API for your environment variables, so they don't change from under you while the program is running Why Envalid? - Type-safe: written completely in TypeScript, with great support for inference - Light: no dependencies! - Modular: customize behavior with custom validators, middleware, and reporters API envalid.cleanEnv(environment, validators, options) cleanEnv() returns a sanitized, immutable environment object, and accepts three positional arguments: - environment - An object containing your env vars (eg. process.env ) - validators - An object that specifies the format of required vars. - options - An (optional) object, which supports the following key: - reporter - Pass in a function to override the default error handling and console output. See src/reporter.ts for the default implementation. By default, cleanEnv() will log an error message and exit (in Node) or throw (in browser) if any required env vars are missing or invalid. You can override this behavior by writing your own reporter. For an example you can play with, clone this repo and see the example/ directory. Vali","default_branch":null,"files":null,"tree":[],"storefront":"/r/af","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/af/envalid/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}