Skip to content

Commit 57ffc25

Browse files
committed
Create @fedify/nuxt with GPT-5.3-codex in one-shot
1 parent 77fccb1 commit 57ffc25

File tree

20 files changed

+4047
-418
lines changed

20 files changed

+4047
-418
lines changed

.hongdown.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ proper_nouns = [
2828
"@fedify/koa",
2929
"@fedify/mysql",
3030
"@fedify/nestjs",
31+
"@fedify/nuxt",
3132
"@fedify/postgres",
3233
"@fedify/redis",
3334
"@fedify/solidstart",

AGENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ for the complete package list.
8989

9090
- *packages/init/*: Project initializer (`@fedify/init`) for Fedify.
9191
Separated from `@fedify/cli` to enable standalone use.
92+
- *packages/nuxt/*: Nuxt integration (`@fedify/nuxt`) for Fedify.
9293
- *packages/create/*: Standalone CLI (`@fedify/create`)
9394
for creating new Fedify projects via `npm init @fedify`.
9495
- *docs/*: Documentation built with VitePress (see *docs/README.md*)
@@ -329,7 +330,8 @@ The monorepo uses different build processes for different packages:
329330
3. **Database adapters and integrations**: Use tsdown for TypeScript compilation:
330331
- *packages/amqp/*, *packages/astro/*, *packages/elysia*,
331332
*packages/express/*, *packages/h3/*,
332-
*packages/mysql/*, *packages/sqlite/*, *packages/postgres/*,
333+
*packages/mysql/*, *packages/nuxt/*, *packages/sqlite/*,
334+
*packages/postgres/*,
333335
*packages/redis/*, *packages/nestjs/*
334336
- Built to support Node.js and Bun environments
335337

CHANGES.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ To be released.
4747
[#601]: https://github.com/fedify-dev/fedify/pull/601
4848
[#652]: https://github.com/fedify-dev/fedify/pull/652
4949

50+
### @fedify/nuxt
51+
52+
- Added `@fedify/nuxt` package for integrating Fedify with [Nuxt].
53+
It provides a Nuxt module that delegates non-federation requests to Nuxt,
54+
supports shared-route content negotiation, and returns deferred
55+
`406 Not acceptable` when Fedify routes are requested without
56+
ActivityPub-compatible `Accept` headers and Nuxt has no matching page.
57+
[[#149] by ChanHaeng Lee]
58+
59+
[Nuxt]: https://nuxt.com/
60+
[#149]: https://github.com/fedify-dev/fedify/issues/149
61+
5062
### @fedify/init
5163

5264
- Fixed errors when using `fedify init` with certain web framework

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ The repository is organized as a monorepo with the following packages:
392392
- *packages/mysql/*: MySQL/MariaDB drivers (@fedify/mysql) for Fedify.
393393
- *packages/nestjs/*: NestJS integration (@fedify/nestjs) for Fedify.
394394
- *packages/next/*: Next.js integration (@fedify/next) for Fedify.
395+
- *packages/nuxt/*: Nuxt integration (@fedify/nuxt) for Fedify.
395396
- *packages/postgres/*: PostgreSQL drivers (@fedify/postgres) for Fedify.
396397
- *packages/redis/*: Redis drivers (@fedify/redis) for Fedify.
397398
- *packages/relay/*: ActivityPub relay support (@fedify/relay) for Fedify.

cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
"multitenancy",
7878
"Nexkey",
7979
"nodeinfo",
80+
"nuxi",
81+
"nuxt",
8082
"optique",
8183
"phensley",
8284
"Pico",

deno.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"./packages/koa",
1818
"./packages/lint",
1919
"./packages/mysql",
20+
"./packages/nuxt",
2021
"./packages/postgres",
2122
"./packages/redis",
2223
"./packages/relay",

deno.lock

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/manual/integration.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: >-
44
explains how to integrate Fedify with web frameworks.
55
---
66

7+
<!-- deno-fmt-ignore-file -->
8+
79
Integration
810
===========
911

@@ -359,6 +361,76 @@ app.use(router);
359361
[TanStack Start]: https://tanstack.com/start
360362

361363

364+
Nuxt
365+
----
366+
367+
_This API is available since Fedify 2.2.0._
368+
369+
[Nuxt] is a full-stack framework built on [Nitro] and [Vue]. The _@fedify/nuxt_
370+
package provides a Nuxt module that wires Fedify into Nitro middleware and
371+
performs deferred `406 Not Acceptable` handling for content negotiation:
372+
373+
::: code-group
374+
375+
~~~~ sh [Deno]
376+
deno add jsr:@fedify/nuxt
377+
~~~~
378+
379+
~~~~ sh [npm]
380+
npm add @fedify/nuxt
381+
~~~~
382+
383+
~~~~ sh [pnpm]
384+
pnpm add @fedify/nuxt
385+
~~~~
386+
387+
~~~~ sh [Yarn]
388+
yarn add @fedify/nuxt
389+
~~~~
390+
391+
~~~~ sh [Bun]
392+
bun add @fedify/nuxt
393+
~~~~
394+
395+
:::
396+
397+
Create your federation instance in _server/federation.ts_:
398+
399+
~~~~ typescript
400+
import { createFederation, MemoryKvStore } from "@fedify/fedify";
401+
402+
const federation = createFederation({
403+
kv: new MemoryKvStore(),
404+
});
405+
406+
export default federation;
407+
~~~~
408+
409+
Then enable the module in _nuxt.config.ts_:
410+
411+
~~~~ typescript
412+
export default defineNuxtConfig({
413+
modules: ["@fedify/nuxt"],
414+
});
415+
~~~~
416+
417+
By default, _@fedify/nuxt_ loads the federation instance from
418+
`~/server/federation`. You can customize module paths using `fedify` options:
419+
420+
~~~~ typescript
421+
export default defineNuxtConfig({
422+
modules: ["@fedify/nuxt"],
423+
fedify: {
424+
federationModule: "~/server/federation",
425+
contextDataFactoryModule: "~/server/fedify-context",
426+
},
427+
});
428+
~~~~
429+
430+
[Nuxt]: https://nuxt.com/
431+
[Vue]: https://vuejs.org/
432+
433+
362434
SvelteKit
363435
---------
364436

packages/fedify/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Here is the list of packages:
112112
| [@fedify/lint](/packages/lint/) | [JSR][jsr:@fedify/lint] | [npm][npm:@fedify/lint] | Linting utilities |
113113
| [@fedify/nestjs](/packages/nestjs/) | | [npm][npm:@fedify/nestjs] | NestJS integration |
114114
| [@fedify/next](/packages/next/) | | [npm][npm:@fedify/next] | Next.js integration |
115+
| [@fedify/nuxt](/packages/nuxt/) | [JSR][jsr:@fedify/nuxt] | [npm][npm:@fedify/nuxt] | Nuxt integration |
115116
| [@fedify/mysql](/packages/mysql/) | [JSR][jsr:@fedify/mysql] | [npm][npm:@fedify/mysql] | MySQL/MariaDB driver |
116117
| [@fedify/postgres](/packages/postgres/) | [JSR][jsr:@fedify/postgres] | [npm][npm:@fedify/postgres] | PostgreSQL driver |
117118
| [@fedify/redis](/packages/redis/) | [JSR][jsr:@fedify/redis] | [npm][npm:@fedify/redis] | Redis driver |
@@ -155,6 +156,8 @@ Here is the list of packages:
155156
[npm:@fedify/lint]: https://www.npmjs.com/package/@fedify/lint
156157
[npm:@fedify/nestjs]: https://www.npmjs.com/package/@fedify/nestjs
157158
[npm:@fedify/next]: https://www.npmjs.com/package/@fedify/next
159+
[jsr:@fedify/nuxt]: https://jsr.io/@fedify/nuxt
160+
[npm:@fedify/nuxt]: https://www.npmjs.com/package/@fedify/nuxt
158161
[jsr:@fedify/mysql]: https://jsr.io/@fedify/mysql
159162
[npm:@fedify/mysql]: https://www.npmjs.com/package/@fedify/mysql
160163
[jsr:@fedify/postgres]: https://jsr.io/@fedify/postgres

packages/nuxt/README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<!-- deno-fmt-ignore-file -->
2+
3+
@fedify/nuxt: Integrate Fedify with Nuxt
4+
========================================
5+
6+
[![JSR][JSR badge]][JSR]
7+
[![npm][npm badge]][npm]
8+
[![Matrix][Matrix badge]][Matrix]
9+
[![Follow @fedify@hollo.social][@fedify@hollo.social badge]][@fedify@hollo.social]
10+
11+
This package provides a simple way to integrate [Fedify] with [Nuxt].
12+
13+
Supported framework versions:
14+
15+
- Nuxt 4.x
16+
- Nitro 2.x (Nuxt 4 runtime)
17+
18+
[JSR badge]: https://jsr.io/badges/@fedify/nuxt
19+
[JSR]: https://jsr.io/@fedify/nuxt
20+
[npm badge]: https://img.shields.io/npm/v/@fedify/nuxt?logo=npm
21+
[npm]: https://www.npmjs.com/package/@fedify/nuxt
22+
[Matrix badge]: https://img.shields.io/matrix/fedify%3Amatrix.org
23+
[Matrix]: https://matrix.to/#/#fedify:matrix.org
24+
[@fedify@hollo.social badge]: https://fedi-badge.deno.dev/@fedify@hollo.social/followers.svg
25+
[@fedify@hollo.social]: https://hollo.social/@fedify
26+
[Fedify]: https://fedify.dev/
27+
[Nuxt]: https://nuxt.com/
28+
29+
30+
Installation
31+
------------
32+
33+
~~~~ bash
34+
deno add jsr:@fedify/nuxt
35+
# or
36+
npm add @fedify/nuxt
37+
# or
38+
pnpm add @fedify/nuxt
39+
# or
40+
yarn add @fedify/nuxt
41+
# or
42+
bun add @fedify/nuxt
43+
~~~~
44+
45+
46+
Usage
47+
-----
48+
49+
Create your `Federation` instance in *server/federation.ts*:
50+
51+
~~~~ typescript
52+
import { createFederation, MemoryKvStore } from "@fedify/fedify";
53+
54+
const federation = createFederation({
55+
kv: new MemoryKvStore(),
56+
});
57+
58+
// ... configure your federation ...
59+
60+
export default federation;
61+
~~~~
62+
63+
Then enable the Nuxt module in *nuxt.config.ts*:
64+
65+
~~~~ typescript
66+
export default defineNuxtConfig({
67+
modules: ["@fedify/nuxt"],
68+
});
69+
~~~~
70+
71+
By default, `@fedify/nuxt` loads your Federation instance from
72+
`~/server/federation`.
73+
74+
If your project uses a different file path or context data factory,
75+
configure the module options:
76+
77+
~~~~ typescript
78+
export default defineNuxtConfig({
79+
modules: ["@fedify/nuxt"],
80+
fedify: {
81+
federationModule: "~/server/federation",
82+
contextDataFactoryModule: "~/server/fedify-context",
83+
},
84+
});
85+
~~~~
86+
87+
The context data factory module should export either:
88+
89+
- default function, or
90+
- `contextDataFactory` named export
91+
92+
with this signature:
93+
94+
~~~~ typescript
95+
import type { ContextDataFactory } from "@fedify/nuxt";
96+
97+
const contextDataFactory: ContextDataFactory<unknown> = async (event, request) => {
98+
return {
99+
ip: event.node.req.socket.remoteAddress,
100+
method: request.method,
101+
};
102+
};
103+
104+
export default contextDataFactory;
105+
~~~~

0 commit comments

Comments
 (0)