{"id":24469090,"url":"https://github.com/node-ecosystem/universal-autorouter-hono","last_synced_at":"2026-02-27T20:15:23.646Z","repository":{"id":272038382,"uuid":"915309626","full_name":"node-ecosystem/universal-autorouter-hono","owner":"node-ecosystem","description":"Universal filesystem autoloader for Hono routes","archived":false,"fork":false,"pushed_at":"2025-01-13T22:58:08.000Z","size":345,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-28T22:03:40.047Z","etag":null,"topics":["api","api-rest","autoloader","bun","express-js","expressjs","filesystem","hmr","hono","nodejs","routes","vike","vite","web-server"],"latest_commit_sha":null,"homepage":"","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/node-ecosystem.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}},"created_at":"2025-01-11T14:17:25.000Z","updated_at":"2025-03-16T04:40:19.000Z","dependencies_parsed_at":"2025-01-11T17:11:34.785Z","dependency_job_id":"d12a9ffc-6d45-4340-a24f-7a1e5078e9f7","html_url":"https://github.com/node-ecosystem/universal-autorouter-hono","commit_stats":null,"previous_names":["node-ecosystem/universal-autorouter-hono"],"tags_count":6,"template":false,"template_full_name":"node-ecosystem/universal-autorouter","purl":"pkg:github/node-ecosystem/universal-autorouter-hono","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-ecosystem%2Funiversal-autorouter-hono","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-ecosystem%2Funiversal-autorouter-hono/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-ecosystem%2Funiversal-autorouter-hono/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-ecosystem%2Funiversal-autorouter-hono/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-ecosystem","download_url":"https://codeload.github.com/node-ecosystem/universal-autorouter-hono/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-ecosystem%2Funiversal-autorouter-hono/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29911567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"ssl_error","status_checked_at":"2026-02-27T19:37:41.463Z","response_time":57,"last_error":"SSL_read: 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":["api","api-rest","autoloader","bun","express-js","expressjs","filesystem","hmr","hono","nodejs","routes","vike","vite","web-server"],"created_at":"2025-01-21T07:14:08.549Z","updated_at":"2026-02-27T20:15:23.616Z","avatar_url":"https://github.com/node-ecosystem.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# universal-autorouter-hono\n\nAn plugin for [Hono](https://hono.dev) to add HMR (Hot Module Replacement) to Hono routes development.\n\nPackage required:\n- [universal-autorouter](https://github.com/node-ecosystem/universal-autorouter), used under the hood to autoload routes\n- [Vite](https://vite.dev), needed for _ViteDevServer instance_\n\n## ⚙️ Install\n\n```sh\nyarn add -D universal-autorouter-hono\n```\n\n## 📖 Usage\n\n### Register the Plugin\n\n```ts\n// /app.ts\nimport path from 'node:path'\nimport { serve } from '@hono/node-server'\nimport { Hono } from 'hono'\nimport type { AutoloadRoutesOptions } from 'universal-autorouter'\n\nconst app = new Hono()\n\nlet autoloadRoutes\n// Options of \"universal-autorouter\" or \"universal-autorouter-hono\" package\nconst autoloadRoutesOptions: AutoloadRoutesOptions = {\n  // Pattern to scan route files\n  pattern: '**/*.ts',\n  // Prefix to add to routes\n  prefix: '/api',\n  // Source directory for route handler files\n  routesDir: path.resolve(import.meta.dirname, 'api'),\n  // Directories for files used by route handler files (as default scan all files)\n  externalDirs: ['utils']\n}\nif (process.env.NODE_ENV === 'production') {\n  ({ default: autoloadRoutes } = await import('universal-autorouter'))\n  autoloadRoutesOptions.pattern = '**/*.mjs'\n} else {\n  ({ default: autoloadRoutes } = await import('universal-autorouter-hono'))\n  autoloadRoutesOptions.pattern = '**/*.ts'\n  autoloadRoutesOptions.viteDevServer = '\u003cViteDevServer_INSTANCE\u003e'\n  // Example with Vike package\n  // autoloadRoutesOptions.viteDevServer = globalThis.__vikeNode!.viteDevServer\n}\n\nawait autoloadRoutes(app, autoloadRoutesOptions)\n\nconst port = +(process.env.PORT || 3000)\n\nserve({\n  fetch: app.fetch,\n  port\n}, () =\u003e console.log(`Server running at http://localhost:${port}`))\n```\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-ecosystem%2Funiversal-autorouter-hono","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-ecosystem%2Funiversal-autorouter-hono","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-ecosystem%2Funiversal-autorouter-hono/lists"}