{"id":17516873,"url":"https://github.com/almeidazs/enya","last_synced_at":"2025-06-20T03:35:00.009Z","repository":{"id":258676773,"uuid":"874393672","full_name":"almeidazs/enya","owner":"almeidazs","description":"An ergonomic env parsing library","archived":false,"fork":false,"pushed_at":"2024-10-19T14:53:33.000Z","size":23,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-18T00:55:57.958Z","etag":null,"topics":["bun","env","enviroment","inference","typescript","validation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/almeidazs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-10-17T18:41:33.000Z","updated_at":"2024-10-19T16:43:34.000Z","dependencies_parsed_at":"2024-10-20T17:37:23.491Z","dependency_job_id":null,"html_url":"https://github.com/almeidazs/enya","commit_stats":null,"previous_names":["yunreal/enya","savageszz/enya","almeidazs/enya"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almeidazs%2Fenya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almeidazs%2Fenya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almeidazs%2Fenya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almeidazs%2Fenya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/almeidazs","download_url":"https://codeload.github.com/almeidazs/enya/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250455861,"owners_count":21433600,"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":["bun","env","enviroment","inference","typescript","validation"],"created_at":"2024-10-20T08:10:13.811Z","updated_at":"2025-04-23T14:43:18.477Z","avatar_url":"https://github.com/almeidazs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eEnya\u003c/h1\u003e\n\u003cp align=\"center\"\u003eAn ergonomic env parsing library\u003c/p\u003e\n\n```bash\nbun add enya\n```\n\n## Quick Start\n\nEnya is an ergonomic env parsing library supercharged by Bun. Designed to be fast and with an extensive support for TypeScript.\n\nParsing your env from process.env.\n\n```ts\nimport { e } from 'enya';\n\nconst env = e\n\t.env({\n\t\tDATABASE_URL: e.url(),\n\t\tPORT: e.port().default(() =\u003e 8080),\n\t})\n\t.parse();\n```\n\nNow we can infer the type of the enviroment easily.\n\n```ts\n/**\n * type Env = {\n *    DATABASE_URL: URL;\n *    PORT: number;\n * }\n */\ntype Env = typeof env;\n```\n\n## Installing\n\nEnya was created with [Bun](https://bun.sh/), so you need to install it.\n\nInstall Bun with the command below:\n\n### Linux \u0026 macOS\n\n```bash\ncurl -fsSL https://bun.sh/install | bash\n```\n\n### Windows\n\n```bash\npowershell -c \"irm bun.sh/install.ps1 | iex\"\n```\n\nThen you can easily install Enya as a package.\n\n```bash\nbun add enya\nbun add -d @types/bun\n```\n\n## Using dotenv or any env var loader\n\nEnya lets you load your environment variables however you want, even though Bun already loads them automatically. For this, you can look at the example below:\n\n```ts\nimport { e } from 'enya';\nimport { config } from 'dotenv';\n\n/**\n * {\n * \t\tUSER_EMAIL: string;\n * \t\tPORT: number;\n * }\n */\nconst env = e\n\t.env({\n\t\tUSER_EMAIL: e.email(),\n\t\tPORT: e.for({\n\t\t\tproduction: e.never(),\n\t\t\tdevelopment: e.number(),\n\t\t}),\n\t})\n\t.parse(config());\n\nconsole.log(env);\n```\n\n## Enya API\n\nEnya has a **great** API for customizing each property of your environment variables which were not shown in the examples above, but you can find them in the [documentation](https://github.com/yUnreal/enya/blob/main/docs/API.md).\n\nIn a short period Enya will provide more support for customizations and more schemes.\n\n## Why not envalid or env-var?\n\n\u003cp align=\"center\"\u003eEnya is supercharged by Bun and end-to-end type safety, being \u003cstrong\u003e80x\u003c/strong\u003e faster than env-var and \u003cstrong\u003e7x\u003c/strong\u003e faster than envalid. With an ergonomic and modern API.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmeidazs%2Fenya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falmeidazs%2Fenya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmeidazs%2Fenya/lists"}