{"id":16747467,"url":"https://github.com/roydukkey/dotenv-dot","last_synced_at":"2026-04-12T16:08:16.707Z","repository":{"id":57215402,"uuid":"283572783","full_name":"roydukkey/dotenv-dot","owner":"roydukkey","description":"Dot-notation transformer for dotenv. Transform .env variables into condensed JSON variables for use in nodejs projects.","archived":false,"fork":false,"pushed_at":"2021-01-13T17:05:18.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-21T19:57:39.166Z","etag":null,"topics":["dotenv","env","environment-variables","json","user-config","user-settings"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/roydukkey.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["roydukkey"]}},"created_at":"2020-07-29T18:25:14.000Z","updated_at":"2021-01-13T17:05:21.000Z","dependencies_parsed_at":"2022-08-26T13:41:53.611Z","dependency_job_id":null,"html_url":"https://github.com/roydukkey/dotenv-dot","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/roydukkey/dotenv-dot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fdotenv-dot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fdotenv-dot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fdotenv-dot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fdotenv-dot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roydukkey","download_url":"https://codeload.github.com/roydukkey/dotenv-dot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fdotenv-dot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268554909,"owners_count":24269062,"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","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"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":["dotenv","env","environment-variables","json","user-config","user-settings"],"created_at":"2024-10-13T02:10:04.234Z","updated_at":"2026-04-12T16:08:16.660Z","avatar_url":"https://github.com/roydukkey.png","language":"TypeScript","funding_links":["https://github.com/sponsors/roydukkey"],"categories":[],"sub_categories":[],"readme":"# dotenv-dot\n\n\u003cimg src=\"https://roydukkey.github.io/assets/images/dotenv-dot.png\" alt=\"dotenv-dot\" align=\"right\" /\u003e\n\nDotenv-dot adds dot-notation variable transformation on top of [dotenv](http://github.com/motdotla/dotenv). If you find yourself needing to condense environment variables into JSON variables, then dotenv-dot is your tool.\n\n[![Release Version](https://img.shields.io/npm/v/dotenv-dot.svg)](https://www.npmjs.com/package/dotenv-dot)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n\n## Install\n\n```bash\nnpm install dotenv --save\nnpm install dotenv-dot --save\n```\n\n\n## Usage\n\nDot-notation variables are those which contain a dot (.) in their name. Add dot-notation variables to the `.env` file like any other variable.\n\n```dosini\nMAIL_CONFIG.service=gmail\nMAIL_CONFIG.auth.user=noreply@domain.com\nMAIL_CONFIG.auth.pass=pass1234\n```\n\nOnce the dotenv-dot transformer is executed, these variables will be condensed into a new variable named `MAIL_CONFIG`.\n\n```dosini\nMAIL_CONFIG='{\"service\":\"gmail\",\"auth\":{\"user\":\"noreply@domain.com\",\"pass\":\"pass1234\"}}'\n```\n\n#### Transform `process.env` variables\n\nAs early as possible in your application, require dotenv and dotenv-dot. Then, execute dotenv-dot after dotenv.\n\n```js\nconst dotenv = require('dotenv');\nconst dotenvDot = require('dotenv-dot').transform;\n\nconst myEnv = dotenv.config();\nconst results = dotenvDot(); // only updates `process.env`\n```\n\n#### Transform `process.env` and the results of `dotenv.config()`\n\nIf you want to update `process.env` and the output of the `dotenv.config()`, include the output as a parameter on the dotenv-dot transformer.\n\n```js\nconst myEnv = dotenv.config();\nconst results = dotenvDot(myEnv); // updates `process.env` and `myEnv`\n```\n\n#### Transform variables without affecting `process.env`\n\nIt is possible to use dotenv without adding variables to `process.env`. Dotenv-dot can also do the same.\n\n```js\nconst parsedOutput = dotenv.parse(`MAIL_CONFIG.service=gmail\nMAIL_CONFIG.auth.user=noreply@domain.com\nMAIL_CONFIG.auth.pass=pass1234`);\n\nconst results = dotenvDot(parsedOutput);\n```\n\nIf you already have parsed output you may transform it without using dotenv.\n\n```js\nconst results = dotenvDot({\n  'MAIL_CONFIG.service': 'gmail',\n  'MAIL_CONFIG.auth.user': 'noreply@domain.com'\n  'MAIL_CONFIG.auth.pass': 'pass1234'\n});\n```\n\n\n### Options\n\n##### debug\n\nDefault: `false`\n\nYou may turn on logging to help debug why certain keys or values are not being set as expected.\n\n```js\nconst myEnv = dotenv.config();\n\nrequire('dotenv-dot').transform(myEnv, {\n  debug: process.env.DEBUG\n});\n```\n\n##### ignoreProcessEnv\n\nDefault: `false`\n\nYou may want to ignore `process.env` when transforming the output of the `dotenv.config()`. When this option is turned on `process.env` will not be consulted or altered.\n\n```js\nconst myEnv = dotenv.config();\n\nrequire('dotenv-dot').transform(myEnv, {\n  ignoreProcessEnv: true\n});\n```\n\n\n### How do I use dotenv-dot with `import`?\n\n```js\nimport * as dotenv from 'dotenv';\nimport dotenvDot from 'dotenv-dot';\n```\n\nOr, if only intending to access `process.env`, the two modules should be loading in this order using their auto-imports:\n\n``` js\nimport 'dotenv/config';\nimport 'dotenv-dot/transform';\n```\n\nMore information about the `import` syntax is available on the [dotenv repository](https://github.com/motdotla/dotenv/blob/master/README.md#how-do-i-use-dotenv-with-import).\n\n*Note:* You may set the `debug` option using the dotenv debug [command line or environment variable](https://github.com/motdotla/dotenv/blob/master/README.md#preload). The `ignoreProcessEnv` option is irrelevant when using the auto-imports.\n\n\n### How do I add arrays to the `.env` file?\n\nArrays are added by using numbers to indicate the value's index in the resulting array.\n\n```dosini\nTHINGS.0='Was eaten by his others'\nTHINGS.1='Thing One'\nTHINGS.3='Wayward Thing Two'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froydukkey%2Fdotenv-dot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froydukkey%2Fdotenv-dot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froydukkey%2Fdotenv-dot/lists"}