SSR / foldkit-host

The template and its build

Your page's server code is bundled into the Worker, while index.html comes from the browser build. Pair them with a shared buildId so a mismatched Worker and asset deployment fails loudly instead of hydrating the wrong bundle:

ts
// vite.config.ts: pass the same buildId to both plugins.
const buildId = crypto.randomUUID()
export const buildMeta = { name: 'build-id', transformIndexHtml: () => [Host.buildTag(buildId)] }
// plugins: [foldkit({ buildId }), buildMeta]

Host.template reads the tag back as buildId, which you pass to SSR.entry. Build your SSR.entry once per build via Host.isolate over the same binding, as examples/reference/src/worker.ts does.