{"id":13903206,"url":"https://github.com/geprog/vite-plugin-env-config","last_synced_at":"2026-01-17T12:50:40.675Z","repository":{"id":38124027,"uuid":"451510244","full_name":"geprog/vite-plugin-env-config","owner":"geprog","description":"Vite Plugin for providing config from environment variables at runtime","archived":false,"fork":false,"pushed_at":"2025-12-31T14:34:14.000Z","size":410,"stargazers_count":7,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-04T22:36:45.177Z","etag":null,"topics":["config","envsubst","twelve-factor-app","vite","vite-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@geprog/vite-plugin-env-config","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/geprog.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,"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}},"created_at":"2022-01-24T15:02:31.000Z","updated_at":"2024-07-31T14:59:43.000Z","dependencies_parsed_at":"2024-06-21T12:56:22.067Z","dependency_job_id":"a74a1e7d-906c-4ae9-906e-d9c8a2951a44","html_url":"https://github.com/geprog/vite-plugin-env-config","commit_stats":{"total_commits":23,"total_committers":3,"mean_commits":7.666666666666667,"dds":"0.13043478260869568","last_synced_commit":"175d967eda21fb23686e1901eb7a88f09440e2d9"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/geprog/vite-plugin-env-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geprog%2Fvite-plugin-env-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geprog%2Fvite-plugin-env-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geprog%2Fvite-plugin-env-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geprog%2Fvite-plugin-env-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geprog","download_url":"https://codeload.github.com/geprog/vite-plugin-env-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geprog%2Fvite-plugin-env-config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T11:50:55.898Z","status":"ssl_error","status_checked_at":"2026-01-17T11:50:55.569Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","envsubst","twelve-factor-app","vite","vite-plugin"],"created_at":"2024-08-06T22:01:52.614Z","updated_at":"2026-01-17T12:50:40.616Z","avatar_url":"https://github.com/geprog.png","language":"TypeScript","funding_links":[],"categories":["vite"],"sub_categories":[],"readme":"# @geprog/vite-plugin-env-config\n\n[![npm version](https://img.shields.io/npm/v/@geprog/vite-plugin-env-config)](https://www.npmjs.com/package/@geprog/vite-plugin-env-config)\n![vite peer dependency version](https://img.shields.io/npm/dependency-version/@geprog/vite-plugin-env-config/peer/vite)\n\nVite plugin for providing configurations from environment variables at runtime.\n\nThe generated template can be populated with [envsubst](https://github.com/a8m/envsubst) in production.\n\n## Usage\n\nAdd `envConfig` plugin to `vite.config.js / vite.config.ts` and provide a list of environment variable names:\n\n```js\n// vite.config.js / vite.config.ts\nimport { envConfig } from '@geprog/vite-plugin-env-config';\n\nexport default {\n  plugins: [envConfig({ variables: ['BACKEND_URL'] })],\n};\n```\n\nTo access the environment variables use the built-in getter:\n\n```ts\nimport { getEnvConfig } from '@geprog/vite-plugin-env-config';\n\nconst backendURL = getEnvConfig('BACKEND_URL');\n```\n\nFor production use `envsubst` as outlined in the [next section](#motivation).\n\n## Motivation\n\nTo adhere to the principles of the [twelve-factor app](https://12factor.net/config)\nyou might need to access environment variables that are set when your frontend server starts.\nInstead of building your frontend on startup,\nyou can use a config template like the one above and populate it using `envsubst`:\n\n```Dockerfile\nCMD [\"/bin/sh\", \"-c\", \"envsubst \u003c ./dist/env-config.template.js \u003e ./dist/env-config.js \u0026\u0026 exec nginx -g 'daemon off;'\"]\n```\n\n`@geprog/vite-plugin-env-config` generates the required template from a list of variable names and provides the already populated file via the dev-server during development.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeprog%2Fvite-plugin-env-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeprog%2Fvite-plugin-env-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeprog%2Fvite-plugin-env-config/lists"}