{"id":44661860,"url":"https://github.com/depthbomb/env","last_synced_at":"2026-02-14T23:27:39.845Z","repository":{"id":325374911,"uuid":"1100958531","full_name":"depthbomb/env","owner":"depthbomb","description":"A .env validator for Bun heavily inspired by @adonisjs/env with some added validators.","archived":false,"fork":false,"pushed_at":"2025-12-03T21:00:15.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-07T02:44:41.449Z","etag":null,"topics":["bun","dotenv","env","environment-variables","validation","validator"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/depthbomb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-21T01:57:57.000Z","updated_at":"2025-12-03T21:00:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/depthbomb/env","commit_stats":null,"previous_names":["depthbomb/env"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/depthbomb/env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depthbomb%2Fenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depthbomb%2Fenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depthbomb%2Fenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depthbomb%2Fenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/depthbomb","download_url":"https://codeload.github.com/depthbomb/env/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depthbomb%2Fenv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29457931,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T21:29:27.764Z","status":"ssl_error","status_checked_at":"2026-02-14T21:28:11.111Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bun","dotenv","env","environment-variables","validation","validator"],"created_at":"2026-02-14T23:27:39.274Z","updated_at":"2026-02-14T23:27:39.830Z","avatar_url":"https://github.com/depthbomb.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @depthbomb/env\n\nA .env validator for Bun\u003csup\u003e†\u003c/sup\u003e heavily inspired by [@adonisjs/env](https://github.com/adonisjs/env) with some added validators.\n\n## Installation\n\n```sh\nbun add @depthbomb/env\n```\n\n## Example/Usage\n\n```shell\nTEST1=1\nTEST2=hello\nTEST3=true\nTEST4=00000000-0000-0000-0000-000000000000\nTEST5=217188c7-30e9-4f89-8355-0427832955ea\nTEST6={\"a\":1}\nTEST7=[{\"a\":1},{\"a\":2}]\nTEST8=[\"1\",2,\"3\"]\n#TEST9=...\nTEST10=coffeescript\nTEST11=typescript, javascript, bun\nTEST12=5m\nTEST13=64MB\nTEST14=package.json\nTEST15=SGVsbG8gd29ybGQ=\nTEST16=2026-01-15T12:00:00Z\nTEST17=Str0ngSecret1!\n```\n\n```ts\nimport { Env, UUIDVersion } from '@depthbomb/env';\n\nconst env = Env.create({\n\t/**\n\t * Disallows floats\n\t *\n\t * Also available is `Env.schema.number()` and `Env.schema.float()`\n\t */\n\tTEST1: Env.schema.int(),\n\t/**\n\t * Simple strings, supports `pattern`, `minLength`, `maxLength`, and `trim` options\n\t */\n\tTEST2: Env.schema.string(),\n\t/**\n\t * Validates truthy values as well such as `1`, `0`, `yes`, `no`, `y`, `n`, `on, `off`, `enabled`, and `disabled`\n\t */\n\tTEST3: Env.schema.boolean(),\n\t/**\n\t * Generic and UUIDv4 validation\n\t */\n\tTEST4: Env.schema.uuid(),\n\tTEST5: Env.schema.uuid({ version: UUIDVersion.V4 }),\n\t/**\n\t * Specify the shape of the JSON object\n\t */\n\tTEST6: Env.schema.json\u003c{ a: number; }\u003e(),\n\t/**\n\t * Arrays are written as JSON arrays, including double quotes for keys and string values\n\t *\n\t * Array items value type are inferred from the inner schema or can be defined as a type argument\n\t */\n\tTEST7: Env.schema.array(Env.schema.json\u003c{ a: number; }\u003e()),\n\tTEST8: Env.schema.array(Env.schema.string()),\n\t/**\n\t * All variables are required by default\n\t */\n\tTEST9: Env.schema.string({ required: false }),\n\t/**\n\t * Predefined values\n\t */\n\tTEST10: Env.schema.enum(['typescript', 'javascript']),\n\t/**\n\t * Delimited lists (defaults to comma separator)\n\t */\n\tTEST11: Env.schema.list(Env.schema.enum(['typescript', 'javascript', 'bun']), { unique: true }),\n\t/**\n\t * Duration strings resolved to milliseconds\n\t */\n\tTEST12: Env.schema.duration({ minMs: 1_000, maxMs: 3_600_000 }),\n\t/**\n\t * Byte sizes resolved to bytes\n\t */\n\tTEST13: Env.schema.bytes({ min: 1_024, max: 1_073_741_824 }),\n\t/**\n\t * Filesystem paths with optional existence and type checks\n\t */\n\tTEST14: Env.schema.path({ type: 'file', exists: true }),\n\t/**\n\t * Base64 strings with URL-safe and padding controls\n\t */\n\tTEST15: Env.schema.base64({ padding: 'required' }),\n\t/**\n\t * ISO date/time strings parsed to Date objects\n\t */\n\tTEST16: Env.schema.date({ min: '2000-01-01T00:00:00Z', max: '2100-01-01T00:00:00Z' }),\n\t/**\n\t * Secret strength checks\n\t *\n\t * `minClasses` counts presence across: lowercase, uppercase, digits, and symbols.\n\t */\n\tTEST17: Env.schema.secret({ minLength: 12, minClasses: 3 }),\n});\n\nenv.get('TEST1');  // number\nenv.get('TEST2');  // string\nenv.get('TEST3');  // boolean\nenv.get('TEST4');  // string\nenv.get('TEST5');  // string\nenv.get('TEST6');  // { a: number }\nenv.get('TEST7');  // { a: number }[]\nenv.get('TEST8');  // error: [TEST8[1]] expected string but got number\nenv.get('TEST9');  // undefined\nenv.get('TEST10'); // error: [TEST10] expected one of [typescript, javascript] but got \"coffeescript\"\nenv.get('TEST11'); // ('typescript' | 'javascript' | 'bun')[]\nenv.get('TEST12'); // number (milliseconds)\nenv.get('TEST13'); // number (bytes)\nenv.get('TEST14'); // string (path)\nenv.get('TEST15'); // string (base64)\nenv.get('TEST16'); // Date\nenv.get('TEST17'); // string (secret)\n```\n\n---\n\n† This library will work without Bun but it will not handle .env file parsing. Use a library like `dotenv` to assign .env values to `process.env` before calling `Env.create()`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepthbomb%2Fenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdepthbomb%2Fenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepthbomb%2Fenv/lists"}