feat(examples,docs): migrate reference hubs to initHub; Nitro & Hono examples, Bun smoke, framework guides - #172
Open
antfubot wants to merge 1 commit into
Open
feat(examples,docs): migrate reference hubs to initHub; Nitro & Hono examples, Bun smoke, framework guides#172antfubot wants to merge 1 commit into
antfubot wants to merge 1 commit into
Conversation
… & Hono examples, Bun smoke, framework guides Both reference hosts now assemble through one initHub() call while keeping their hand-built viewer UIs as protocol demos: the Vite example shares Vite's own http server for the WS upgrade at /__devframes/__ws (zero extra ports) and the Next example collapses its encoded catch-all routes into a single app/%5F_devframes/[[...path]]/route.ts delegating to hub.handler. New minimal examples prove the middleware story end to end: - examples/nitro-devframe-hub — Nitro v3, one middleware delegation, devframe packages kept external so import.meta.url asset resolution survives bundling - examples/hono-devframe-hub — one runtime-agnostic app file served by @hono/node-server on Node and Bun.serve on Bun (fetch-upgrade tier); scripts/smoke-bun.ts exercises fetch + WS RPC + embedded.js on Bun initHub grows what the migrations needed: devframes entries with dock overrides, rpcDeclarations passthrough, a route-safe id guard (DF8004), a bind-retry for the auto side-car, and a buffered embedded.js body that survives dev-worker proxies. Docs: adapters/initiate (mount snippets for Vite/Nitro/Hono/Next/Nuxt/ SvelteKit, WS binding precedence, auth posture) and guide/hub-initiate (the namespace, the ui slot, single hub Auth, singular-vs-hub table).
atinux
reviewed
Aug 6, 2026
Comment on lines
+41
to
+51
| ```ts [Nitro] | ||
| // middleware/devtools.ts | ||
| import { defineHandler } from 'h3' | ||
| import { devtools } from '../devtools' | ||
|
|
||
| export default defineHandler((event) => { | ||
| const { pathname } = new URL(event.req.url) | ||
| if (pathname === '/__my-tool' || pathname.startsWith('/__my-tool/')) | ||
| return devtools.handler(event.req) | ||
| }) | ||
| ``` |
There was a problem hiding this comment.
Another solution is to create a server route, see: https://content.comark.dev/integrations/nitro#mount-the-handler
Suggested change
| ```ts [Nitro] | |
| // middleware/devtools.ts | |
| import { defineHandler } from 'h3' | |
| import { devtools } from '../devtools' | |
| export default defineHandler((event) => { | |
| const { pathname } = new URL(event.req.url) | |
| if (pathname === '/__my-tool' || pathname.startsWith('/__my-tool/')) | |
| return devtools.handler(event.req) | |
| }) | |
| ``` | |
| ```ts [Nitro] | |
| // routes/__my-tool/[...path].ts | |
| import { defineHandler } from 'nitro' | |
| import { devtools } from '../../devtools' | |
| export default defineHandler((event) => devtools.handler(event.req)) |
(not tested)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Top of the
/__devframes/standard-middleware stack (on #170). Seeplans/devframes-standard-middleware.md.Intent
Prove the whole stack end to end and document it:
examples/vite-devframe-hubandexamples/next-devframe-hubassemble through oneinitHub()call while keeping their hand-built viewer UIs as protocol demos. Vite shares its own http server for the WS upgrade at/__devframes/__ws(zero extra ports); Next collapses its encoded catch-all routes into oneapp/%5F_devframes/[[...path]]/route.tsdelegating tohub.handler.ui: createUi():nitro-devframe-hub(Nitro v3, one middleware delegation, devframe packages externalized soimport.meta.urlasset resolution survives bundling) andhono-devframe-hub(one runtime-agnostic app file —@hono/node-serveron Node,Bun.serve({ fetch, websocket })on Bun's fetch-upgrade tier).bun scripts/smoke-bun.tsboots the Hono hub underBun.serveand verifies discovery, a frame SPA,embedded.js, and a WS RPC round-trip over a same-origin upgrade — no side-car anywhere. Verified locally:adapters/initiate(mount snippets for Vite / Nitro / Hono / Next.js / Nuxt / SvelteKit, WS binding precedence, auth posture) andguide/hub-initiate(the namespace, theuislot, the single hub Auth, the singular-vs-hub table).devframesentries with dock overrides,rpcDeclarationspassthrough, route-safe id guard (DF8004), bind-retry for the auto side-car, bufferedembedded.jsbody that survives dev-worker proxies.Stack
Created with the help of an agent.