{"id":20537385,"url":"https://github.com/socheatsok78/webenv","last_synced_at":"2025-09-25T15:32:18.766Z","repository":{"id":57847880,"uuid":"528428148","full_name":"socheatsok78/webenv","owner":"socheatsok78","description":"Loads variables from .env for web projects.","archived":false,"fork":false,"pushed_at":"2022-09-09T10:16:45.000Z","size":81,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-19T19:48:01.975Z","etag":null,"topics":["dotenv","dotenv-loader","dotenv-parser","webenv"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@socheatsok78/webenv","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/socheatsok78.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":"2022-08-24T13:06:33.000Z","updated_at":"2023-03-05T02:18:25.000Z","dependencies_parsed_at":"2023-01-18T02:00:54.003Z","dependency_job_id":null,"html_url":"https://github.com/socheatsok78/webenv","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/socheatsok78/webenv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socheatsok78%2Fwebenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socheatsok78%2Fwebenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socheatsok78%2Fwebenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socheatsok78%2Fwebenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/socheatsok78","download_url":"https://codeload.github.com/socheatsok78/webenv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socheatsok78%2Fwebenv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276940319,"owners_count":25732286,"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-09-25T02:00:09.612Z","response_time":80,"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","dotenv-loader","dotenv-parser","webenv"],"created_at":"2024-11-16T00:40:22.429Z","updated_at":"2025-09-25T15:32:18.489Z","avatar_url":"https://github.com/socheatsok78.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @socheatsok78/webenv\n\nLoads variables from `.env` for web projects.\n\n[![npm-downloads](https://img.shields.io/npm/dm/@socheatsok78/webenv?style=flat-square)](https://www.npmjs.com/package/@socheatsok78/webenv)\n[![license](https://img.shields.io/github/license/socheatsok78/webenv?style=flat-square)](LICENSE)\n\n### Story\n\n\u003cimg src=\"https://raw.githubusercontent.com/motdotla/dotenv/master/dotenv.png\" alt=\"dotenv\" align=\"right\" /\u003e\n\n**What is Dotenv?**\n\nDotenv is a zero-dependency module that loads environment variables from a `.env` file into `process.env`. Storing configuration in the environment separate from code is based on [The Twelve-Factor App](http://12factor.net/config) methodology.\n\n**Why Webenv?**\n\nWhile `dotenv` provide a convenient way of loading environment variables from a `.env` file for Node.js, however managing runtime environment variables for the web doesn't seem to be any easier.\n\nThis project is aimed to fix the those on the web by providing a wrapper to `dotenv` using `fetch` to make a request for `.env` file from your publicly accessible path. It is a highly customized [`dotenv`](https://github.com/motdotla/dotenv) and [`dotenv-expand`](https://github.com/motdotla/dotenv-expand) built for the web.\n\n## Install\n\n```sh\nnpm install @socheatsok78/webenv --save\n```\n\nOr installing with yarn?\n\n```sh\nyarn add @socheatsok78/webenv\n```\n\n## Usage\n\nCreate a `.env` file in the public folder of your project:\n```env\n# Please DO NOT store your sensitive data here\n# This file must be publicly accessible by anyone\nAPI_BACKEND_ENDPOINT=\"https://api.example.com\"\n```\n\n\u003e NOTE: \n\u003e \n\u003e The `webenv` do not have access to the server environment variables. \n\u003e You can consider that the `webenv` is only use for runtime configuration only.\n\nAs early as possible in your application, import and configure dotenv:\n```js\nimport * as webenv from '@socheatsok78/webenv'\n\n(async () =\u003e {\n    await webenv.config({ path: '/.env' }) // make a fetch request to '/.env' and parse the string response\n    console.log(window.env) // remove this after you've confirmed it working\n})()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocheatsok78%2Fwebenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocheatsok78%2Fwebenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocheatsok78%2Fwebenv/lists"}