{"id":52064291,"url":"https://github.com/dotenvx/dotenv-expand","last_synced_at":"2026-08-05T05:00:39.406Z","repository":{"id":3551490,"uuid":"50004406","full_name":"dotenvx/dotenv-expand","owner":"dotenvx","description":"Expand variables already on your machine for use in your .env file.","archived":false,"fork":false,"pushed_at":"2026-07-29T18:34:11.000Z","size":985,"stargazers_count":1056,"open_issues_count":0,"forks_count":99,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-08-03T10:04:30.791Z","etag":null,"topics":["config","dotenv","env","environment","expand","secrets"],"latest_commit_sha":null,"homepage":"https://dotenvx.com/open-source","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotenvx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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,"disclosure":null},"funding":{"github":"motdotla","custom":"https://www.dotenvx.com"}},"created_at":"2016-01-20T04:30:26.000Z","updated_at":"2026-08-01T23:55:51.000Z","dependencies_parsed_at":"2024-02-20T04:30:55.949Z","dependency_job_id":"8cdd68d5-a557-4c9b-84f0-c9e272045100","html_url":"https://github.com/dotenvx/dotenv-expand","commit_stats":{"total_commits":184,"total_committers":29,"mean_commits":6.344827586206897,"dds":"0.32608695652173914","last_synced_commit":"ff7e2efd0d9925c7da82c167ae77d22a6c76e878"},"previous_names":["dotenvx/dotenv-expand","motdotla/dotenv-expand"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/dotenvx/dotenv-expand","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotenvx%2Fdotenv-expand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotenvx%2Fdotenv-expand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotenvx%2Fdotenv-expand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotenvx%2Fdotenv-expand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotenvx","download_url":"https://codeload.github.com/dotenvx/dotenv-expand/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotenvx%2Fdotenv-expand/sbom","scorecard":{"id":661119,"data":{"date":"2025-08-11","repo":{"name":"github.com/motdotla/dotenv-expand","commit":"2c2869a89d097619e1c092564fc2aaeafa18b788"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/23 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/motdotla/dotenv-expand/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/motdotla/dotenv-expand/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/motdotla/dotenv-expand/ci.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:24","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 10 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T16:14:13.697Z","repository_id":3551490,"created_at":"2025-08-21T16:14:13.697Z","updated_at":"2025-08-21T16:14:13.697Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36298194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-08-05T02:00:06.619Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["config","dotenv","env","environment","expand","secrets"],"created_at":"2026-08-03T01:00:45.663Z","updated_at":"2026-08-05T05:00:39.347Z","avatar_url":"https://github.com/dotenvx.png","language":"JavaScript","funding_links":["https://github.com/sponsors/motdotla","https://www.dotenvx.com"],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003e If you have found dotenv-expand useful, consider checking out [dotenvx](https://github.com/dotenvx/dotenvx) for encrypting your `.env` files. Thank you for using dotenv. 🙏\n\n# dotenv-expand [![NPM version](https://img.shields.io/npm/v/dotenv-expand.svg?style=flat-square)](https://www.npmjs.com/package/dotenv-expand) [![downloads](https://img.shields.io/npm/dw/dotenv-expand)](https://www.npmjs.com/package/dotenv-expand)\n\n\u003cimg src=\"https://raw.githubusercontent.com/motdotla/dotenv/master/dotenv.svg\" alt=\"dotenv\" align=\"right\" width=\"200\" /\u003e\n\nDotenv-expand is a zero-dependency module that adds variable expansion, command substitution, and encrypted value support on top of [dotenv](https://github.com/motdotla/dotenv).\n\n\u0026nbsp;\n\n## Usage\n\nInstall it alongside dotenv.\n\n```sh\nnpm install dotenv dotenv-expand --save\n```\n\nCreate a `.env` file in the root of your project:\n\n```ini\n# .env\nUSERNAME=\"dotenv\"\nDATABASE_URL=\"postgres://${USERNAME}@localhost/my_database\"\n```\n\nAs early as possible in your application, configure dotenv and expand its result:\n\n```javascript\n// index.js\nconst dotenv = require('dotenv')\nconst dotenvExpand = require('dotenv-expand')\n\ndotenvExpand.expand(dotenv.config())\n\nconsole.log(process.env.DATABASE_URL)\n```\n\n```sh\n$ node index.js\npostgres://dotenv@localhost/my_database\n```\n\nThat's it. `process.env` now contains the expanded values from your `.env` file.\n\n\u0026nbsp;\n\n## Advanced\n\n\u003cdetails\u003e\u003csummary\u003ePreload\u003c/summary\u003e\u003cbr\u003e\n\n\u003e Consider using [dotenvx](https://github.com/dotenvx/dotenvx) instead. It includes expansion, command substitution, and encrypted `.env` support across languages and platforms:\n\u003e\n\u003e ```sh\n\u003e dotenvx run -- node your_script.js\n\u003e ```\n\nUse Node's `--require` (`-r`) option to load and expand `.env` before your application starts:\n\n```sh\nnode -r dotenv-expand/config your_script.js\n```\n\nThe preload entry is self-contained; you do not need to separately install dotenv.\n\nConfiguration options can be passed as command-line arguments:\n\n```sh\nnode -r dotenv-expand/config your_script.js dotenv_config_path=/custom/path/to/.env\n```\n\nOr as environment variables:\n\n```sh\nDOTENV_CONFIG_ENCODING=latin1 node -r dotenv-expand/config your_script.js\n```\n\nCommand-line arguments take precedence over environment variables.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003epnpm\u003c/summary\u003e\u003cbr\u003e\n\n```sh\npnpm add dotenv dotenv-expand\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eCommand Substitution\u003c/summary\u003e\u003cbr\u003e\n\nUse `$(command)` to replace an expression with the command's output:\n\n```ini\nNODE_VERSION=$(node --version)\n```\n\nOnly use command substitution with `.env` files you trust. Commands run with the permissions of the current process.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eEncrypted Values\u003c/summary\u003e\u003cbr\u003e\n\nUse [dotenvx](https://dotenvx.com) to encrypt your `.env` file. dotenv-expand automatically decrypts `encrypted:` values when `DOTENV_PRIVATE_KEY` is set:\n\n```sh\nDOTENV_PRIVATE_KEY=\"\u003cprivate key\u003e\" node -r dotenv-expand/config your_script.js\n```\n\nKeep the private key separate from the encrypted `.env` file—for example, in your cloud platform's secrets manager. Read the [dotenvx whitepaper](https://dotenvx.com/dotenvx.pdf?v=README) for more details.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eCustom Process Environment\u003c/summary\u003e\u003cbr\u003e\n\nUse `processEnv` to write expanded values to an object other than `process.env`:\n\n```javascript\nconst dotenvExpand = require('dotenv-expand')\n\nconst myEnv = {}\n\ndotenvExpand.expand({\n  processEnv: myEnv,\n  parsed: {\n    HELLO: 'World'\n  }\n})\n\nconsole.log(myEnv.HELLO) // World\nconsole.log(process.env.HELLO) // undefined\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eInterpolation Syntax\u003c/summary\u003e\u003cbr\u003e\n\ndotenv-expand supports braced and unbraced expansion, default values, and alternate values:\n\n```ini\nBASIC=\"basic\"\nBRACED=${BASIC}\nUNBRACED=$BASIC\nDEFAULT=${MISSING:-default}\nALTERNATE=${BASIC:+alternate}\n```\n\nSee the complete [interpolation rules](https://dotenvx.com/docs/env-file#interpolation).\n\n\u003c/details\u003e\n\n\u0026nbsp;\n\n## FAQ\n\n\u003cdetails\u003e\u003csummary\u003eWhat rules does the expansion engine follow?\u003c/summary\u003e\u003cbr\u003e\n\nSee a full list of rules [here](https://dotenvx.com/docs/env-file#interpolation).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eHow does command substitution work?\u003c/summary\u003e\u003cbr\u003e\n\nUse `$(command)` in your `.env` file. dotenv-expand runs the command and replaces the expression with its output. See the Command Substitution example under Advanced.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eHow does encryption work?\u003c/summary\u003e\u003cbr\u003e\n\nUse [dotenvx](https://dotenvx.com) to encrypt your `.env` file. dotenv-expand automatically decrypts `encrypted:` values when `DOTENV_PRIVATE_KEY` is set.\n\n```sh\nDOTENV_PRIVATE_KEY=\"\u003cprivate key\u003e\" node -r dotenv-expand/config your_script.js\n```\n\nKeep the private key separate from the encrypted `.env` file—for example, in your cloud platform's secrets manager. Read the [dotenvx whitepaper](https://dotenvx.com/dotenvx.pdf?v=README) for more details.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eIs it safe to commit an encrypted `.env` file?\u003c/summary\u003e\u003cbr\u003e\n\nYes, as long as the corresponding `DOTENV_PRIVATE_KEY` is stored separately and never committed with it. Use [dotenvx](https://dotenvx.com) to create and manage the encrypted file.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eHow can I avoid expanding pre-existing envs?\u003c/summary\u003e\u003cbr\u003e\n\nAs of `v12.0.0` dotenv-expand no longer expands `process.env`.\n\nIf you need this ability, use [dotenvx](https://dotenvx.com) and ship an encrypted `.env` file with your code, allowing safe expansion at runtime.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eHow can I override an existing environment variable?\u003c/summary\u003e\u003cbr\u003e\n\nUse [dotenvx](https://dotenvx.com), as dotenv-expand does not support this.\n\ndotenv-expand is a separate module (without knowledge of the loading of `process.env` and the `.env` file) and so cannot reliably know what to override.\n\n\u003c/details\u003e\n\n\u0026nbsp;\n\n## Docs\n\n### Expand\n\n`expand` expands, evaluates, and decrypts values in a dotenv result:\n\n```javascript\nconst dotenvExpand = require('dotenv-expand')\n\nconst result = dotenvExpand.expand({\n  parsed: {\n    BASIC: 'basic',\n    BASIC_EXPAND: '${BASIC}',\n    BASIC_EXPAND_SIMPLE: '$BASIC'\n  }\n})\n\nconsole.log(result.parsed)\n```\n\n#### Options\n\n##### `processEnv`\n\nDefault: `process.env`\n\nSpecify an object to read existing values from and write expanded values to.\n\n##### `parsed`\n\nThe parsed key-value object to expand. This is normally the result of `dotenv.config()`.\n\n\u0026nbsp;\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## CHANGELOG\n\nSee [CHANGELOG.md](CHANGELOG.md).\n\n## Who's using dotenv-expand?\n\n[These npm modules depend on it.](https://www.npmjs.com/browse/depended/dotenv-expand)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotenvx%2Fdotenv-expand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotenvx%2Fdotenv-expand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotenvx%2Fdotenv-expand/lists"}