Skip to content

Add Nuxt as a web framework option in fedify init#675

Merged
dahlia merged 6 commits intofedify-dev:mainfrom
2chanhaeng:init-nuxt
Apr 16, 2026
Merged

Add Nuxt as a web framework option in fedify init#675
dahlia merged 6 commits intofedify-dev:mainfrom
2chanhaeng:init-nuxt

Conversation

@2chanhaeng
Copy link
Copy Markdown
Contributor

Add Nuxt as a web framework option in fedify init

Depends on #674.

Changes

@fedify/init

  • Added Nuxt as a selectable web framework in fedify init.
    Users can now scaffold a new Fedify project with Nuxt integration
    across all supported package managers (npm, pnpm, yarn, Bun, Deno).

New files

  • src/webframeworks/nuxt.ts: WebFrameworkDescription for Nuxt,
    including nuxi init scaffolding command, dependency resolution for
    both Node.js and Deno environments, and template file mapping.
  • src/templates/nuxt/nuxt.config.ts.tpl: Minimal Nuxt config
    template with SSR disabled and devtools enabled.
  • src/templates/nuxt/server/federation.ts.tpl: Federation
    instance setup with MemoryKvStore and a basic actor dispatcher.
  • src/templates/nuxt/server/logging.ts.tpl: LogTape
    configuration for Nuxt and Fedify loggers.
  • src/templates/nuxt/server/middleware/federation.ts.tpl: Nitro
    event handler that delegates requests to federation.fetch(),
    falling through to Nuxt on 404.

Modified files

  • src/const.ts: Added "nuxt" to the WEB_FRAMEWORK array.
  • src/webframeworks/mod.ts: Imported and registered the Nuxt
    framework description.
  • src/json/deps.json: Added @nuxt/kit, h3, nuxi, and
    nuxt version pins.
  • src/test/port.ts: Added port replacement logic for Nuxt
    (injects nitro.port into nuxt.config.ts).

Co-Authored-By: GPT-5.4

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 407c6261-c666-414f-9690-ac77094f8292

📥 Commits

Reviewing files that changed from the base of the PR and between 8786258 and d825e08.

📒 Files selected for processing (8)
  • CHANGES.md
  • packages/init/src/const.ts
  • packages/init/src/json/deps.json
  • packages/init/src/templates/nuxt/nuxt.config.ts.tpl
  • packages/init/src/test/lookup.ts
  • packages/init/src/test/port.ts
  • packages/init/src/webframeworks/mod.ts
  • packages/init/src/webframeworks/nuxt.ts

📝 Walkthrough

Walkthrough

This PR adds Nuxt as a supported web framework option to the Fedify init scaffolding tool. It introduces Nuxt framework registry entry, configuration templates, dependency specifications, and initialization logic with package manager support and port/test handling.

Changes

Cohort / File(s) Summary
Documentation & Configuration
CHANGES.md, packages/init/src/const.ts
Added Nuxt changelog entry and included "nuxt" in the exported WEB_FRAMEWORK constant array.
Dependencies
packages/init/src/json/deps.json
Added four Nuxt-related dependencies: @nuxt/kit (^4.4.2), nuxi (^3.34.0), nuxt (^4.4.2), and h3 (^1.15.0).
Templates
packages/init/src/templates/nuxt/nuxt.config.ts.tpl
New Nuxt configuration template that enables the @fedify/nuxt module and sets federation module path and SSR configuration.
Framework Registry & Implementation
packages/init/src/webframeworks/mod.ts, packages/init/src/webframeworks/nuxt.ts
Added nuxt to the framework registry and implemented Nuxt initializer with command generation, dependency resolution, template processing, and environment configuration logic.
Test & Port Configuration
packages/init/src/test/port.ts, packages/init/src/test/lookup.ts
Added nuxt to port-from-environment frameworks list (short-circuits port replacement) and marked nuxt,deno combination as untestable due to remote package limitations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • dahlia
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding Nuxt as a web framework option in the fedify init command, which is the primary objective of the PR.
Description check ✅ Passed The description is highly detailed and directly related to the changeset, explaining the new Nuxt framework integration, listing all new and modified files with their purposes, and dependencies added.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@issues-auto-labeler issues-auto-labeler bot added component/cli CLI tools related component/federation Federation object related component/integration Web framework integration labels Apr 13, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the @fedify/nuxt package to provide seamless integration between Fedify and the Nuxt framework, alongside updates to the fedify init tool for project scaffolding. The review feedback correctly identifies a critical bug in the Nuxt middleware template where the request body is ignored during manual Request construction, suggesting the use of toWebRequest from h3 as a fix. Furthermore, the feedback recommends enabling the @fedify/nuxt module by default in generated projects to simplify the setup and points out a typo in the Node.js type definitions version.

