Skip to content

BimeBazar/envyup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

envyup

Safe environment variable validation without surprises.

envyup helps you load, expand, and validate environment variables with a Yup schema. It works as both a library and a CLI, so you can enforce config correctness in local development, CI, and production startup flows.

Why envyup

  • Validate environment variables with familiar Yup schemas
  • Load from process.env and optional dotenv files
  • Expand ${VAR_NAME} references automatically
  • Use in code (checkEnv) or from terminal (envyup)
  • Fail fast with clear validation output

Install

npm install -D envyup yup

Quick Usage

Create a envyup.config.ts and export the yup schema:

// envyup.config.ts
import * as yup from "yup";

export default {
  schema: {
    NODE_ENV: yup
      .string()
      .oneOf(["development", "test", "production"])
      .required(),
    PORT: yup
      .number()
      .transform((value) => (Number.isNaN(value) ? undefined : value))
      .required(),
    BASE_URL: yup.string().url().required(),
  },
};
// package.json
  "dev": "envyup && other_command"

CLI Usage

The package exposes the envyup command:

envyup [--config <path>] [--dotenv <path>]

Defaults:

  • --config: envyup.config.ts
  • --dotenv: selected by NODE_ENV:
    • test -> .env.test
    • production -> .env
    • otherwise -> .env.local if present, else .env

License

MIT

About

Safe environment variable validation without surprises

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors