{"_id":"@abyedev/hono-dotenv","name":"@abyedev/hono-dotenv","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@abyedev/hono-dotenv","version":"1.0.0","description":"Minimal .env loader and Hono middleware for Bun, Deno, and Node.js","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":"./dist/index.js"},"scripts":{"build":"tsc"},"keywords":["hono","dotenv","env","middleware","bun","deno","typescript"],"author":{"name":"abyedev","email":"me@abye.dev"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/arsybai/hono-dotenv.git"},"bugs":{"url":"https://github.com/arsybai/hono-dotenv/issues"},"homepage":"https://github.com/arsybai/hono-dotenv#readme","dependencies":{"hono":"^3.7.0"},"_id":"@abyedev/hono-dotenv@1.0.0","gitHead":"19a70b40b200d8d6a77e0e0b5a604233053ab3dc","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-93LZ6udvN366JCo1STVxFI7Dk1NMJBVgnoCsWFhU2INXygW0y4XLVAKeKCCexyBaRpgvtwfH+XfK+cOE5D8xCQ==","shasum":"a7e83f8163cc7032bd04cc92db588b81c0c4b995","tarball":"https://registry.npmjs.org/@abyedev/hono-dotenv/-/hono-dotenv-1.0.0.tgz","fileCount":9,"unpackedSize":8890,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD0aMovHD7i1BuxBEGM9iTPu51p1kX2Kkg5VOlHW1pHUAIhAMzqpQDVPRjxLgso/2Bb0mzwSa/fyLew2pzi+VXQQavK"}]},"_npmUser":{"name":"abyedev","email":"me@abye.dev"},"directories":{},"maintainers":[{"name":"abyedev","email":"me@abye.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hono-dotenv_1.0.0_1745211810855_0.8855759433399994"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-21T05:03:30.770Z","1.0.0":"2025-04-21T05:03:31.028Z","modified":"2025-04-21T05:03:31.321Z"},"maintainers":[{"name":"abyedev","email":"me@abye.dev"}],"description":"Minimal .env loader and Hono middleware for Bun, Deno, and Node.js","homepage":"https://github.com/arsybai/hono-dotenv#readme","keywords":["hono","dotenv","env","middleware","bun","deno","typescript"],"repository":{"type":"git","url":"git+https://github.com/arsybai/hono-dotenv.git"},"author":{"name":"abyedev","email":"me@abye.dev"},"bugs":{"url":"https://github.com/arsybai/hono-dotenv/issues"},"license":"MIT","readme":"# hono-dotenv\n\n> 🧃 A minimal `.env` loader + middleware for the [Hono](https://hono.dev) web framework — fully compatible with **Bun**, **Deno**, and **Node.js**.\n\nThis package lets you easily load environment variables from a `.env` file and inject them into the Hono `Context` as `c.env`.\n\n---\n\n## 🚀 Installation\n\n### With Bun\n```bash\nbun add hono-dotenv\n```\n\n### Or with npm\n```bash\nnpm install hono-dotenv\n```\n\n---\n\n## 📆 Usage\n\n```ts\nimport { Hono } from 'hono';\nimport { loadDotEnv, withEnv } from 'hono-dotenv';\n\nconst app = new Hono();\n\n// Load env from .env file\nconst envVars = loadDotEnv();\n\n// Inject to all routes\napp.use('*', withEnv(envVars));\n\napp.get('/', (c) => {\n  return c.text(`Hello from ${c.env.APP_NAME}, port ${c.env.PORT}`);\n});\n```\n\n### Example `.env` file\n\n```\nAPP_NAME=MyCoolApp\nPORT=3000\n```\n\n---\n\n## ✅ Features\n\n- 📄 Simple `.env` file parser\n- ⚡ Fast, zero-dependency, works with Bun\n- 🔒 Safe injection via middleware\n- 🧠 Fully typed for TypeScript (with IntelliSense)\n- 🔀 Works in all environments: Bun, Deno, Node.js\n\n---\n\n## 💡 How it works\n\n- `loadDotEnv(path)` — parses a `.env` file into `{ KEY: VALUE }`\n- `withEnv(vars)` — middleware to inject vars into `c.env`\n\nYou can now access any variable via `c.env.KEY` in any route handler.\n\n---\n\n## 🧪 Example Project\n\nCheck the [`example/`](./example/) directory for a working Bun app using `hono-dotenv`.\n\n---","readmeFilename":"README.md","_rev":"1-cf7df1603b3e8eccf60600d4a95da8e9"}