Loading .github/workflows/build.yaml +3 −0 Original line number Diff line number Diff line Loading @@ -431,6 +431,7 @@ jobs: | @fedify/express | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/express] | [npm][npm:@fedify/express] | | @fedify/h3 | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/h3] | [npm][npm:@fedify/h3] | | @fedify/hono | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/hono] | [npm][npm:@fedify/hono] | | @fedify/koa | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/koa] | [npm][npm:@fedify/koa] | | @fedify/nestjs | ${{ steps.versioning.outputs.version }} | | [npm][npm:@fedify/nestjs] | | @fedify/next | ${{ steps.versioning.outputs.version }} | | [npm][npm:@fedify/next] | | @fedify/postgres | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/postgres] | [npm][npm:@fedify/postgres] | Loading @@ -454,6 +455,8 @@ jobs: [npm:@fedify/h3]: https://www.npmjs.com/package/@fedify/h3/v/${{ steps.versioning.outputs.short_version }} [jsr:@fedify/hono]: https://jsr.io/@fedify/hono@${{ steps.versioning.outputs.version }} [npm:@fedify/hono]: https://www.npmjs.com/package/@fedify/hono/v/${{ steps.versioning.outputs.short_version }} [jsr:@fedify/koa]: https://jsr.io/@fedify/koa@${{ steps.versioning.outputs.version }} [npm:@fedify/koa]: https://www.npmjs.com/package/@fedify/koa/v/${{ steps.versioning.outputs.short_version }} [npm:@fedify/nestjs]: https://www.npmjs.com/package/@fedify/nestjs/v/${{ steps.versioning.outputs.short_version }} [npm:@fedify/next]: https://www.npmjs.com/package/@fedify/next/v/${{ steps.versioning.outputs.short_version }} [jsr:@fedify/postgres]: https://jsr.io/@fedify/postgres@${{ steps.versioning.outputs.version }} Loading CHANGES.md +15 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,21 @@ To be released. - Added CommonJS support alongside ESM for better compatibility with CommonJS-based Node.js applications. [[#429], [#431]] ### @fedify/koa - Created [Koa] integration as the *@fedify/koa* package. [[#454], [#455]] - Added `createMiddleware()` function for integrating Fedify into Koa applications. - Supports both Koa v2.x and v3.x via peer dependencies. - Converts between Koa's context-based API and Web Standards Request/Response. - Builds for both npm (ESM/CJS) and JSR distribution. [Koa]: https://koajs.com/ [#454]: https://github.com/fedify-dev/fedify/issues/454 [#455]: https://github.com/fedify-dev/fedify/pull/455 ### @fedify/next - Created [Next.js] integration as the *@fedify/next* package. Loading deno.json +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ "./packages/express", "./packages/h3", "./packages/hono", "./packages/koa", "./packages/postgres", "./packages/redis", "./packages/sqlite", Loading docs/.vitepress/config.mts +1 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ const REFERENCES = { { text: "@fedify/amqp", link: "https://jsr.io/@fedify/amqp/doc" }, { text: "@fedify/express", link: "https://jsr.io/@fedify/express/doc" }, { text: "@fedify/h3", link: "https://jsr.io/@fedify/h3/doc" }, { text: "@fedify/koa", link: "https://jsr.io/@fedify/koa/doc" }, { text: "@fedify/postgres", link: "https://jsr.io/@fedify/postgres/doc" }, { text: "@fedify/redis", link: "https://jsr.io/@fedify/redis/doc" }, { text: "@fedify/sqlite", link: "https://jsr.io/@fedify/sqlite/doc" }, Loading docs/manual/integration.md +61 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ How it works Usually, Fedify behaves as a middleware that wraps around the web framework's request handler. The middleware intercepts the incoming HTTP requests and dispatches them to the appropriate handler based on the request path and the `Accept` header (i.e., [content negotiation]). Basically, this architecture the [`Accept`] header (i.e., [content negotiation]). Basically, this architecture allows Fedify and your web framework to coexist in the same domain and port. For example, if you make a request to */.well-known/webfinger* Fedify will Loading Loading @@ -66,6 +66,7 @@ sequenceDiagram > the communication between the two services (using a message queue or RPC, > for example), which is non-trivial. [`Accept`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept [content negotiation]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation Loading Loading @@ -120,6 +121,63 @@ app.use(integrateFederation(federation, (req) => "context data goes here")); // [Express]: https://expressjs.com/ Koa --- *This API is available since Fedify 1.9.0.* [Koa] is a lightweight, expressive, and modern web framework for Node.js, designed by the team behind Express. It uses async functions and provides a more elegant middleware architecture. The *@fedify/koa* package provides a middleware to integrate Fedify with Koa: ::: code-group ~~~~ sh [Deno] deno add jsr:@fedify/koa ~~~~ ~~~~ sh [npm] npm add @fedify/koa ~~~~ ~~~~ sh [pnpm] pnpm add @fedify/koa ~~~~ ~~~~ sh [Yarn] yarn add @fedify/koa ~~~~ ~~~~ sh [Bun] bun add @fedify/koa ~~~~ ::: ~~~~ typescript twoslash // @noErrors: 2345 import Koa from "koa"; import { createMiddleware } from "@fedify/koa"; import { createFederation } from "@fedify/fedify"; export const federation = createFederation<string>({ // Omitted for brevity; see the related section for details. }); export const app = new Koa(); app.proxy = true; // trust proxy headers app.use(createMiddleware(federation, (ctx) => "context data goes here")); // [!code highlight] ~~~~ > [!NOTE] > The `@fedify/koa` package supports both Koa v2.x and v3.x. [Koa]: https://koajs.com/ Hono ---- Loading Loading @@ -673,9 +731,9 @@ As you can see in the comment, you can handle other requests besides federation requests in the middleware. If you handle only federation requests in the middleware, you can omit the function argument of `fedifyWith()`. The `config` object is necessary to let Next.js know that the middleware should process requests with the `Accept` header matching the federation should process requests with the [`Accept`] header matching the federation accept regex. This is because Next.js middleware processes only requests with the `Accept` header matching the regex by default. More details can be with the [`Accept`] header matching the regex by default. More details can be found in the Next.js official documentation [`config` in `middleware.js`]. [Next.js]: https://nextjs.org/ Loading Loading
.github/workflows/build.yaml +3 −0 Original line number Diff line number Diff line Loading @@ -431,6 +431,7 @@ jobs: | @fedify/express | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/express] | [npm][npm:@fedify/express] | | @fedify/h3 | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/h3] | [npm][npm:@fedify/h3] | | @fedify/hono | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/hono] | [npm][npm:@fedify/hono] | | @fedify/koa | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/koa] | [npm][npm:@fedify/koa] | | @fedify/nestjs | ${{ steps.versioning.outputs.version }} | | [npm][npm:@fedify/nestjs] | | @fedify/next | ${{ steps.versioning.outputs.version }} | | [npm][npm:@fedify/next] | | @fedify/postgres | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/postgres] | [npm][npm:@fedify/postgres] | Loading @@ -454,6 +455,8 @@ jobs: [npm:@fedify/h3]: https://www.npmjs.com/package/@fedify/h3/v/${{ steps.versioning.outputs.short_version }} [jsr:@fedify/hono]: https://jsr.io/@fedify/hono@${{ steps.versioning.outputs.version }} [npm:@fedify/hono]: https://www.npmjs.com/package/@fedify/hono/v/${{ steps.versioning.outputs.short_version }} [jsr:@fedify/koa]: https://jsr.io/@fedify/koa@${{ steps.versioning.outputs.version }} [npm:@fedify/koa]: https://www.npmjs.com/package/@fedify/koa/v/${{ steps.versioning.outputs.short_version }} [npm:@fedify/nestjs]: https://www.npmjs.com/package/@fedify/nestjs/v/${{ steps.versioning.outputs.short_version }} [npm:@fedify/next]: https://www.npmjs.com/package/@fedify/next/v/${{ steps.versioning.outputs.short_version }} [jsr:@fedify/postgres]: https://jsr.io/@fedify/postgres@${{ steps.versioning.outputs.version }} Loading
CHANGES.md +15 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,21 @@ To be released. - Added CommonJS support alongside ESM for better compatibility with CommonJS-based Node.js applications. [[#429], [#431]] ### @fedify/koa - Created [Koa] integration as the *@fedify/koa* package. [[#454], [#455]] - Added `createMiddleware()` function for integrating Fedify into Koa applications. - Supports both Koa v2.x and v3.x via peer dependencies. - Converts between Koa's context-based API and Web Standards Request/Response. - Builds for both npm (ESM/CJS) and JSR distribution. [Koa]: https://koajs.com/ [#454]: https://github.com/fedify-dev/fedify/issues/454 [#455]: https://github.com/fedify-dev/fedify/pull/455 ### @fedify/next - Created [Next.js] integration as the *@fedify/next* package. Loading
deno.json +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ "./packages/express", "./packages/h3", "./packages/hono", "./packages/koa", "./packages/postgres", "./packages/redis", "./packages/sqlite", Loading
docs/.vitepress/config.mts +1 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ const REFERENCES = { { text: "@fedify/amqp", link: "https://jsr.io/@fedify/amqp/doc" }, { text: "@fedify/express", link: "https://jsr.io/@fedify/express/doc" }, { text: "@fedify/h3", link: "https://jsr.io/@fedify/h3/doc" }, { text: "@fedify/koa", link: "https://jsr.io/@fedify/koa/doc" }, { text: "@fedify/postgres", link: "https://jsr.io/@fedify/postgres/doc" }, { text: "@fedify/redis", link: "https://jsr.io/@fedify/redis/doc" }, { text: "@fedify/sqlite", link: "https://jsr.io/@fedify/sqlite/doc" }, Loading
docs/manual/integration.md +61 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ How it works Usually, Fedify behaves as a middleware that wraps around the web framework's request handler. The middleware intercepts the incoming HTTP requests and dispatches them to the appropriate handler based on the request path and the `Accept` header (i.e., [content negotiation]). Basically, this architecture the [`Accept`] header (i.e., [content negotiation]). Basically, this architecture allows Fedify and your web framework to coexist in the same domain and port. For example, if you make a request to */.well-known/webfinger* Fedify will Loading Loading @@ -66,6 +66,7 @@ sequenceDiagram > the communication between the two services (using a message queue or RPC, > for example), which is non-trivial. [`Accept`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept [content negotiation]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation Loading Loading @@ -120,6 +121,63 @@ app.use(integrateFederation(federation, (req) => "context data goes here")); // [Express]: https://expressjs.com/ Koa --- *This API is available since Fedify 1.9.0.* [Koa] is a lightweight, expressive, and modern web framework for Node.js, designed by the team behind Express. It uses async functions and provides a more elegant middleware architecture. The *@fedify/koa* package provides a middleware to integrate Fedify with Koa: ::: code-group ~~~~ sh [Deno] deno add jsr:@fedify/koa ~~~~ ~~~~ sh [npm] npm add @fedify/koa ~~~~ ~~~~ sh [pnpm] pnpm add @fedify/koa ~~~~ ~~~~ sh [Yarn] yarn add @fedify/koa ~~~~ ~~~~ sh [Bun] bun add @fedify/koa ~~~~ ::: ~~~~ typescript twoslash // @noErrors: 2345 import Koa from "koa"; import { createMiddleware } from "@fedify/koa"; import { createFederation } from "@fedify/fedify"; export const federation = createFederation<string>({ // Omitted for brevity; see the related section for details. }); export const app = new Koa(); app.proxy = true; // trust proxy headers app.use(createMiddleware(federation, (ctx) => "context data goes here")); // [!code highlight] ~~~~ > [!NOTE] > The `@fedify/koa` package supports both Koa v2.x and v3.x. [Koa]: https://koajs.com/ Hono ---- Loading Loading @@ -673,9 +731,9 @@ As you can see in the comment, you can handle other requests besides federation requests in the middleware. If you handle only federation requests in the middleware, you can omit the function argument of `fedifyWith()`. The `config` object is necessary to let Next.js know that the middleware should process requests with the `Accept` header matching the federation should process requests with the [`Accept`] header matching the federation accept regex. This is because Next.js middleware processes only requests with the `Accept` header matching the regex by default. More details can be with the [`Accept`] header matching the regex by default. More details can be found in the Next.js official documentation [`config` in `middleware.js`]. [Next.js]: https://nextjs.org/ Loading