You add federation without leaving the framework you already use. hono, Express, Next, SvelteKit—import one bridge, and the same URL starts returning HTML to a browser and JSON-LD to a fedi client. No migration required.
The finesse of a bridge is in how it yields. If the errand isn't fedify's, it quietly hands off to the framework's next()—and with that one move, your existing routing and federation can share the same address.
Highlights
- The bridge hollo crosses is the hono one (about 200 lines). A bridge this short is possible because fedify speaks in the web-standard Request/Response.
- The nestjs bridge is a full DI module set (module + middleware + constants); the nuxt bridge is a Nuxt module with a runtime/ folder—the bridge's shape shifts to match each ecosystem's manners.
A passage from the sutra
export function federation<TContextData, THonoContext extends HonoContext>(
federation: Federation<TContextData>,
contextDataFactory: ContextDataFactory<TContextData, THonoContext>,
): HonoMiddleware<THonoContext> {
return async (ctx, next) => {
let contextData = contextDataFactory(ctx);
if (contextData instanceof Promise) contextData = await contextData;
return await federation.fetch(ctx.req.raw, {
contextData,
...integrateFetchOptions(ctx, next),
});
};
}