**Hono File-based Router** is a sample implementation of a file-based router for the Hono framework. It allows you to define routes in a file system structure, making it easier to manage and organize your routes.
npm install hono-file-based-routerHono File-based Router is a sample implementation of a file-based router for the Hono framework. It allows you to define routes in a file system structure, making it easier to manage and organize your routes.
This is a fork of the Honox (https://github.com/honojs/honox) project. I recommend using the original project for any new development.
- No Vite
- No Predefined island / hydration features
Honox needs Vite to both client and server side. When I migrate the existing project (Next.js) to Honox, it's hard to use Vite because it requires a lot of configuration and tricks (especially Common JS related things). I implemented the own filed-based routing with glob and import().
Honox's hydration features and Script / Link components are developed on top of Vite. So I just removed them. If you want to use hydration features, you can implement it by yourself. I did that with reading https://zenn.dev/kfly8/articles/sample-island-architecture-using-hono .
For Static Assets (client JS and CSS), You can implement that with sha-256 hash and glob to find the files. That's not as smart as Vite, but it works.
app/routes/render.tsx:
``tsx
import { jsxRenderer } from 'hono/jsx-renderer';
import { clientJsFilename, styleCssFilename } from '../libs/distHash';
export default jsxRenderer(({ children }) => {
return (
} rel="stylesheet" />