{"id":26279534,"url":"https://github.com/stacksjs/vite-plugin-dotenvx","last_synced_at":"2025-05-07T03:04:16.367Z","repository":{"id":282085950,"uuid":"947439712","full_name":"stacksjs/vite-plugin-dotenvx","owner":"stacksjs","description":"A Vite plugin to seamlessly work with with dotenvx.","archived":false,"fork":false,"pushed_at":"2025-05-06T18:20:51.000Z","size":759,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T03:03:12.026Z","etag":null,"topics":["dotenvx","plugin","typescript","vite"],"latest_commit_sha":null,"homepage":"https://vite-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":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"github":["stacksjs","chrisbbreuer"],"open_collective":"stacksjs"}},"created_at":"2025-03-12T17:31:14.000Z","updated_at":"2025-04-17T08:04:13.000Z","dependencies_parsed_at":"2025-03-12T18:38:14.154Z","dependency_job_id":"6a1b9dda-9884-4830-859c-90bfbec5b722","html_url":"https://github.com/stacksjs/vite-plugin-dotenvx","commit_stats":null,"previous_names":["stacksjs/vite-plugin-dotenvx"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fvite-plugin-dotenvx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fvite-plugin-dotenvx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fvite-plugin-dotenvx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fvite-plugin-dotenvx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stacksjs","download_url":"https://codeload.github.com/stacksjs/vite-plugin-dotenvx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252804206,"owners_count":21806769,"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":["dotenvx","plugin","typescript","vite"],"created_at":"2025-03-14T14:15:19.720Z","updated_at":"2025-05-07T03:04:16.346Z","avatar_url":"https://github.com/stacksjs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/stacksjs","https://github.com/sponsors/chrisbbreuer","https://opencollective.com/stacksjs"],"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\u003c!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] --\u003e\n\u003c!-- [![Codecov][codecov-src]][codecov-href] --\u003e\n\n# vite-plugin-dotenvx\n\n\u003e A Vite plugin to seamlessly integrate with dotenvx.\n\n## Features\n\n- 🔐 **Decryption** _Automatically decrypts encrypted .env files using dotenvx_\n- 🌍 **Multi Env** _Supports multiple .env files \u0026 environment-specific configurations_\n- 🔄 **Variables** _Supports variable expansion \u0026 command substitution in your .env files_\n- 🏗️ **Build-Ready** _Works in both development \u0026 build modes with configurable options_\n- 📝 **Dev Tools** _Auto-generates .env.example files \u0026 updates .gitignore automatically_\n- 🔌 **Client Access** _Selectively expose environment variables to client-side code_\n- 🛡️ **Security** _Configurable error handling with strict mode \u0026 flexible configuration_\n\n## Install\n\n```bash\nnpm install -D vite-plugin-dotenvx\n# or\nyarn add -D vite-plugin-dotenvx\n# or\npnpm add -D vite-plugin-dotenvx\n# or\nbun add -D vite-plugin-dotenvx\n```\n\n## Get Started\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport Dotenvx from 'vite-plugin-dotenvx'\n\nexport default defineConfig({\n  plugins: [\n    Dotenvx({\n      enabled: true, // default: true\n      verbose: true, // default: false, enables detailed logging\n      path: ['.env', '.env.local'], // default: ['.env']\n      envKeysFile: '.env.keys', // default: '.env.keys'\n      overload: false, // default: false\n      convention: 'nextjs', // optional, load envs using a convention like Next.js\n    })\n  ]\n})\n```\n\n### Advanced Configuration\n\nHere's an example with all available options:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport Dotenvx from 'vite-plugin-dotenvx'\n\nexport default defineConfig({\n  plugins: [\n    Dotenvx({\n      // Basic options\n      enabled: true,\n      verbose: true,\n      path: ['.env.local', '.env'],\n      envKeysFile: '.env.keys',\n      overload: false,\n      convention: 'nextjs',\n\n      // Advanced options\n      applyInBuild: true, // Apply in build mode as well\n      strict: true, // Exit with code 1 if any errors are encountered\n      ignore: ['MISSING_ENV_FILE'], // Ignore specific errors\n      generateExample: true, // Auto-generate .env.example file\n      updateGitignore: true, // Auto-add .env.keys to .gitignore\n      exposeToClient: ['VITE_.*', 'PUBLIC_.*'], // Expose specific variables to client\n    })\n  ]\n})\n```\n\n## Usage with dotenvx\n\nThis plugin integrates with [dotenvx](https://github.com/dotenvx/dotenvx), a better dotenv from the creator of `dotenv`. It automatically decrypts encrypted .env files during development.\n\n### Encrypting your .env files\n\nGiven you installed `vite-plugin-dotenvx`, you may run the following command to encrypt your .env files:\n\n```bash\nbunx dotenvx encrypt\n```\n\nThis will encrypt your .env file and create a .env.keys file with the encryption keys.\n\n### Using encrypted .env files\n\nThe plugin will automatically decrypt your encrypted .env files during development. No additional configuration is needed.\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## Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `enabled` | `boolean` | `true` | Enable or disable the plugin |\n| `verbose` | `boolean` | `false` | Enable verbose logging |\n| `path` | `string \\| string[]` | `['.env']` | Path to .env file(s) |\n| `envKeysFile` | `string` | `'.env.keys'` | Path to .env.keys file |\n| `overload` | `boolean` | `false` | Override existing env variables |\n| `convention` | `string` | `undefined` | Load a .env convention (e.g., 'nextjs') |\n| `applyInBuild` | `boolean` | `false` | Apply the plugin in build mode as well |\n| `strict` | `boolean` | `false` | Exit with code 1 if any errors are encountered |\n| `ignore` | `string[]` | `undefined` | Ignore specific errors |\n| `generateExample` | `boolean` | `false` | Auto-generate .env.example file |\n| `updateGitignore` | `boolean` | `false` | Auto-add .env.keys to .gitignore |\n| `exposeToClient` | `string[]` | `[]` | Expose specific environment variables to the client |\n\n## Testing\n\n```bash\nbun test\n```\n\n## Changelog\n\nPlease see our [releases](https://github.com/stacksjs/vite-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 `vite-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, United States 🌎\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\n- [Mot](https://github.com/motdotla) for creating [dotenv](https://github.com/motdotla/dotenv) \u0026 [dotenvx](https://github.com/dotenvx/dotenvx)\n- [Chris Breuer](https://github.com/chrisbbreuer)\n- [All Contributors](https://github.com/stacksjs/vite-plugin-dotenvx/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/vite-plugin-dotenvx?style=flat-square\n[npm-version-href]: https://npmjs.com/package/vite-plugin-dotenvx\n[github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/vite-plugin-dotenvx/ci.yml?style=flat-square\u0026branch=main\n[github-actions-href]: https://github.com/stacksjs/vite-plugin-dotenvx/actions?query=workflow%3Aci\n\n\u003c!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/vite-plugin-dotenvx/main?style=flat-square\n[codecov-href]: https://codecov.io/gh/stacksjs/vite-plugin-dotenvx --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstacksjs%2Fvite-plugin-dotenvx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstacksjs%2Fvite-plugin-dotenvx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstacksjs%2Fvite-plugin-dotenvx/lists"}