{"id":29269730,"url":"https://github.com/zackiles/deno-kit-config","last_synced_at":"2025-07-23T07:06:02.051Z","repository":{"id":290088827,"uuid":"973331866","full_name":"zackiles/deno-kit-config","owner":"zackiles","description":"Combine dot-env, Deno.env, and general overrides into a simple unified global config module for your application","archived":false,"fork":false,"pushed_at":"2025-04-26T19:44:00.000Z","size":89,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-19T07:27:15.118Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zackiles.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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}},"created_at":"2025-04-26T18:58:05.000Z","updated_at":"2025-04-26T19:44:03.000Z","dependencies_parsed_at":"2025-04-26T20:31:44.700Z","dependency_job_id":null,"html_url":"https://github.com/zackiles/deno-kit-config","commit_stats":null,"previous_names":["zackiles/deno-kit-config"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zackiles/deno-kit-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackiles%2Fdeno-kit-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackiles%2Fdeno-kit-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackiles%2Fdeno-kit-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackiles%2Fdeno-kit-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zackiles","download_url":"https://codeload.github.com/zackiles/deno-kit-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackiles%2Fdeno-kit-config/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266633453,"owners_count":23959556,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":[],"created_at":"2025-07-04T21:09:37.004Z","updated_at":"2025-07-23T07:06:02.007Z","avatar_url":"https://github.com/zackiles.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **@deno-kit/config**\n\n[![JSR Score](https://jsr.io/badges/@deno-kit/config/score)](https://jsr.io/@deno-kit/config)\n[![JSR](https://jsr.io/badges/@deno-kit/1.%20Clone%20this%20repository)](https://jsr.io/@deno-kit/config)\n[![JSR Scope](https://jsr.io/badges/@deno-kit})](https://jsr.io/@deno-kit})\n[![ci](https://github.com/zackiles/deno-kit-config/actions/workflows/ci.yml/badge.svg)](https://github.com/zackiles/deno-kit-config/actions/workflows/ci.yml)\n[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/zackiles/deno-kit-config/blob/main/LICENSE)\n\nCombine dot-env, `Deno.env`, and general overrides into a simple unified global config module for your application.\n\n\u003e [!NOTE]\n\u003e This is a **new** project and the documentation is unlikely to be comprehensive or accurate.\n\n## Features\n\n- 🦖 **Modern Deno Features:** Built with the latest Deno runtime features\n- 🔄 **Global Singleton:** Configure once, access anywhere - all modules get the same configuration instance\n- 🔒 **Type-Safe:** Returns a strongly-typed proxy object for safe access to config values\n- 🔁 **Auto-Sync:** Automatically keeps `Deno.env` variables in sync with config changes\n- ⚙️ **Flexible Configuration:** Merges multiple sources in order of precedence:\n  1. Runtime overrides\n  2. Custom env file (via `--config` flag)\n  3. Local `.env` file\n  4. `Deno.env` variables\n  5. Default values\n- 📝 **Customizable Logging:** Bring your own logger for better integration\n- 📦 **Dynamic Values:** Support for async functions and promises as default values\n\n## Installation\n\n```bash\ndeno add jsr:@deno-kit/config\n```\n\n## Usage\n\n### Basic Usage\n\n```typescript\nimport { loadConfig } from '@deno-kit/config'\n\n// Initialize global config (do this once at app startup)\nconst config = await loadConfig()\n\n// Access values like properties\nconsole.log(config.DENO_ENV) // \"development\" by default\nconsole.log(config.DATABASE_URL) // Value from .env or Deno.env\n```\n\n### With Environment Files\n\nCreate a `.env` file in your project root:\n\n```env\nDATABASE_URL=postgres://localhost:5432/mydb\nAPI_KEY=secret123\n```\n\nThe values will be automatically loaded when calling `loadConfig()`. You can also specify a custom env file:\n\n```bash\ndeno run -A --config=prod.env script.ts\n```\n\n### With Runtime Overrides\n\n```typescript\n// Values passed to loadConfig() take highest precedence\nconst config = await loadConfig({\n  API_KEY: 'override-key',\n  DATABASE_URL: 'postgres://prod-host/db',\n})\n\n// These values are now available to all modules\nconsole.log(config.API_KEY) // \"override-key\"\nconsole.log(Deno.env.get('API_KEY')) // Also \"override-key\" - stays in sync!\n```\n\n### Singleton Pattern Benefits\n\nThe config object is a global singleton, meaning:\n\n1. Configure once at app startup, use anywhere\n2. All modules get the same configuration instance\n3. Changes are reflected everywhere immediately\n4. `Deno.env` stays in sync automatically\n\n```typescript\n// module1.ts\nimport { loadConfig } from '@deno-kit/config'\n\nconst config = await loadConfig({ INITIAL: 'value' })\nexport function doSomething() {\n  console.log(config.INITIAL) // \"value\"\n}\n\n// module2.ts\nimport { loadConfig } from '@deno-kit/config'\n\nconst config = await loadConfig() // Returns same instance\nconfig.INITIAL = 'new-value' // Updates everywhere\n\n// Both the config object and Deno.env are updated\nconsole.log(config.INITIAL) // \"new-value\"\nconsole.log(Deno.env.get('INITIAL')) // \"new-value\"\n```\n\n### Custom Logger Integration\n\n```typescript\nimport { log } from '@std/log'\n\nconst config = await loadConfig(null, log)\n// Now uses your logger for all config-related logs\n```\n\n## Development\n\n```bash\n# Run tests\ndeno task tests\n\n# Format / lint / type-check code\ndeno task pre-publish\n```\n\nFor details on the release process and CI/CD workflows, see the [RELEASING.md](RELEASING.md) document.\n\n## **Changelog**\n\nSee the [`CHANGELOG`](CHANGELOG.md) for details.\n\n## **Contributing**\n\nSee the [`CONTRIBUTING`](CONTRIBUTING.md) for details.\n\n## **License**\n\nThis project is licensed under the [MIT License](https://opensource.org/licenses/MIT) — see the [`LICENSE`](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzackiles%2Fdeno-kit-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzackiles%2Fdeno-kit-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzackiles%2Fdeno-kit-config/lists"}