Comment thread packages/init/src/templates/nuxt/server/middleware/federation.ts.tpl Outdated
Comment thread packages/init/src/webframeworks/nuxt.ts
Comment thread packages/init/src/templates/nuxt/server/middleware/federation.ts.tpl Outdated
Comment thread packages/init/src/templates/nuxt/nuxt.config.ts.tpl
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 26.58228% with 58 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/init/src/webframeworks/nuxt.ts 16.17% 57 Missing ⚠️
packages/init/src/test/port.ts 85.71% 1 Missing ⚠️
Files with missing lines Coverage Δ
packages/init/src/const.ts 100.00% <100.00%> (ø)
packages/init/src/test/lookup.ts 23.48% <100.00%> (+0.58%) ⬆️
packages/init/src/webframeworks/mod.ts 100.00% <100.00%> (ø)
packages/init/src/test/port.ts 14.52% <85.71%> (+4.09%) ⬆️
packages/init/src/webframeworks/nuxt.ts 16.17% <16.17%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@2chanhaeng 2chanhaeng force-pushed the init-nuxt branch 2 times, most recently from 950c914 to b4369b3 Compare April 13, 2026 17:36
@2chanhaeng
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/skills/create-example-app-with-integration/SKILL.md:
- Around line 178-182: Change the hard-coded curl example that uses
"localhost:0000" to a parameterized form so users must supply the correct host
and port; update the example text in SKILL.md (the curl example block) to use a
clear placeholder such as "{HOST}:{PORT}" or "${HOST}:${PORT}" and mention a
sensible default (e.g.,  localhost:3000) so readers can copy/paste and
substitute their actual port before running the curl command.

In `@packages/init/src/templates/nuxt/server/middleware/federation.ts.tpl`:
- Around line 13-16: The middleware currently sets the request "body" to
undefined for all methods because the ternary always returns undefined; update
the federation middleware so that when event.node.req.method is NOT in
["GET","HEAD","DELETE"] you read and forward the actual request payload (e.g.,
await readBody(event) or the equivalent helper) into the body field instead of
undefined, and ensure the same content-type is preserved when calling the Fedify
endpoint (reference the body: property and event.node.req.method in the
federation middleware).

