{"id":13912431,"url":"https://github.com/mrsteele/dotenv-defaults","last_synced_at":"2026-02-02T05:07:19.460Z","repository":{"id":31817429,"uuid":"128222662","full_name":"mrsteele/dotenv-defaults","owner":"mrsteele","description":"dotenv... but with defaults!","archived":false,"fork":false,"pushed_at":"2023-01-03T07:14:47.000Z","size":537,"stargazers_count":77,"open_issues_count":6,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T16:10:01.497Z","etag":null,"topics":["defaults","dotenv","environment","environment-variables"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/mrsteele.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}},"created_at":"2018-04-05T15:02:29.000Z","updated_at":"2024-12-22T17:58:20.000Z","dependencies_parsed_at":"2023-01-14T19:50:25.697Z","dependency_job_id":null,"html_url":"https://github.com/mrsteele/dotenv-defaults","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsteele%2Fdotenv-defaults","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsteele%2Fdotenv-defaults/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsteele%2Fdotenv-defaults/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsteele%2Fdotenv-defaults/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrsteele","download_url":"https://codeload.github.com/mrsteele/dotenv-defaults/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369953,"owners_count":20927928,"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":["defaults","dotenv","environment","environment-variables"],"created_at":"2024-08-07T01:01:27.466Z","updated_at":"2026-02-02T05:07:19.454Z","avatar_url":"https://github.com/mrsteele.png","language":"JavaScript","funding_links":[],"categories":["others","Backend frameworks \u0026 libraries"],"sub_categories":[],"readme":"# dotenv-defaults\n\nA dotenv system that supports defaults.\n\n### Status\n\n![npm](https://img.shields.io/npm/v/dotenv-defaults.svg)\n[![Main](https://github.com/mrsteele/dotenv-defaults/actions/workflows/main.yml/badge.svg)](https://github.com/mrsteele/dotenv-defaults/actions/workflows/main.yml)\n[![dotenv-vault](https://badge.dotenv.org/works-with.svg?r=3)](https://www.dotenv.org/get-started?r=3)\n\n### Installation\n\nUse the following to install this module:\n\n```\nnpm i dotenv-defaults --save\n```\n\n### Usage\n\nThis module supports all the features from the original [dotenv](https://www.npmjs.com/package/dotenv) module, so usage should be simple enough:\n\n```\n# .env.defaults, safe to commit\nHOST=website.com\nEMAIL=test@email.com\n```\n\n```\n# .env, DO NOT COMMIT\nHOST=mrsteele.dev\n```\n\nThe result\n\n```js\n// ESM (Node.js 18+)\nimport { config } from 'dotenv-defaults'\nconfig()\n\n// Or load it directly like this\nimport 'dotenv-defaults/config'\n\nconsole.log(process.env.HOST)\n// Outputs: mrsteele.dev\n\nconsole.log(process.env.EMAIL)\n// Outputs: test@email.com\n```\n\n##### TypeScript\nThis module now includes full TypeScript type definitions and works seamlessly with TypeScript:\n\n```typescript\nimport { config, parse, type ConfigOptions } from 'dotenv-defaults'\n\n// Or load directly\nimport 'dotenv-defaults/config'\n\nconst options: ConfigOptions = {\n  path: './.env',\n  defaults: './.env.defaults'\n}\n\nconfig(options)\n```\n\n##### CLI\nYou can also call this module directly when using the node executable.\nSo, for example if you are running a custom script with node and you want to load your environment variables you can do the following `node --import dotenv-defaults/config your-script.js`. (_When using this method, please make sure that you have installed dotenv-defaults with npm or yarn in the same directory_)\n\n\u003e **Note:** For Node.js versions that don't support `--import`, you can use `node --loader dotenv-defaults/config your-script.js`\n\n### Differences\n\nThe only thing to note is that the original module supported an `options` argument in the `config` function.\n\nThis module supports that as well, but there is an added `defaults` property that can allow you to define where that file is located. An example is shown below:\n\n```js\n// ESM\nimport { config } from 'dotenv-defaults'\n\n// all of these are the default values...\nconfig({\n  path: './.env',\n  encoding: 'utf8',\n  defaults: './.env.defaults' // This is new\n})\n```\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsteele%2Fdotenv-defaults","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrsteele%2Fdotenv-defaults","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsteele%2Fdotenv-defaults/lists"}