Vite is a highly extensible frontend build system that makes it easier to use UI frameworks with Hono. It supports TypeScript and ES modules natively, and offers:
If you need SSR or a more full-stack solution, Vike may be what you're looking for.
Vite uses official and community plugins to support integration with most mainstream UI frameworks. Plugins are also necessary to integrate with Hono's fetch-based API.
There are a number of official and community plugins for working with Hono and Vite.
- The Dev Server is required to run Hono + Vite projects locally.
- The Build plugin bundles code for production.
- The SSG plugin allows you to build a static site from your Hono app.
- SSR Components and Vite plugins. See Vike for a preconfigured solution.
::: warning
Vite brings its own CORS protection. Disable it to avoid conflicts if using hono/cors.
:::
The Dev Server plugin is an adapter for Hono's fetch-based API. It makes key features (e.g., hot module replacement on the client) available, and includes adapters for Node and Bun. If you are using Cloudflare, @cloudflare/vite-plugin is recommended instead.
::: info Vite will take over serving static files. You can override this behavior to serve static files from a Hono app. :::
To build your app for production, use the Build plugin.
Generate a static site from your Hono app with the SSG plugin.
Vite SSR Components replaces hono-vite-react-stack as the recommended approach for directly integrating Hono with Vite.
Vitest is recommended for running tests. For basic examples, check out the Testing guide.
::: info
Cloudflare provides a test environment and database mocking through @cloudflare/vitest-pool-workers.
:::
- With Hono JSX/DOM for a pure Hono stack
- With React
- Vitest + Cloudflare