@seamstack/hono
v0.2.0
Published
Hono backend adapter for SeamStack — mounts a Seam frontend on a Hono app and serves built assets.
Maintainers
Readme
@seamstack/hono
Hono backend adapter for SeamStack — mounts a Seam frontend on a Hono app and serves built assets.
pnpm add @seamstack/hono hono @hono/node-serverUsage
Wire the adapter in seam.config.ts:
import { defineWeave } from '@seamstack/cli'
import vite from '@seamstack/vite/adapter'
import hono from '@seamstack/hono/adapter'
export default defineWeave({
fabric: [vite({ root: './client' }), hono({ entry: './server/index.ts' })],
port: 4567,
})In your Hono server, destructure { inlay, host, port } from seam() and mount inlay after your routes:
import { Hono } from 'hono'
import { serve } from '@hono/node-server'
import { serveStatic } from '@hono/node-server/serve-static'
import { seam } from '@seamstack/hono'
const app = new Hono()
app.get('/api/hello', (c) => c.json({ msg: 'hi from hono' }))
const { inlay, host, port } = seam({ serveStatic })
app.use('*', inlay)
serve({ fetch: app.fetch, hostname: host, port }, () =>
console.log(`[hono] listening on http://${host}:${port}`),
)inlay is inert in dev (Vite/Astro/Angular handle the frontend then). In prod it serves the built SPA from the manifest written by seam build.
You pass your runtime's serveStatic factory in — @hono/node-server/serve-static for Node, hono/cloudflare-workers on the edge, etc. SeamStack stays runtime-agnostic.
More
See the SeamStack README for the bigger picture, the mix-and-match support table, and CLI docs.
