{"id":16595341,"url":"https://github.com/superchupudev/neon-env","last_synced_at":"2025-04-04T13:06:10.341Z","repository":{"id":62135307,"uuid":"556351382","full_name":"SuperchupuDev/neon-env","owner":"SuperchupuDev","description":"A typed environment variable parser with support for choices, custom parsers, and more.","archived":false,"fork":false,"pushed_at":"2024-11-04T04:36:57.000Z","size":254,"stargazers_count":60,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T14:07:06.642Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/neon-env","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"itslukej/typed-env","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SuperchupuDev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-10-23T16:53:54.000Z","updated_at":"2025-01-25T20:59:30.000Z","dependencies_parsed_at":"2024-01-20T10:25:41.945Z","dependency_job_id":"3f8ea7a6-ccd7-4dc2-b5e2-2e6f616a821b","html_url":"https://github.com/SuperchupuDev/neon-env","commit_stats":{"total_commits":17,"total_committers":5,"mean_commits":3.4,"dds":0.3529411764705882,"last_synced_commit":"26e59b73c41dadb95be455469001f2992264899e"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuperchupuDev%2Fneon-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuperchupuDev%2Fneon-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuperchupuDev%2Fneon-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuperchupuDev%2Fneon-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SuperchupuDev","download_url":"https://codeload.github.com/SuperchupuDev/neon-env/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182389,"owners_count":20897381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-11T23:49:33.475Z","updated_at":"2025-04-04T13:06:10.315Z","avatar_url":"https://github.com/SuperchupuDev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# neon-env\n\n\u003e Basically [typed-env](https://www.npmjs.com/package/typed-env), but with support for choices and maintained.\n\nA typed environment variable parser with support for choices, custom parsers, and more.\n\n## Installation\n\n\u003e Node.js ^14.18.0, v16 or newer is required. [See issue #1](https://github.com/SuperchupuDev/neon-env/issues/1#issuecomment-1296366710).\n\n```sh-session\nnpm i neon-env\n```\n\n## Usage\n\n```ts\nimport { createEnv } from 'neon-env';\n\nconst env = createEnv({\n  PORT: { type: 'number', default: 80 }\n});\n\nenv.PORT; // number\n```\n\n## Features\n\n- Strongly typed\n- Supports [custom parsers](#parser)\n- Supports optional environment variables\n- Supports limiting the possible values (see [Choices](#choices))\n- Supports passing custom environments (see [Options](#options))\n\n### Choices\n\n```ts\nimport { createEnv } from 'neon-env';\n\nconst env = createEnv({\n  NODE_ENV: {\n    type: 'string',\n    choices: ['development', 'production']\n  }\n});\n\nenv.NODE_ENV; // 'development' | 'production'\n```\n\nAs of 0.2.0, you no longer need to add `as const` to the choices array to get the best type safety.\n\n### Parser\n\nYou can pass a `parser` function to return your own custom type\n\n```ts\nimport { createEnv } from 'neon-env';\n\nconst env = createEnv({\n  HOMEPAGE: { parser: url =\u003e new URL(url) }\n});\n\nenv.HOMEPAGE; // URL\n```\n\n### Options\n\nIf you want to use a custom env, pass `env` in the `options` parameter, otherwise it will load from `process.env`\n\n```ts\ninterface Options {\n  env?: Record\u003cstring, string\u003e | NodeJS.ProcessEnv;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperchupudev%2Fneon-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuperchupudev%2Fneon-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperchupudev%2Fneon-env/lists"}