Deploy
Run vite build
to build your application into dist/
.
.
└── dist/
├── client/
│ ├── _immutable/
│ └── index.html
└── server/
├── app.js
└── (adapter-entry.js)
By default domco will generate a app.js
module and static assets for your application.
Example
If you are not using an adapter, you can import createApp
from the app.js
module and configure your app to use in one of Hono’s supported environments.
The client/
directory holds client assets. JS and CSS assets with hashed file names will be output to dist/client/_immutable/
, you can serve this path with immutable cache headers. Other assets are processed and included in dist/client/
directly.
Here’s an example of how to serve your app using the result of your build with @hono/node-server
.
// server.js
// import from build output
import { createApp } from "./dist/server/app.js";
import { serve } from "@hono/node-server";
import { serveStatic } from "@hono/node-server/serve-static";
const app = createApp({
middleware: [{ path: "/*", handler: serveStatic({ root: "./dist/client" }) }],
});
serve(app);
Run this module to start your server.
node server.js
Adapters
Add a deployment adapter within your Vite config to output your app to a different target with no additional configuration.
// vite.config
import { domco } from "domco";
// import adapter
import { adapter } from "domco/adapter/vercel";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
domco({
// add to your domco config
adapter: adapter({
// options...
}),
}),
],
});
Cloudflare
The Cloudflare adapter outputs your app to work on Cloudflare Pages.
- Functions run on the Workers Runtime.
- Outputs public assets to be served on Cloudflare’s CDN.
Vercel
The Vercel adapter outputs your app to the Build Output API specification.
- Functions run on Node.js, Node.js with ISR, or Edge Runtime.
- Outputs public assets to be served on Vercel’s Edge Network.
- Supports on demand Image Optimization when configured in the adapter config. Set the
src
attribute of an image using the/_vercel/image/...
optimized URL format. Indev
andpreview
modes, domco will redirect to the original image.