{"id":27337564,"url":"https://github.com/stacksjs/bun-plugin-dotenvx","last_synced_at":"2026-03-03T08:34:47.674Z","repository":{"id":223809977,"uuid":"761598367","full_name":"stacksjs/bun-plugin-dotenvx","owner":"stacksjs","description":"🔐 A powerful loader for your dotenv files, powered by dotenvx.","archived":false,"fork":false,"pushed_at":"2025-03-22T04:41:03.000Z","size":1976,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T09:30:25.788Z","etag":null,"topics":["bun","dotenv","dotenvx","plugin","typescript"],"latest_commit_sha":null,"homepage":"https://bun-plugin-dotenvx.netlify.app","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/stacksjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-22T06:05:21.000Z","updated_at":"2025-03-21T02:24:19.000Z","dependencies_parsed_at":"2024-05-04T00:23:37.128Z","dependency_job_id":"836bea73-881d-4162-b4d0-1b49b78b0c4e","html_url":"https://github.com/stacksjs/bun-plugin-dotenvx","commit_stats":null,"previous_names":["stacksjs/bun-plugin-env","stacksjs/bun-plugin-dotenvx"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fbun-plugin-dotenvx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fbun-plugin-dotenvx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fbun-plugin-dotenvx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fbun-plugin-dotenvx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stacksjs","download_url":"https://codeload.github.com/stacksjs/bun-plugin-dotenvx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685901,"owners_count":20979147,"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","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":["bun","dotenv","dotenvx","plugin","typescript"],"created_at":"2025-04-12T15:14:12.377Z","updated_at":"2026-03-03T08:34:47.581Z","avatar_url":"https://github.com/stacksjs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\".github/art/cover.jpg\" alt=\"Social Card of this repo\"\u003e\u003c/p\u003e\n\n[![npm version][npm-version-src]][npm-version-href]\n[![GitHub Actions][github-actions-src]][github-actions-href]\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n\n# bun-plugin-dotenvx\n\nA powerful loader for your dotenv files, powered by [dotenvx](https://dotenvx.com).\n\n## Features\n\n- **Multi-environment support** - Load different `.env` files for different environments\n- **Encrypted envs** - Securely store encrypted environment variables in your codebase\n- **Variable expansion** - Reference and expand variables already on your machine\n- **Command substitution** - Add the output of a command to your variables\n- **Configurable** - Customize the plugin with various options\n- Supports a wide variety of `.env` file types\n  - `.env`, `.env.local`, `.env.staging`, `.env.production`, `.env.development`, `.env.dev`, `.env.beta` etc.\n\n## Installation\n\n```bash\nbun install -d bun-plugin-dotenvx\n```\n\nNext, ensure you are preloading the plugin in your `bunfig.toml`:\n\n```toml\npreload = [\n  \"./node_modules/bun-plugin-dotenvx/dist/index.js\",\n  # ...\n]\n```\n\n## Basic Usage\n\nYou may now use the decrypted `.env` values in your project:\n\n```ts\nimport env from './.env'\n\n// Accessing environment variables\nconst apiKey = env.API_KEY\nconst databaseUrl = env.DATABASE_URL\n\nconsole.log(`API Key: ${apiKey}`)\nconsole.log(`Database URL: ${databaseUrl}`)\n```\n\n### VS Code Extension\n\nFor the best development experience, we recommend installing the [dotenvx VS Code extension](https://marketplace.visualstudio.com/items?itemName=dotenv.dotenvx-vscode). This extension provides syntax highlighting, encryption/decryption features, and other helpful tools directly in your editor.\n\n```bash\n# Install from VS Code marketplace\ncode --install-extension dotenv.dotenvx-vscode\n```\n\nOr search for \"dotenvx\" in the VS Code extensions marketplace.\n\nFor more information on dotenvx, visit [dotenvx.com](https://dotenvx.com).\n\n## Advanced Usage\n\n### Custom Configuration\n\nYou can customize the plugin by creating your own instance with specific options:\n\n```ts\nimport { plugin } from 'bun'\n// plugin.ts\nimport { createDotenvxPlugin } from 'bun-plugin-dotenvx'\n\n// Create a custom plugin instance\nconst dotenvxPlugin = createDotenvxPlugin({\n  path: ['.env.local', '.env'],\n  overload: true,\n  strict: true,\n  verbose: true,\n})\n\n// Register the plugin\nawait plugin(dotenvxPlugin)\n```\n\nThen in your `bunfig.toml`:\n\n```toml\npreload = [\n  \"./plugin.ts\",\n  # ...\n]\n```\n\n### Multi-Environment Support\n\nLoad different `.env` files for different environments:\n\n```ts\nimport { plugin } from 'bun'\n// development.ts\nimport { createDotenvxPlugin } from 'bun-plugin-dotenvx'\n\n// production.ts\n// import { createDotenvxPlugin } from 'bun-plugin-dotenvx'\n\nawait plugin(createDotenvxPlugin({\n  path: ['.env.development.local', '.env.development', '.env.local', '.env'],\n}))\n\nawait plugin(createDotenvxPlugin({\n  path: ['.env.production.local', '.env.production', '.env'],\n}))\n```\n\n### Encrypted Envs\n\nTo use encrypted environment variables:\n\n1. First, encrypt your `.env` file using dotenvx:\n\n```bash\nnpx @dotenvx/dotenvx encrypt\n```\n\n2. Then, use the plugin as normal, but make sure to set the `DOTENV_PRIVATE_KEY` environment variable:\n\n```bash\nDOTENV_PRIVATE_KEY=\"your-private-key\" bun run your-script.ts\n```\n\n### Configuration Options\n\nThe plugin supports the following options:\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `path` | `string \\| string[]` | `['.env']` | Path(s) to your env file(s) |\n| `overload` | `boolean` | `false` | Override existing env variables |\n| `strict` | `boolean` | `false` | Exit with code 1 if any errors are encountered |\n| `ignore` | `string[]` | `undefined` | Ignore specific errors |\n| `envKeysFile` | `string` | `'.env.keys'` | Path to your .env.keys file |\n| `convention` | `'nextjs'` | `undefined` | Load a .env convention |\n| `logLevel` | `string` | `'info'` | Set log level |\n| `quiet` | `boolean` | `false` | Suppress all output (except errors) |\n| `verbose` | `boolean` | `false` | Set log level to verbose |\n| `debug` | `boolean` | `false` | Set log level to debug |\n\n## Testing\n\n```bash\nbun test\n```\n\n## Changelog\n\nPlease see our [releases](https://github.com/stacksjs/bun-plugin-dotenvx/releases) page for more information on what has changed recently.\n\n## Contributing\n\nPlease review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.\n\n## Community\n\nFor help, discussion about best practices, or any other conversation that would benefit from being searchable:\n\n[Discussions on GitHub](https://github.com/stacksjs/stacks/discussions)\n\nFor casual chit-chat with others using this package:\n\n[Join the Stacks Discord Server](https://discord.gg/stacksjs)\n\n## Postcardware\n\n“Software that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where `bun-plugin-dotenvx` is being used! We showcase them on our website too.\n\nOur address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094 🌎\n\n## Sponsors\n\nWe would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.\n\n- [JetBrains](https://www.jetbrains.com/)\n- [The Solana Foundation](https://solana.com/)\n\n## Credits\n\nMany thanks to the following core technologies \u0026 people who have contributed to this package:\n\n- [Mot](https://github.com/motdotla) \u0026 [dotenv](https://github.com/motdotla/dotenv) \u0026 [dotenvx](https://github.com/dotenvx/dotenvx)\n- [Chris Breuer](https://github.com/chrisbbreuer)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.\n\nMade with 💙\n\n\u003c!-- Badges --\u003e\n[npm-version-src]: https://img.shields.io/npm/v/bun-plugin-dotenvx?style=flat-square\n[npm-version-href]: https://npmjs.com/package/bun-plugin-dotenvx\n\n[npm-downloads-src]: https://img.shields.io/npm/dm/bun-plugin-dotenvx?style=flat-square\n[npm-downloads-href]: https://npmjs.com/package/bun-plugin-dotenvx\n\n[github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/bun-plugin-dotenvx/ci.yml?style=flat-square\u0026branch=main\n[github-actions-href]: https://github.com/stacksjs/bun-plugin-dotenvx/actions?query=workflow%3Aci\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstacksjs%2Fbun-plugin-dotenvx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstacksjs%2Fbun-plugin-dotenvx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstacksjs%2Fbun-plugin-dotenvx/lists"}