{"id":21004639,"url":"https://github.com/flaque/notenv","last_synced_at":"2025-05-15T01:33:04.889Z","repository":{"id":35174084,"uuid":"216626097","full_name":"Flaque/notenv","owner":"Flaque","description":"Friends don't let friends use .env","archived":false,"fork":false,"pushed_at":"2023-01-04T23:27:09.000Z","size":274,"stargazers_count":5,"open_issues_count":13,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T01:41:28.032Z","etag":null,"topics":[],"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/Flaque.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}},"created_at":"2019-10-21T17:27:53.000Z","updated_at":"2023-08-29T00:34:56.000Z","dependencies_parsed_at":"2023-01-15T15:20:17.196Z","dependency_job_id":null,"html_url":"https://github.com/Flaque/notenv","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flaque%2Fnotenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flaque%2Fnotenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flaque%2Fnotenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flaque%2Fnotenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Flaque","download_url":"https://codeload.github.com/Flaque/notenv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254256466,"owners_count":22040296,"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-11-19T08:37:18.103Z","updated_at":"2025-05-15T01:33:04.615Z","avatar_url":"https://github.com/Flaque.png","language":"TypeScript","readme":"# notenv\n\n`notenv` is a \"replacement\" for a dumb uses of `.env` files. You really shouldn't use .env files. Any production secret that would live in a `.env` should _never_ live on some engineers computer. And in _many_ cases, any development \"secret\" should be so unimportant that it's fine to put it in source control.\n\nFor example, you don't need to put your \"password\" for the development postgres in `.env` if it's just something running locally on a developer's laptop.\n\nThe general rule of thumb: if you're worried about committing a secret to source control, it probably shouldn't be living on some engineers computer either.\n\n## Install\n\n```\nyarn add notenv\n```\n\n## Usage\n\n`notenv` lets you `proclaim` the existence of an environment variables and then get them later on with a type-safe getter.\n\n```ts\nimport proclaim from \"notenv\";\n\nconst env = proclaim({\n  DATABASE_PASSWORD: \"my-development-password\"\n});\n\nenv(\"DATABASE_PASSWORD\"); // returns \"my-development-password\" when NODE_ENV !== \"production\"\nenv(\"ARGLE_BARGLE\"); // Fails typecheck\n```\n\nIf you're in production and it can't find it in `process.env[key]`, it'll throw an error. Otherwise, it'll use the development value, (the property in the object).\n\nThe suggested way to use `notenv` is to create a `env.js` (or `env.ts`) file somewhere and then export all your environment variables from there.\n\n```ts\n// env.js\nimport proclaim from \"notenv\";\n\nexport default proclaim({\n  DATABASE_URL: \"postgres://localhost...\",\n  DATABASE_USER: \"local\",\n  DATABASE_PASSWORD: \"dummy-buddy\"\n});\n```\n\nThen in some other file, you can use `env` variables like this:\n\n```ts\nimport env from \"./env.js\";\n\nenv(\"DATABASE_USER\");\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaque%2Fnotenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflaque%2Fnotenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaque%2Fnotenv/lists"}