In `@packages/init/src/test/port.ts`:
- Around line 148-157: The code inserts nitro.port into nuxt.config.ts but
Nuxt's dev server port is controlled by devServer.port; change the replacement
so that defineNuxtConfig({ includes `devServer: { port: ${newPort} },` instead
of `nitro: { port: ${newPort} },` (affecting the writeFile call that replaces
"defineNuxtConfig({"). Also update the nearby comment that currently mentions
"Insert server.port into the Nuxt config (via nitro config in nuxt.config.ts)"
to accurately say it inserts devServer.port for the Nuxt dev server; keep
references to wf, configPath, readFile, writeFile, newPort and defineNuxtConfig
to locate the change.

In `@packages/init/src/webframeworks/nuxt.ts`:
- Around line 70-83: getDeps currently omits installing the peer dependency
`@nuxt/kit` for non-Deno package managers, causing unmet peer warnings; update the
non-Deno branch of getDeps (the ternary branch that returns "@fedify/nuxt",
"h3", "nuxt") to also include "@nuxt/kit": deps["npm:`@nuxt/kit`"] (mirroring the
Deno branch), keeping PACKAGE_VERSION and defaultDenoDependencies untouched so
that PackageManager handling and Deno-specific entries remain the same.
- Around line 61-68: getNuxtInitCommand currently invokes unpinned nuxi (e.g.,
"npm:nuxi@latest" or bare "nuxi"); update it to use the pinned nuxi version from
deps.json (use the same helper that exposes pinned versions, e.g., getDeps() or
the deps object) so every branch uses nuxi@<pinnedVersion>. Concretely, obtain
the pinned nuxi version (e.g., const { nuxi } = getDeps()) and interpolate it
into the command strings: for bun use ["bunx", `nuxi@${nuxi}`], for deno use
["deno", "-A", `npm:nuxi@${nuxi}`], for npm use ["npx", `nuxi@${nuxi}`], and for
other package managers use [pm, "dlx", `nuxi@${nuxi}`]; update
getNuxtInitCommand to reference that pinned variable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: bd865655-4bd8-49e6-9fd3-c3268f58142d

📥 Commits

Reviewing files that changed from the base of the PR and between fe50936 and b4369b3.

⛔ Files ignored due to path filters (2)
  • deno.lock is excluded by !**/*.lock
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (35)
  • .agents/skills/add-to-fedify-init/SKILL.md
  • .agents/skills/create-example-app-with-integration/SKILL.md
  • .agents/skills/create-example-app-with-integration/example/README.md
  • .agents/skills/create-example-app-with-integration/example/src/logging.ts
  • .agents/skills/create-integration-package/SKILL.md
  • .hongdown.toml
  • AGENTS.md
  • CHANGES.md
  • CONTRIBUTING.md
  • cspell.json
  • deno.json
  • docs/manual/integration.md
  • mise.toml
  • packages/fedify/README.md
  • packages/init/src/const.ts
  • packages/init/src/json/deps.json
  • packages/init/src/templates/nuxt/nuxt.config.ts.tpl
  • packages/init/src/templates/nuxt/server/federation.ts.tpl
  • packages/init/src/templates/nuxt/server/logging.ts.tpl
  • packages/init/src/templates/nuxt/server/middleware/federation.ts.tpl
  • packages/init/src/test/port.ts
  • packages/init/src/webframeworks/mod.ts
  • packages/init/src/webframeworks/nuxt.ts
  • packages/nuxt/README.md
  • packages/nuxt/deno.json
  • packages/nuxt/package.json
  • packages/nuxt/src/mod.test.ts
  • packages/nuxt/src/mod.ts
  • packages/nuxt/src/module.ts
  • packages/nuxt/src/runtime/server/lib.ts
  • packages/nuxt/src/runtime/server/logic.ts
  • packages/nuxt/src/runtime/server/middleware.ts
  • packages/nuxt/src/runtime/server/plugin.ts
  • packages/nuxt/tsdown.config.ts
  • pnpm-workspace.yaml

Comment thread .agents/skills/create-example-app-with-integration/SKILL.md
Comment thread packages/init/src/templates/nuxt/server/middleware/federation.ts.tpl Outdated
Comment thread packages/init/src/test/port.ts Outdated
Comment thread packages/init/src/webframeworks/nuxt.ts
Comment thread packages/init/src/webframeworks/nuxt.ts
@2chanhaeng
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/init/src/templates/nuxt/nuxt.config.ts.tpl`:
- Line 4: Update the fedify configuration in the template so the
federationModule path uses a single tilde; specifically change the
fedify.federationModule value from "~~/server/federation" to
"~/server/federation" in nuxt.config.ts.tpl to match the `@fedify/nuxt` defaults
and docs.

In `@packages/init/src/webframeworks/nuxt.ts`:
- Around line 70-78: The Deno branch of getDeps currently omits the npm-scoped
peer dependency required by `@fedify/nuxt`; update the Deno case in getDeps to
include the explicit mapping for `@nuxt/kit` by merging defaultDenoDependencies
with an entry for "@nuxt/kit" using the pinned value from deps (e.g.
deps["npm:`@nuxt/kit`"]) alongside the existing "@fedify/nuxt": PACKAGE_VERSION so
Deno will resolve the peer dependency correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c0e3750d-63cf-4b3b-aa48-1e3d99d056e5

📥 Commits

Reviewing files that changed from the base of the PR and between b4369b3 and a10259f.

📒 Files selected for processing (4)
  • packages/init/src/templates/nuxt/nuxt.config.ts.tpl
  • packages/init/src/test/lookup.ts
  • packages/init/src/test/port.ts
  • packages/init/src/webframeworks/nuxt.ts

Comment thread packages/init/src/templates/nuxt/nuxt.config.ts.tpl Outdated
Comment thread packages/init/src/webframeworks/nuxt.ts
@2chanhaeng
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/skills/create-integration-package/SKILL.md:
- Around line 64-65: Replace the incorrect phrase "Use this commands" in
SKILL.md with "Use these commands" (locate the sentence containing "the
directory you created. Use this commands in the root path:") to fix grammar;
ensure the surrounding sentence remains unchanged except for that word
substitution.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 05538584-ad26-4a4b-8850-ffd1237469db

📥 Commits

Reviewing files that changed from the base of the PR and between a10259f and 8786258.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (17)
  • .agents/skills/create-example-app-with-integration/example/README.md
  • .agents/skills/create-integration-package/SKILL.md
  • CHANGES.md
  • packages/init/src/const.ts
  • packages/init/src/json/deps.json
  • packages/init/src/templates/nuxt/nuxt.config.ts.tpl
  • packages/init/src/test/lookup.ts
  • packages/init/src/test/port.ts
  • packages/init/src/webframeworks/mod.ts
  • packages/init/src/webframeworks/nuxt.ts
  • packages/nuxt/package.json
  • packages/nuxt/src/module.test.ts
  • packages/nuxt/src/module.ts
  • packages/nuxt/src/runtime/server/logic.test.ts
  • packages/nuxt/src/runtime/server/logic.ts
  • packages/nuxt/src/runtime/server/plugin.test.ts
  • packages/nuxt/src/runtime/server/plugin.ts

Comment thread .agents/skills/create-integration-package/SKILL.md Outdated
@2chanhaeng 2chanhaeng force-pushed the init-nuxt branch 3 times, most recently from bb22a01 to 2180e7e Compare April 15, 2026 08:55
@2chanhaeng 2chanhaeng marked this pull request as ready for review April 15, 2026 09:20
@2chanhaeng
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 15, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@dahlia dahlia merged commit d89091e into fedify-dev:main Apr 16, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/cli CLI tools related component/federation Federation object related component/integration Web framework integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants