@nuxt/docs 4.2.1 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/1.getting-started/01.introduction.md +1 -1
- package/1.getting-started/02.installation.md +2 -5
- package/1.getting-started/03.configuration.md +27 -27
- package/1.getting-started/04.views.md +5 -5
- package/1.getting-started/05.assets.md +7 -7
- package/1.getting-started/06.styling.md +9 -5
- package/1.getting-started/07.routing.md +8 -8
- package/1.getting-started/08.seo-meta.md +7 -3
- package/1.getting-started/09.transitions.md +6 -6
- package/1.getting-started/10.data-fetching.md +2 -2
- package/1.getting-started/11.state-management.md +2 -2
- package/1.getting-started/12.error-handling.md +15 -9
- package/1.getting-started/13.server.md +2 -2
- package/1.getting-started/14.layers.md +50 -16
- package/1.getting-started/15.prerendering.md +6 -0
- package/1.getting-started/16.deployment.md +2 -1
- package/1.getting-started/17.testing.md +44 -3
- package/1.getting-started/18.upgrade.md +37 -24
- package/{2.guide/1.directory-structure → 2.directory-structure}/0.nuxt.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/0.output.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.assets.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.components.md +6 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.composables.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.layouts.md +35 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.middleware.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.pages.md +28 -7
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.plugins.md +5 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.utils.md +3 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/3.app.md +4 -4
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/3.error.md +10 -8
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.content.md +2 -2
- package/2.directory-structure/1.layers.md +87 -0
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.modules.md +13 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.node_modules.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.server.md +27 -7
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.shared.md +3 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.env.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.nuxtignore.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.nuxtrc.md +4 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.nuxt-config.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.package.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.tsconfig.md +1 -0
- package/2.directory-structure/index.md +65 -0
- package/{2.guide → 3.guide}/0.index.md +10 -7
- package/{2.guide/2.concepts/3.rendering.md → 3.guide/1.concepts/1.rendering.md} +2 -27
- package/{2.guide/2.concepts/2.vuejs-development.md → 3.guide/1.concepts/10.vuejs-development.md} +4 -3
- package/{2.guide/2.concepts/10.nuxt-lifecycle.md → 3.guide/1.concepts/2.nuxt-lifecycle.md} +33 -26
- package/{2.guide/2.concepts/1.auto-imports.md → 3.guide/1.concepts/3.auto-imports.md} +5 -5
- package/{2.guide/2.concepts → 3.guide/1.concepts}/4.server-engine.md +3 -3
- package/{2.guide/2.concepts → 3.guide/1.concepts}/5.modules.md +15 -2
- package/{2.guide/2.concepts → 3.guide/1.concepts}/7.esm.md +1 -0
- package/{2.guide/2.concepts → 3.guide/1.concepts}/8.typescript.md +9 -5
- package/{2.guide/5.best-practices → 3.guide/2.best-practices}/performance.md +2 -2
- package/3.guide/3.ai/.navigation.yml +3 -0
- package/3.guide/3.ai/1.mcp.md +277 -0
- package/3.guide/3.ai/2.llms-txt.md +65 -0
- package/3.guide/4.modules/.navigation.yml +3 -0
- package/3.guide/4.modules/1.getting-started.md +103 -0
- package/3.guide/4.modules/2.module-anatomy.md +138 -0
- package/3.guide/4.modules/3.recipes-basics.md +330 -0
- package/3.guide/4.modules/4.recipes-advanced.md +243 -0
- package/3.guide/4.modules/5.testing.md +76 -0
- package/3.guide/4.modules/6.best-practices.md +104 -0
- package/3.guide/4.modules/7.ecosystem.md +32 -0
- package/3.guide/4.modules/index.md +36 -0
- package/{2.guide/4.recipes → 3.guide/5.recipes}/1.custom-routing.md +1 -1
- package/{2.guide/4.recipes → 3.guide/5.recipes}/2.vite-plugin.md +5 -1
- package/{2.guide/4.recipes → 3.guide/5.recipes}/3.custom-usefetch.md +2 -2
- package/{2.guide/4.recipes → 3.guide/5.recipes}/4.sessions-and-authentication.md +2 -2
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.events.md +2 -3
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.experimental-features.md +19 -4
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.internals.md +5 -4
- package/{2.guide/3.going-further → 3.guide/6.going-further}/10.runtime-config.md +3 -3
- package/{2.guide/3.going-further → 3.guide/6.going-further}/2.hooks.md +3 -3
- package/{2.guide/3.going-further → 3.guide/6.going-further}/4.kit.md +1 -1
- package/{2.guide/3.going-further → 3.guide/6.going-further}/6.nuxt-app.md +3 -3
- package/{2.guide/3.going-further → 3.guide/6.going-further}/7.layers.md +38 -12
- package/{3.api → 4.api}/1.components/1.nuxt-client-fallback.md +4 -0
- package/{3.api → 4.api}/1.components/12.nuxt-route-announcer.md +1 -3
- package/{3.api → 4.api}/1.components/13.nuxt-time.md +0 -2
- package/{3.api → 4.api}/1.components/2.nuxt-page.md +2 -2
- package/{3.api → 4.api}/1.components/3.nuxt-layout.md +6 -6
- package/{3.api → 4.api}/1.components/5.nuxt-loading-indicator.md +1 -1
- package/{3.api → 4.api}/1.components/7.nuxt-welcome.md +2 -2
- package/{3.api → 4.api}/1.components/8.nuxt-island.md +9 -2
- package/{3.api → 4.api}/2.composables/use-app-config.md +1 -1
- package/{3.api → 4.api}/2.composables/use-async-data.md +3 -3
- package/4.api/2.composables/use-cookie.md +183 -0
- package/{3.api → 4.api}/2.composables/use-error.md +2 -2
- package/{3.api → 4.api}/2.composables/use-fetch.md +33 -33
- package/{3.api → 4.api}/2.composables/use-head.md +16 -1
- package/{3.api → 4.api}/2.composables/use-lazy-fetch.md +8 -8
- package/{3.api → 4.api}/2.composables/use-nuxt-app.md +6 -4
- package/{3.api → 4.api}/2.composables/use-response-header.md +1 -1
- package/{3.api → 4.api}/2.composables/use-route-announcer.md +0 -2
- package/{3.api → 4.api}/2.composables/use-route.md +1 -1
- package/{3.api → 4.api}/2.composables/use-router.md +2 -2
- package/{3.api → 4.api}/2.composables/use-runtime-config.md +1 -1
- package/{3.api → 4.api}/2.composables/use-state.md +10 -0
- package/{3.api → 4.api}/3.utils/$fetch.md +1 -1
- package/{3.api → 4.api}/3.utils/abort-navigation.md +1 -1
- package/{3.api → 4.api}/3.utils/add-route-middleware.md +1 -1
- package/{3.api → 4.api}/3.utils/call-once.md +0 -2
- package/{3.api → 4.api}/3.utils/create-error.md +6 -6
- package/{3.api → 4.api}/3.utils/define-nuxt-plugin.md +12 -12
- package/{3.api → 4.api}/3.utils/define-nuxt-route-middleware.md +2 -2
- package/{3.api → 4.api}/3.utils/define-page-meta.md +14 -7
- package/{3.api → 4.api}/3.utils/navigate-to.md +10 -10
- package/{3.api → 4.api}/3.utils/refresh-cookie.md +0 -2
- package/{3.api → 4.api}/3.utils/set-page-layout.md +36 -0
- package/{3.api → 4.api}/3.utils/set-response-status.md +2 -2
- package/{3.api → 4.api}/3.utils/show-error.md +3 -3
- package/{3.api → 4.api}/3.utils/update-app-config.md +2 -2
- package/{3.api → 4.api}/4.commands/add.md +11 -11
- package/4.api/4.commands/analyze.md +42 -0
- package/4.api/4.commands/build-module.md +42 -0
- package/4.api/4.commands/build.md +47 -0
- package/{3.api → 4.api}/4.commands/cleanup.md +6 -6
- package/4.api/4.commands/dev.md +60 -0
- package/{3.api → 4.api}/4.commands/devtools.md +7 -7
- package/4.api/4.commands/generate.md +42 -0
- package/4.api/4.commands/info.md +33 -0
- package/4.api/4.commands/init.md +50 -0
- package/4.api/4.commands/module.md +84 -0
- package/4.api/4.commands/prepare.md +41 -0
- package/4.api/4.commands/preview.md +44 -0
- package/4.api/4.commands/test.md +40 -0
- package/4.api/4.commands/typecheck.md +44 -0
- package/4.api/4.commands/upgrade.md +37 -0
- package/{3.api → 4.api}/5.kit/1.modules.md +30 -17
- package/{3.api → 4.api}/5.kit/10.templates.md +23 -23
- package/{3.api → 4.api}/5.kit/11.nitro.md +35 -35
- package/{3.api → 4.api}/5.kit/14.builder.md +29 -17
- package/{3.api → 4.api}/5.kit/16.layers.md +12 -12
- package/{3.api → 4.api}/5.kit/2.programmatic.md +2 -2
- package/{3.api → 4.api}/5.kit/4.autoimports.md +18 -18
- package/4.api/5.kit/5.components.md +146 -0
- package/4.api/6.advanced/1.hooks.md +105 -0
- package/{3.api → 4.api}/6.nuxt-config.md +7 -6
- package/5.community/4.contribution.md +5 -5
- package/5.community/5.framework-contribution.md +1 -1
- package/5.community/6.roadmap.md +25 -25
- package/5.community/7.changelog.md +20 -0
- package/6.bridge/1.overview.md +9 -1
- package/6.bridge/2.typescript.md +1 -1
- package/6.bridge/3.bridge-composition-api.md +1 -1
- package/6.bridge/4.plugins-and-middleware.md +3 -3
- package/6.bridge/8.nitro.md +4 -0
- package/7.migration/11.server.md +1 -1
- package/7.migration/2.configuration.md +4 -4
- package/7.migration/20.module-authors.md +3 -3
- package/7.migration/3.auto-imports.md +1 -1
- package/7.migration/5.plugins-and-middleware.md +2 -2
- package/7.migration/6.pages-and-layouts.md +6 -6
- package/7.migration/7.component-options.md +1 -1
- package/package.json +1 -1
- package/2.guide/3.going-further/3.modules.md +0 -968
- package/3.api/2.composables/use-cookie.md +0 -183
- package/3.api/4.commands/analyze.md +0 -42
- package/3.api/4.commands/build-module.md +0 -42
- package/3.api/4.commands/build.md +0 -47
- package/3.api/4.commands/dev.md +0 -60
- package/3.api/4.commands/generate.md +0 -42
- package/3.api/4.commands/info.md +0 -33
- package/3.api/4.commands/init.md +0 -50
- package/3.api/4.commands/module.md +0 -84
- package/3.api/4.commands/prepare.md +0 -41
- package/3.api/4.commands/preview.md +0 -44
- package/3.api/4.commands/test.md +0 -40
- package/3.api/4.commands/typecheck.md +0 -44
- package/3.api/4.commands/upgrade.md +0 -37
- package/3.api/5.kit/5.components.md +0 -146
- package/3.api/6.advanced/1.hooks.md +0 -105
- /package/{2.guide/1.directory-structure → 2.directory-structure}/.navigation.yml +0 -0
- /package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/.navigation.yml +0 -0
- /package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/3.app-config.md +0 -0
- /package/{2.guide/1.directory-structure → 2.directory-structure}/1.public.md +0 -0
- /package/{2.guide/1.directory-structure → 2.directory-structure}/2.gitignore.md +0 -0
- /package/{2.guide → 3.guide}/.navigation.yml +0 -0
- /package/{2.guide/2.concepts → 3.guide/1.concepts}/.navigation.yml +0 -0
- /package/{2.guide/2.concepts → 3.guide/1.concepts}/9.code-style.md +0 -0
- /package/{2.guide/5.best-practices → 3.guide/2.best-practices}/.navigation.yml +0 -0
- /package/{2.guide/5.best-practices → 3.guide/2.best-practices}/hydration.md +0 -0
- /package/{2.guide/5.best-practices → 3.guide/2.best-practices}/plugins.md +0 -0
- /package/{2.guide/4.recipes → 3.guide/5.recipes}/.navigation.yml +0 -0
- /package/{2.guide/3.going-further → 3.guide/6.going-further}/.navigation.yml +0 -0
- /package/{2.guide/3.going-further → 3.guide/6.going-further}/1.features.md +0 -0
- /package/{2.guide/3.going-further → 3.guide/6.going-further}/11.nightly-release-channel.md +0 -0
- /package/{2.guide/3.going-further → 3.guide/6.going-further}/9.debugging.md +0 -0
- /package/{2.guide/3.going-further → 3.guide/6.going-further}/index.md +0 -0
- /package/{3.api → 4.api}/.navigation.yml +0 -0
- /package/{3.api → 4.api}/1.components/.navigation.yml +0 -0
- /package/{3.api → 4.api}/1.components/1.client-only.md +0 -0
- /package/{3.api → 4.api}/1.components/1.dev-only.md +0 -0
- /package/{3.api → 4.api}/1.components/10.nuxt-picture.md +0 -0
- /package/{3.api → 4.api}/1.components/11.teleports.md +0 -0
- /package/{3.api → 4.api}/1.components/4.nuxt-link.md +0 -0
- /package/{3.api → 4.api}/1.components/6.nuxt-error-boundary.md +0 -0
- /package/{3.api → 4.api}/1.components/9.nuxt-img.md +0 -0
- /package/{3.api → 4.api}/2.composables/.navigation.yml +0 -0
- /package/{3.api → 4.api}/2.composables/on-prehydrate.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-head-safe.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-hydration.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-lazy-async-data.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-loading-indicator.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-nuxt-data.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-preview-mode.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-event.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-fetch.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-header.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-headers.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-url.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-runtime-hook.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-seo-meta.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-server-seo-meta.md +0 -0
- /package/{3.api → 4.api}/3.utils/.navigation.yml +0 -0
- /package/{3.api → 4.api}/3.utils/clear-error.md +0 -0
- /package/{3.api → 4.api}/3.utils/clear-nuxt-data.md +0 -0
- /package/{3.api → 4.api}/3.utils/clear-nuxt-state.md +0 -0
- /package/{3.api → 4.api}/3.utils/define-lazy-hydration-component.md +0 -0
- /package/{3.api → 4.api}/3.utils/define-nuxt-component.md +0 -0
- /package/{3.api → 4.api}/3.utils/define-route-rules.md +0 -0
- /package/{3.api → 4.api}/3.utils/on-before-route-leave.md +0 -0
- /package/{3.api → 4.api}/3.utils/on-before-route-update.md +0 -0
- /package/{3.api → 4.api}/3.utils/on-nuxt-ready.md +0 -0
- /package/{3.api → 4.api}/3.utils/prefetch-components.md +0 -0
- /package/{3.api → 4.api}/3.utils/preload-components.md +0 -0
- /package/{3.api → 4.api}/3.utils/preload-route-components.md +0 -0
- /package/{3.api → 4.api}/3.utils/prerender-routes.md +0 -0
- /package/{3.api → 4.api}/3.utils/refresh-nuxt-data.md +0 -0
- /package/{3.api → 4.api}/3.utils/reload-nuxt-app.md +0 -0
- /package/{3.api → 4.api}/4.commands/.navigation.yml +0 -0
- /package/{3.api → 4.api}/5.kit/.navigation.yml +0 -0
- /package/{3.api → 4.api}/5.kit/10.runtime-config.md +0 -0
- /package/{3.api → 4.api}/5.kit/12.resolving.md +0 -0
- /package/{3.api → 4.api}/5.kit/13.logging.md +0 -0
- /package/{3.api → 4.api}/5.kit/15.examples.md +0 -0
- /package/{3.api → 4.api}/5.kit/3.compatibility.md +0 -0
- /package/{3.api → 4.api}/5.kit/6.context.md +0 -0
- /package/{3.api → 4.api}/5.kit/7.pages.md +0 -0
- /package/{3.api → 4.api}/5.kit/8.layout.md +0 -0
- /package/{3.api → 4.api}/5.kit/9.head.md +0 -0
- /package/{3.api → 4.api}/5.kit/9.plugins.md +0 -0
- /package/{3.api → 4.api}/6.advanced/.navigation.yml +0 -0
- /package/{3.api → 4.api}/6.advanced/2.import-meta.md +0 -0
- /package/{3.api → 4.api}/index.md +0 -0
|
@@ -5,15 +5,16 @@ description: "Understanding the lifecycle of Nuxt applications can help you gain
|
|
|
5
5
|
|
|
6
6
|
The goal of this chapter is to provide a high-level overview of the different parts of the framework, their execution order, and how they work together.
|
|
7
7
|
|
|
8
|
-
## Server
|
|
8
|
+
## Server lifecycle
|
|
9
9
|
|
|
10
10
|
On the server, the following steps are executed for every initial request to your application:
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
::steps
|
|
13
|
+
### Server plugins :badge[once]{color="info" class="align-middle"}
|
|
13
14
|
|
|
14
15
|
Nuxt is powered by [Nitro](https://nitro.build/), a modern server engine.
|
|
15
16
|
|
|
16
|
-
When Nitro starts, it initializes and executes the plugins under the `/server/plugins` directory. These plugins can:
|
|
17
|
+
When Nitro starts, it initializes and executes the plugins under the [`/server/plugins`](/docs/4.x/directory-structure/server#server-plugins) directory. These plugins can:
|
|
17
18
|
- Capture and handle application-wide errors.
|
|
18
19
|
- Register hooks that execute when Nitro shuts down.
|
|
19
20
|
- Register hooks for request lifecycle events, such as modifying responses.
|
|
@@ -22,9 +23,9 @@ When Nitro starts, it initializes and executes the plugins under the `/server/pl
|
|
|
22
23
|
Nitro plugins are executed only once when the server starts. In a serverless environment, the server boots on each incoming request, and so do the Nitro plugins. However, they are not awaited.
|
|
23
24
|
::
|
|
24
25
|
|
|
25
|
-
:read-more{to="/docs/4.x/
|
|
26
|
+
:read-more{to="/docs/4.x/directory-structure/server#server-plugins"}
|
|
26
27
|
|
|
27
|
-
###
|
|
28
|
+
### Server middleware
|
|
28
29
|
|
|
29
30
|
After initializing the Nitro server, middleware under `server/middleware/` is executed for every request. Middleware can be used for tasks such as authentication, logging, or request transformation.
|
|
30
31
|
|
|
@@ -32,34 +33,34 @@ After initializing the Nitro server, middleware under `server/middleware/` is ex
|
|
|
32
33
|
Returning a value from middleware will terminate the request and send the returned value as the response. This behavior should generally be avoided to ensure proper request handling!
|
|
33
34
|
::
|
|
34
35
|
|
|
35
|
-
:read-more{to="/docs/4.x/
|
|
36
|
+
:read-more{to="/docs/4.x/directory-structure/server#server-middleware"}
|
|
36
37
|
|
|
37
|
-
###
|
|
38
|
+
### App plugins
|
|
38
39
|
|
|
39
|
-
The Vue and Nuxt instances are created first. Afterward, Nuxt executes its
|
|
40
|
+
The Vue and Nuxt instances are created first. Afterward, Nuxt executes its app plugins. This includes:
|
|
40
41
|
- Built-in plugins, such as Vue Router and `unhead`.
|
|
41
42
|
- Custom plugins located in the `app/plugins/` directory, including those without a suffix (e.g., `myPlugin.ts`) and those with the `.server` suffix (e.g., `myServerPlugin.server.ts`).
|
|
42
43
|
|
|
43
|
-
Plugins execute in a specific order and may have dependencies on one another. For more details, including execution order and parallelism, refer to the [Plugins documentation](/docs/4.x/
|
|
44
|
+
Plugins execute in a specific order and may have dependencies on one another. For more details, including execution order and parallelism, refer to the [Plugins documentation](/docs/4.x/directory-structure/app/plugins).
|
|
44
45
|
|
|
45
46
|
::callout{icon="i-lucide-lightbulb"}
|
|
46
47
|
After this step, Nuxt calls the [`app:created`](/docs/4.x/api/advanced/hooks#app-hooks-runtime) hook, which can be used to execute additional logic.
|
|
47
48
|
::
|
|
48
49
|
|
|
49
|
-
:read-more{to="/docs/4.x/
|
|
50
|
+
:read-more{to="/docs/4.x/directory-structure/app/plugins"}
|
|
50
51
|
|
|
51
|
-
###
|
|
52
|
+
### Route validation
|
|
52
53
|
|
|
53
54
|
After initializing plugins and before executing middleware, Nuxt calls the `validate` method if it is defined in the `definePageMeta` function. The `validate` method, which can be synchronous or asynchronous, is often used to validate dynamic route parameters.
|
|
54
55
|
|
|
55
56
|
- The `validate` function should return `true` if the parameters are valid.
|
|
56
|
-
- If validation fails, it should return `false` or an object containing a `
|
|
57
|
+
- If validation fails, it should return `false` or an object containing a `status` and/or `statusText` to terminate the request.
|
|
57
58
|
|
|
58
59
|
For more information, see the [Route Validation documentation](/docs/4.x/getting-started/routing#route-validation).
|
|
59
60
|
|
|
60
61
|
:read-more{to="/docs/4.x/getting-started/routing#route-validation"}
|
|
61
62
|
|
|
62
|
-
###
|
|
63
|
+
### App middleware
|
|
63
64
|
|
|
64
65
|
Middleware allows you to run code before navigating to a particular route. It is often used for tasks such as authentication, redirection, or logging.
|
|
65
66
|
|
|
@@ -70,13 +71,13 @@ In Nuxt, there are three types of middleware:
|
|
|
70
71
|
|
|
71
72
|
Nuxt executes all global middleware on the initial page load (both on server and client) and then again before any client-side navigation. Named and anonymous middleware are executed only on the routes specified in the middleware property of the page(route) meta defined in the corresponding page components.
|
|
72
73
|
|
|
73
|
-
For details about each type and examples, see the [Middleware documentation](/docs/4.x/
|
|
74
|
+
For details about each type and examples, see the [Middleware documentation](/docs/4.x/directory-structure/app/middleware).
|
|
74
75
|
|
|
75
76
|
Any redirection on the server will result in a `Location:` header being sent to the browser; the browser then makes a fresh request to this new location. All application state will be reset when this happens, unless persisted in a cookie.
|
|
76
77
|
|
|
77
|
-
:read-more{to="/docs/4.x/
|
|
78
|
+
:read-more{to="/docs/4.x/directory-structure/app/middleware"}
|
|
78
79
|
|
|
79
|
-
###
|
|
80
|
+
### Page and components
|
|
80
81
|
|
|
81
82
|
Nuxt renders the page and its components and fetches any required data with `useFetch` and `useAsyncData` during this step. Since there are no dynamic updates and no DOM operations occur on the server, Vue lifecycle hooks such as `onBeforeMount`, `onMounted`, and subsequent hooks are **NOT** executed during SSR.
|
|
82
83
|
|
|
@@ -94,7 +95,7 @@ You should avoid code that produces side effects that need cleanup in root scope
|
|
|
94
95
|
Watch a video from Daniel Roe explaining Server Rendering and Global State.
|
|
95
96
|
::
|
|
96
97
|
|
|
97
|
-
###
|
|
98
|
+
### HTML Output
|
|
98
99
|
|
|
99
100
|
After all required data is fetched and the components are rendered, Nuxt combines the rendered components with settings from `unhead` to generate a complete HTML document. This HTML, along with the associated data, is then sent back to the client to complete the SSR process.
|
|
100
101
|
|
|
@@ -106,11 +107,15 @@ After rendering the Vue application to HTML, Nuxt calls the [`app:rendered`](/do
|
|
|
106
107
|
Before finalizing and sending the HTML, Nitro will call the [`render:html`](/docs/4.x/api/advanced/hooks#nitro-app-hooks-runtime-server-side) hook. This hook allows you to manipulate the generated HTML, such as injecting additional scripts or modifying meta tags.
|
|
107
108
|
::
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
::
|
|
111
|
+
|
|
112
|
+
## Client lifecycle
|
|
110
113
|
|
|
111
114
|
This part of the lifecycle is fully executed in the browser, no matter which Nuxt mode you've chosen.
|
|
112
115
|
|
|
113
|
-
|
|
116
|
+
::steps
|
|
117
|
+
|
|
118
|
+
### App plugins
|
|
114
119
|
|
|
115
120
|
This step is similar to the server-side execution and includes both built-in and custom plugins.
|
|
116
121
|
|
|
@@ -120,21 +125,21 @@ Custom plugins in the `app/plugins/` directory, such as those without a suffix (
|
|
|
120
125
|
After this step, Nuxt calls the [`app:created`](/docs/4.x/api/advanced/hooks#app-hooks-runtime) hook, which can be used to execute additional logic.
|
|
121
126
|
::
|
|
122
127
|
|
|
123
|
-
:read-more{to="/docs/4.x/
|
|
128
|
+
:read-more{to="/docs/4.x/directory-structure/app/plugins"}
|
|
124
129
|
|
|
125
|
-
###
|
|
130
|
+
### Route validation
|
|
126
131
|
|
|
127
132
|
This step is the same as the server-side execution and includes the `validate` method if defined in the `definePageMeta` function.
|
|
128
133
|
|
|
129
|
-
###
|
|
134
|
+
### App middleware
|
|
130
135
|
|
|
131
136
|
Nuxt middleware runs on both the server and the client. If you want certain code to run in specific environments, consider splitting it by using `import.meta.client` for the client and `import.meta.server` for the server.
|
|
132
137
|
|
|
133
|
-
:read-more{to="/docs/4.x/
|
|
138
|
+
:read-more{to="/docs/4.x/directory-structure/app/middleware#when-middleware-runs"}
|
|
134
139
|
|
|
135
|
-
###
|
|
140
|
+
### Mount Vue app and hydrate
|
|
136
141
|
|
|
137
|
-
Calling `app.mount('#__nuxt')` mounts the Vue application to the DOM. If the application uses SSR or SSG mode, Vue performs a hydration step to make the client-side application interactive. During hydration, Vue recreates the application (excluding [Server Components](/docs/4.x/
|
|
142
|
+
Calling `app.mount('#__nuxt')` mounts the Vue application to the DOM. If the application uses SSR or SSG mode, Vue performs a hydration step to make the client-side application interactive. During hydration, Vue recreates the application (excluding [Server Components](/docs/4.x/directory-structure/app/components#server-components)), matches each component to its corresponding DOM nodes, and attaches DOM event listeners.
|
|
138
143
|
|
|
139
144
|
To ensure proper hydration, it's important to maintain consistency between the data on the server and the client. For API requests, it is recommended to use `useAsyncData`, `useFetch`, or other SSR-friendly composables. These methods ensure that the data fetched on the server side is reused during hydration, avoiding repeated requests. Any new requests should only be triggered after hydration, preventing hydration errors.
|
|
140
145
|
|
|
@@ -146,6 +151,8 @@ Before mounting the Vue application, Nuxt calls the [`app:beforeMount`](/docs/4.
|
|
|
146
151
|
After mounting the Vue application, Nuxt calls the [`app:mounted`](/docs/4.x/api/advanced/hooks#app-hooks-runtime) hook.
|
|
147
152
|
::
|
|
148
153
|
|
|
149
|
-
###
|
|
154
|
+
### Vue lifecycle
|
|
150
155
|
|
|
151
156
|
Unlike on the server, the browser executes the full [Vue lifecycle](https://vuejs.org/guide/essentials/lifecycle).
|
|
157
|
+
|
|
158
|
+
::
|
|
@@ -11,7 +11,7 @@ const count = ref(1) // ref is auto-imported
|
|
|
11
11
|
</script>
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Thanks to its opinionated directory structure, Nuxt can auto-import your [`app/components/`](/docs/4.x/
|
|
14
|
+
Thanks to its opinionated directory structure, Nuxt can auto-import your [`app/components/`](/docs/4.x/directory-structure/app/components), [`app/composables/`](/docs/4.x/directory-structure/app/composables) and [`app/utils/`](/docs/4.x/directory-structure/app/utils).
|
|
15
15
|
|
|
16
16
|
Contrary to a classic global declaration, Nuxt preserves typings, IDEs completions and hints, and **only includes what is used in your production code**.
|
|
17
17
|
|
|
@@ -20,7 +20,7 @@ In the docs, every function that is not explicitly imported is auto-imported by
|
|
|
20
20
|
::
|
|
21
21
|
|
|
22
22
|
::note
|
|
23
|
-
In the [`server`](/docs/4.x/
|
|
23
|
+
In the [`server`](/docs/4.x/directory-structure/server) directory, Nuxt auto-imports exported functions and variables from `server/utils/`.
|
|
24
24
|
::
|
|
25
25
|
|
|
26
26
|
::note
|
|
@@ -101,8 +101,8 @@ export const useMyComposable = () => {
|
|
|
101
101
|
|
|
102
102
|
Nuxt directly auto-imports files created in defined directories:
|
|
103
103
|
|
|
104
|
-
- `app/components/` for [Vue components](/docs/4.x/
|
|
105
|
-
- `app/composables/` for [Vue composables](/docs/4.x/
|
|
104
|
+
- `app/components/` for [Vue components](/docs/4.x/directory-structure/app/components).
|
|
105
|
+
- `app/composables/` for [Vue composables](/docs/4.x/directory-structure/app/composables).
|
|
106
106
|
- `app/utils/` for helper functions and other utilities.
|
|
107
107
|
|
|
108
108
|
:link-example{to="/docs/4.x/examples/features/auto-imports"}
|
|
@@ -167,7 +167,7 @@ With this configuration:
|
|
|
167
167
|
|
|
168
168
|
Nuxt also automatically imports components from your `~/components` directory, although this is configured separately from auto-importing composables and utility functions.
|
|
169
169
|
|
|
170
|
-
:read-more{to="/docs/4.x/
|
|
170
|
+
:read-more{to="/docs/4.x/directory-structure/app/components"}
|
|
171
171
|
|
|
172
172
|
To disable auto-importing components from your own `~/components` directory, you can set `components.dirs` to an empty array (though note that this will not affect components added by modules).
|
|
173
173
|
|
|
@@ -16,7 +16,7 @@ It is shipped with many features:
|
|
|
16
16
|
|
|
17
17
|
## API Layer
|
|
18
18
|
|
|
19
|
-
Server [API endpoints](/docs/4.x/
|
|
19
|
+
Server [API endpoints](/docs/4.x/directory-structure/server#server-routes) and [Middleware](/docs/4.x/directory-structure/server#server-middleware) are added by Nitro that internally uses [h3](https://github.com/h3js/h3).
|
|
20
20
|
|
|
21
21
|
Key features include:
|
|
22
22
|
|
|
@@ -26,7 +26,7 @@ Key features include:
|
|
|
26
26
|
|
|
27
27
|
Check out [the h3 docs](https://github.com/h3js/h3) for more information.
|
|
28
28
|
|
|
29
|
-
::read-more{to="/docs/4.x/
|
|
29
|
+
::read-more{to="/docs/4.x/directory-structure/server#server-routes"}
|
|
30
30
|
Learn more about the API layer in the `server/` directory.
|
|
31
31
|
::
|
|
32
32
|
|
|
@@ -53,7 +53,7 @@ Nitro produces a standalone server dist that is independent of `node_modules`.
|
|
|
53
53
|
|
|
54
54
|
The server in Nuxt 2 is not standalone and requires part of Nuxt core to be involved by running `nuxt start` (with the [`nuxt-start`](https://www.npmjs.com/package/nuxt-start) or [`nuxt`](https://www.npmjs.com/package/nuxt) distributions) or custom programmatic usage, which is fragile and prone to breakage and not suitable for serverless and service worker environments.
|
|
55
55
|
|
|
56
|
-
Nuxt generates this dist when running `nuxt build` into a [`.output`](/docs/4.x/
|
|
56
|
+
Nuxt generates this dist when running `nuxt build` into a [`.output`](/docs/4.x/directory-structure/output) directory.
|
|
57
57
|
|
|
58
58
|
The output contains runtime code to run your Nuxt server in any environment (including experimental browser service workers!) and serve your static files, making it a true hybrid framework for the JAMstack. In addition, Nuxt implements a native storage layer, supporting multi-source drivers and local assets.
|
|
59
59
|
|
|
@@ -17,7 +17,7 @@ Explore Nuxt Modules
|
|
|
17
17
|
|
|
18
18
|
## Add Nuxt Modules
|
|
19
19
|
|
|
20
|
-
Once you have installed the modules you can add them to your [`nuxt.config.ts`](/docs/4.x/
|
|
20
|
+
Once you have installed the modules you can add them to your [`nuxt.config.ts`](/docs/4.x/directory-structure/nuxt-config) file under the `modules` property. Module developers usually provide additional steps and details for usage.
|
|
21
21
|
|
|
22
22
|
```ts twoslash [nuxt.config.ts]
|
|
23
23
|
export default defineNuxtConfig({
|
|
@@ -41,8 +41,21 @@ export default defineNuxtConfig({
|
|
|
41
41
|
Nuxt modules are now build-time-only, and the `buildModules` property used in Nuxt 2 is deprecated in favor of `modules`.
|
|
42
42
|
::
|
|
43
43
|
|
|
44
|
+
## Disabling Modules
|
|
45
|
+
|
|
46
|
+
You can disable a module by setting its config key to `false` in your Nuxt config. This is particularly useful when you want to disable modules inherited from layers.
|
|
47
|
+
|
|
48
|
+
```ts [nuxt.config.ts]
|
|
49
|
+
export default defineNuxtConfig({
|
|
50
|
+
// Disable `@nuxt/image` module
|
|
51
|
+
image: false,
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
:read-more{to="/docs/4.x/guide/going-further/layers#disabling-modules-from-layers"}
|
|
56
|
+
|
|
44
57
|
## Create a Nuxt Module
|
|
45
58
|
|
|
46
59
|
Everyone has the opportunity to develop modules and we cannot wait to see what you will build.
|
|
47
60
|
|
|
48
|
-
:read-more{to="/docs/4.x/guide/
|
|
61
|
+
:read-more{to="/docs/4.x/guide/modules" title="Module Author Guide"}
|
|
@@ -27,6 +27,10 @@ To enable type-checking at build or development time, install `vue-tsc` and `typ
|
|
|
27
27
|
bun add -D vue-tsc typescript
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
```bash [deno]
|
|
31
|
+
deno add -D npm:vue-tsc npm:typescript
|
|
32
|
+
```
|
|
33
|
+
|
|
30
34
|
::
|
|
31
35
|
|
|
32
36
|
Then, run [`nuxt typecheck`](/docs/4.x/api/commands/typecheck) command to check your types:
|
|
@@ -47,12 +51,12 @@ export default defineNuxtConfig({
|
|
|
47
51
|
|
|
48
52
|
## Auto-generated Types
|
|
49
53
|
|
|
50
|
-
Nuxt projects rely on auto-generated types to work properly. These types are stored in the [`.nuxt`](/docs/4.x/
|
|
54
|
+
Nuxt projects rely on auto-generated types to work properly. These types are stored in the [`.nuxt`](/docs/4.x/directory-structure/nuxt) directory and are generated when you run the dev server or build your application. You can also generate these files manually by running `nuxt prepare`.
|
|
51
55
|
|
|
52
|
-
The generated `tsconfig.json` files inside the [`.nuxt`](/docs/4.x/
|
|
56
|
+
The generated `tsconfig.json` files inside the [`.nuxt`](/docs/4.x/directory-structure/nuxt) directory include **recommended basic TypeScript configuration** for your project, references to [auto-imports](/docs/4.x/guide/concepts/auto-imports), [API route types](/docs/4.x/guide/concepts/server-engine#typed-api-routes), path aliases like `#imports`, `~/file`, or `#build/file`, and more.
|
|
53
57
|
|
|
54
58
|
::warning
|
|
55
|
-
Nuxt relies on this configuration, and [Nuxt
|
|
59
|
+
Nuxt relies on this configuration, and [Nuxt modules](/docs/4.x/guide/modules) can extend it as well. For this reason, it is not recommended to modify your `tsconfig.json` file directly, as doing so could overwrite important settings. Instead, extend it via `nuxt.config.ts`. [Learn more about extending the configuration here](/docs/4.x/directory-structure/tsconfig).
|
|
56
60
|
::
|
|
57
61
|
|
|
58
62
|
::tip{icon="i-lucide-video" to="https://youtu.be/umLI7SlPygY" target="_blank"}
|
|
@@ -75,7 +79,7 @@ When you run `nuxt dev`, `nuxt build` or `nuxt prepare`, Nuxt will generate mult
|
|
|
75
79
|
Each of these files is configured to reference the appropriate dependencies and provide optimal type-checking for their specific context.
|
|
76
80
|
|
|
77
81
|
::note
|
|
78
|
-
For backward compatibility, Nuxt still generates `.nuxt/tsconfig.json`. However, we recommend using [TypeScript project references](/docs/4.x/
|
|
82
|
+
For backward compatibility, Nuxt still generates `.nuxt/tsconfig.json`. However, we recommend using [TypeScript project references](/docs/4.x/directory-structure/tsconfig) with the new configuration files (`.nuxt/tsconfig.app.json`, `.nuxt/tsconfig.server.json`, etc.) for better type safety and performance. This legacy file will be removed in a future version of Nuxt.
|
|
79
83
|
::
|
|
80
84
|
|
|
81
85
|
### Benefits of Project References
|
|
@@ -95,7 +99,7 @@ Similarly:
|
|
|
95
99
|
- For the `server` context, place the augmentation file in the `server/` directory.
|
|
96
100
|
- For types that are **shared between the app and server**, place the file in the `shared/` directory.
|
|
97
101
|
|
|
98
|
-
::read-more{to="/docs/4.x/guide/
|
|
102
|
+
::read-more{to="/docs/4.x/guide/modules/recipes-advanced#extend-typescript-config"}
|
|
99
103
|
Read more about augmenting specific type contexts from **files outside those contexts** in the Module Author Guide.
|
|
100
104
|
::
|
|
101
105
|
|
|
@@ -90,7 +90,7 @@ const show = ref(false)
|
|
|
90
90
|
|
|
91
91
|
By using the Lazy prefix you can delay loading the component code until the right moment, which can be helpful for optimizing your JavaScript bundle size.
|
|
92
92
|
|
|
93
|
-
:read-more{title="Lazy loading components" to="/docs/4.x/
|
|
93
|
+
:read-more{title="Lazy loading components" to="/docs/4.x/directory-structure/app/components#dynamic-imports"}
|
|
94
94
|
|
|
95
95
|
### Lazy Hydration
|
|
96
96
|
|
|
@@ -106,7 +106,7 @@ It is not always necessary to hydrate (or make interactive) all the components o
|
|
|
106
106
|
|
|
107
107
|
To optimize your app, you may want to delay the hydration of some components until they're visible, or until the browser is done with more important tasks.
|
|
108
108
|
|
|
109
|
-
:read-more{title="Lazy hydration" to="/docs/4.x/
|
|
109
|
+
:read-more{title="Lazy hydration" to="/docs/4.x/directory-structure/app/components#delayed-or-lazy-hydration"}
|
|
110
110
|
|
|
111
111
|
### Fetching data
|
|
112
112
|
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Nuxt MCP Server
|
|
3
|
+
description: Use Nuxt documentation in your AI assistants with Model Context Protocol support.
|
|
4
|
+
navigation.title: MCP Server
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## What is MCP?
|
|
8
|
+
|
|
9
|
+
MCP (Model Context Protocol) is a standardized protocol that enables AI assistants to access external data sources and tools. Nuxt provides an MCP server that allows AI assistants like Claude Code, Cursor, and Windsurf to access documentation, blog posts, and deployment guides directly.
|
|
10
|
+
|
|
11
|
+
The MCP server provides structured access to the Nuxt documentation, making it easy for AI tools to understand and assist with Nuxt development.
|
|
12
|
+
|
|
13
|
+
## Resources
|
|
14
|
+
|
|
15
|
+
The Nuxt MCP server provides the following resources for discovery:
|
|
16
|
+
|
|
17
|
+
- **`resource://nuxt-com/documentation-pages`**: Browse all available documentation pages (defaults to v4.x)
|
|
18
|
+
- **`resource://nuxt-com/blog-posts`**: Browse all Nuxt blog posts including releases and tutorials
|
|
19
|
+
- **`resource://nuxt-com/deploy-providers`**: Browse all deployment providers and hosting platforms
|
|
20
|
+
|
|
21
|
+
You're able to access these resources with tools like Claude Code by using `@`.
|
|
22
|
+
|
|
23
|
+
## Tools
|
|
24
|
+
|
|
25
|
+
The Nuxt MCP server provides the following tools organized by category:
|
|
26
|
+
|
|
27
|
+
### Documentation
|
|
28
|
+
|
|
29
|
+
- **`list_documentation_pages`**: Lists all available Nuxt documentation pages with their categories and basic information. Supports version filtering (3.x, 4.x, or all)
|
|
30
|
+
- **`get_documentation_page`**: Retrieves documentation page content and details by path
|
|
31
|
+
- **`get_getting_started_guide`**: Gets the getting started guide for a specific Nuxt version
|
|
32
|
+
|
|
33
|
+
### Blog
|
|
34
|
+
|
|
35
|
+
- **`list_blog_posts`**: Lists all Nuxt blog posts with metadata including dates, categories, and tags
|
|
36
|
+
- **`get_blog_post`**: Retrieves blog post content and details by path
|
|
37
|
+
|
|
38
|
+
### Deployment
|
|
39
|
+
|
|
40
|
+
- **`list_deploy_providers`**: Lists all deployment providers and hosting platforms for Nuxt applications
|
|
41
|
+
- **`get_deploy_provider`**: Retrieves deployment provider details and instructions by path
|
|
42
|
+
|
|
43
|
+
## Prompts
|
|
44
|
+
|
|
45
|
+
The Nuxt MCP server provides guided prompts for common workflows:
|
|
46
|
+
|
|
47
|
+
- **`find_documentation_for_topic`**: Find the best Nuxt documentation for a specific topic or feature
|
|
48
|
+
- **`deployment_guide`**: Get deployment instructions for a specific hosting provider
|
|
49
|
+
- **`migration_help`**: Get help with migrating between Nuxt versions
|
|
50
|
+
|
|
51
|
+
You're able to access these resources with tools like Claude Code by using `/`.
|
|
52
|
+
|
|
53
|
+
## Setup
|
|
54
|
+
|
|
55
|
+
The Nuxt MCP server uses HTTP transport and can be installed in different AI assistants.
|
|
56
|
+
|
|
57
|
+
### ChatGPT
|
|
58
|
+
|
|
59
|
+
::note{icon="i-lucide-info"}
|
|
60
|
+
**Custom connectors using MCP are available on ChatGPT for Pro and Plus accounts** on the web.
|
|
61
|
+
::
|
|
62
|
+
|
|
63
|
+
Follow these steps to set up Nuxt as a connector within ChatGPT:
|
|
64
|
+
|
|
65
|
+
1. **Enable Developer mode:**
|
|
66
|
+
- Go to Settings → Connectors → Advanced settings → Developer mode
|
|
67
|
+
|
|
68
|
+
2. **Open ChatGPT settings**
|
|
69
|
+
|
|
70
|
+
3. **In the Connectors tab, Create a new connector:**
|
|
71
|
+
- Give it a name: `Nuxt`
|
|
72
|
+
- MCP server URL: `https://nuxt.com/mcp`
|
|
73
|
+
- Authentication: `None`
|
|
74
|
+
|
|
75
|
+
4. **Click Create**
|
|
76
|
+
|
|
77
|
+
The Nuxt connector will appear in the composer's "Developer mode" tool later during conversations.
|
|
78
|
+
|
|
79
|
+
### Claude Code
|
|
80
|
+
|
|
81
|
+
::note{icon="i-lucide-info"}
|
|
82
|
+
**Ensure Claude Code is installed** - Visit [Anthropic's documentation](https://docs.claude.com/en/docs/claude-code/quickstart) for installation instructions.
|
|
83
|
+
::
|
|
84
|
+
|
|
85
|
+
Add the server using the CLI command:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
claude mcp add --transport http nuxt-remote https://nuxt.com/mcp
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Claude Desktop
|
|
92
|
+
|
|
93
|
+
#### Setup Instructions
|
|
94
|
+
|
|
95
|
+
1. Open Claude Desktop and navigate to "Settings" > "Developer".
|
|
96
|
+
2. Click on "Edit Config". This will open the local Claude directory.
|
|
97
|
+
3. Modify the `claude_desktop_config.json` file with your custom MCP server configuration.
|
|
98
|
+
```json [claude_desktop_config.json]
|
|
99
|
+
{
|
|
100
|
+
"mcpServers": {
|
|
101
|
+
"nuxt": {
|
|
102
|
+
"command": "npx",
|
|
103
|
+
"args": [
|
|
104
|
+
"mcp-remote",
|
|
105
|
+
"https://nuxt.com/mcp"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
4. Restart Claude Desktop app. The Nuxt MCP server should now be registered.
|
|
112
|
+
|
|
113
|
+
### Cursor
|
|
114
|
+
|
|
115
|
+
Click the button below to install the Nuxt MCP server directly in Cursor:
|
|
116
|
+
|
|
117
|
+
::u-button
|
|
118
|
+
---
|
|
119
|
+
to: "cursor://anysphere.cursor-deeplink/mcp/install?name=nuxt&config=eyJ0eXBlIjoiaHR0cCIsInVybCI6Imh0dHBzOi8vbnV4dC5jb20vbWNwIn0%3D"
|
|
120
|
+
label: Install MCP Server
|
|
121
|
+
color: neutral
|
|
122
|
+
icon: i-custom-cursor
|
|
123
|
+
---
|
|
124
|
+
::
|
|
125
|
+
|
|
126
|
+
For manual setup, follow these steps:
|
|
127
|
+
|
|
128
|
+
1. Open Cursor and go to "Settings" > "Tools & MCP"
|
|
129
|
+
2. Add the Nuxt MCP server configuration
|
|
130
|
+
|
|
131
|
+
Or manually create/update `.cursor/mcp.json` in your project root:
|
|
132
|
+
|
|
133
|
+
```json [.cursor/mcp.json]
|
|
134
|
+
{
|
|
135
|
+
"mcpServers": {
|
|
136
|
+
"nuxt": {
|
|
137
|
+
"type": "http",
|
|
138
|
+
"url": "https://nuxt.com/mcp"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Le Chat Mistral
|
|
145
|
+
|
|
146
|
+
1. Navigate to "Intelligence" > "Connectors"
|
|
147
|
+
2. Click on "Add Connector" button, then select "Custom MCP Connector"
|
|
148
|
+
3. Create your Custom MCP Connector:
|
|
149
|
+
- Connector Name : `Nuxt`
|
|
150
|
+
- Connector Server : `https://nuxt.com/mcp`
|
|
151
|
+
|
|
152
|
+
### Visual Studio Code
|
|
153
|
+
|
|
154
|
+
::note{icon="i-lucide-info"}
|
|
155
|
+
**Install required extensions** - Ensure you have [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) and [GitHub Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) extensions installed.
|
|
156
|
+
::
|
|
157
|
+
|
|
158
|
+
1. Open VS Code and access the Command Palette (Ctrl/Cmd + Shift + P)
|
|
159
|
+
2. Type "Preferences: Open Workspace Settings (JSON)" and select it
|
|
160
|
+
3. Navigate to your project's `.vscode` folder or create one if it doesn't exist
|
|
161
|
+
4. Create or edit the `mcp.json` file with the following configuration:
|
|
162
|
+
|
|
163
|
+
```json [.vscode/mcp.json]
|
|
164
|
+
{
|
|
165
|
+
"servers": {
|
|
166
|
+
"nuxt": {
|
|
167
|
+
"type": "http",
|
|
168
|
+
"url": "https://nuxt.com/mcp"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### GitHub Copilot Agent
|
|
175
|
+
|
|
176
|
+
::note{icon="i-lucide-info"}
|
|
177
|
+
**Repository administrator access required** to configure MCP servers for GitHub Copilot coding agent.
|
|
178
|
+
::
|
|
179
|
+
|
|
180
|
+
If you have already configured MCP servers in VS Code (replace the `servers` key with `mcpServers` for GitHub Copilot Agent), you can leverage a similar configuration for GitHub Copilot coding agent. You will need to add a `tools` key specifying which tools are available to Copilot.
|
|
181
|
+
|
|
182
|
+
1. Navigate to your GitHub repository
|
|
183
|
+
2. Go to **Settings** > **Code & automation** > **Copilot** > **Coding agent**
|
|
184
|
+
3. In the **MCP configuration** section, add the following configuration:
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"mcpServers": {
|
|
188
|
+
"nuxt": {
|
|
189
|
+
"type": "http",
|
|
190
|
+
"url": "https://nuxt.com/mcp",
|
|
191
|
+
"tools": ["*"]
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
4. Click **Save**
|
|
197
|
+
|
|
198
|
+
#### Validating the Configuration
|
|
199
|
+
|
|
200
|
+
To verify the MCP server is configured correctly:
|
|
201
|
+
|
|
202
|
+
1. Create an issue in your repository and assign it to Copilot
|
|
203
|
+
2. Wait for Copilot to create a pull request
|
|
204
|
+
3. In the pull request, click **View session** in the "Copilot started work" timeline event
|
|
205
|
+
4. Click the ellipsis button (**...**) at the top right, then click **Copilot** in the sidebar
|
|
206
|
+
5. Expand the **Start MCP Servers** step to see the configured Nuxt tools
|
|
207
|
+
|
|
208
|
+
For more information on using MCP with GitHub Copilot coding agent, see [Extend coding agent with MCP](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/extend-coding-agent-with-mcp).
|
|
209
|
+
|
|
210
|
+
### Windsurf
|
|
211
|
+
|
|
212
|
+
1. Open Windsurf and navigate to "Settings" > "Windsurf Settings" > "Cascade"
|
|
213
|
+
2. Click the "Manage MCPs" button, then select the "View raw config" option
|
|
214
|
+
3. Add the following configuration to your MCP settings:
|
|
215
|
+
|
|
216
|
+
```json [.codeium/windsurf/mcp_config.json]
|
|
217
|
+
{
|
|
218
|
+
"mcpServers": {
|
|
219
|
+
"nuxt": {
|
|
220
|
+
"type": "http",
|
|
221
|
+
"url": "https://nuxt.com/mcp"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Zed
|
|
228
|
+
|
|
229
|
+
1. Open Zed and go to "Settings" > "Open Settings"
|
|
230
|
+
2. Navigate to the JSON settings file
|
|
231
|
+
3. Add the following context server configuration to your settings:
|
|
232
|
+
|
|
233
|
+
```json [.config/zed/settings.json]
|
|
234
|
+
{
|
|
235
|
+
"context_servers": {
|
|
236
|
+
"nuxt": {
|
|
237
|
+
"source": "custom",
|
|
238
|
+
"command": "npx",
|
|
239
|
+
"args": ["mcp-remote", "https://nuxt.com/mcp"],
|
|
240
|
+
"env": {}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Opencode
|
|
247
|
+
|
|
248
|
+
1. In your project root, create `opencode.json`
|
|
249
|
+
2. Add the following configuration:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"$schema": "https://opencode.ai/config.json",
|
|
254
|
+
"mcp": {
|
|
255
|
+
"nuxt": {
|
|
256
|
+
"type": "remote",
|
|
257
|
+
"url": "https://nuxt.com/mcp",
|
|
258
|
+
"enabled": true
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Prompts Examples
|
|
265
|
+
|
|
266
|
+
Once configured, you can ask your AI assistant questions like:
|
|
267
|
+
|
|
268
|
+
- "List all available Nuxt documentation pages"
|
|
269
|
+
- "Get the introduction documentation"
|
|
270
|
+
- "What's the difference between v3 and v4?"
|
|
271
|
+
- "How do I deploy to Vercel?"
|
|
272
|
+
- "Show me the latest blog posts"
|
|
273
|
+
- "Help me migrate from Nuxt 3 to Nuxt 4"
|
|
274
|
+
- "Search documentation about composables"
|
|
275
|
+
- "Find deployment guides for Cloudflare"
|
|
276
|
+
|
|
277
|
+
The AI assistant will use the MCP server to fetch structured JSON data and provide guided assistance for Nuxt development.
|