Portfolio

Vite Plugin: Hono File Router


I recently created a file-based router for the hono web application framework. I really wanted to have a router that functions similarly to how SvelteKit does file-based routing, so I made this and so far I'm happy with it.

It still lacks some more basic functionality, and I have only developed this for the node ecosystem, but so far based on how I'm using it, it looks very promising. All the documentation is in the README.md in the github repo or in the npm package page. You may read there on how to use this.

Let me know what you think?

Update: I am developing a different vite plugin, named "vite-plugin-hono-file-route-generator". This is a simple vite plugin that scans a folder, grabs all default exports, and generates a js/ts file that exports an array for mounting. You can loop through this array and mount it to your Hono application. This is a simpler approach to creating a file-based router. This also exports the types that the routers emit which can be used to take advantage of hono's first-party support of RPC.

-