@nuxt/docs 3.20.2 → 3.21.1

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.
Files changed (188) hide show
  1. package/1.getting-started/01.introduction.md +4 -4
  2. package/1.getting-started/02.installation.md +4 -7
  3. package/1.getting-started/03.configuration.md +29 -29
  4. package/1.getting-started/04.views.md +6 -4
  5. package/1.getting-started/05.assets.md +2 -2
  6. package/1.getting-started/06.styling.md +22 -16
  7. package/1.getting-started/07.routing.md +6 -6
  8. package/1.getting-started/08.seo-meta.md +8 -4
  9. package/1.getting-started/09.transitions.md +6 -6
  10. package/1.getting-started/10.data-fetching.md +18 -18
  11. package/1.getting-started/11.state-management.md +5 -5
  12. package/1.getting-started/12.error-handling.md +25 -19
  13. package/1.getting-started/13.server.md +9 -9
  14. package/1.getting-started/14.layers.md +49 -15
  15. package/1.getting-started/15.prerendering.md +18 -4
  16. package/1.getting-started/16.deployment.md +2 -1
  17. package/1.getting-started/17.testing.md +17 -7
  18. package/1.getting-started/18.upgrade.md +111 -60
  19. package/2.directory-structure/0.output.md +1 -1
  20. package/2.directory-structure/1.assets.md +1 -1
  21. package/2.directory-structure/1.components.md +12 -8
  22. package/2.directory-structure/1.composables.md +2 -2
  23. package/2.directory-structure/1.content.md +1 -1
  24. package/2.directory-structure/1.layers.md +87 -0
  25. package/2.directory-structure/1.layouts.md +35 -3
  26. package/2.directory-structure/1.middleware.md +7 -7
  27. package/2.directory-structure/1.modules.md +8 -2
  28. package/2.directory-structure/1.node_modules.md +1 -1
  29. package/2.directory-structure/1.pages.md +39 -18
  30. package/2.directory-structure/1.plugins.md +4 -1
  31. package/2.directory-structure/1.public.md +1 -1
  32. package/2.directory-structure/1.server.md +28 -8
  33. package/2.directory-structure/1.shared.md +3 -3
  34. package/2.directory-structure/1.utils.md +2 -2
  35. package/2.directory-structure/2.env.md +3 -3
  36. package/2.directory-structure/2.nuxtignore.md +1 -0
  37. package/2.directory-structure/2.nuxtrc.md +5 -2
  38. package/2.directory-structure/3.app-config.md +2 -2
  39. package/2.directory-structure/3.app.md +3 -3
  40. package/2.directory-structure/3.error.md +9 -5
  41. package/2.directory-structure/3.nuxt-config.md +1 -1
  42. package/2.directory-structure/3.package.md +1 -1
  43. package/2.directory-structure/3.tsconfig.md +3 -2
  44. package/2.directory-structure/index.md +12 -8
  45. package/3.guide/0.index.md +5 -2
  46. package/3.guide/1.concepts/{3.rendering.md → 1.rendering.md} +11 -32
  47. package/3.guide/1.concepts/{2.vuejs-development.md → 10.vuejs-development.md} +9 -8
  48. package/3.guide/1.concepts/{10.nuxt-lifecycle.md → 2.nuxt-lifecycle.md} +31 -24
  49. package/3.guide/1.concepts/{1.auto-imports.md → 3.auto-imports.md} +6 -6
  50. package/3.guide/1.concepts/4.server-engine.md +2 -2
  51. package/3.guide/1.concepts/5.modules.md +14 -1
  52. package/3.guide/1.concepts/7.esm.md +5 -4
  53. package/3.guide/1.concepts/8.typescript.md +9 -15
  54. package/3.guide/1.concepts/9.code-style.md +1 -1
  55. package/3.guide/2.best-practices/hydration.md +1 -1
  56. package/3.guide/2.best-practices/performance.md +5 -5
  57. package/3.guide/3.ai/.navigation.yml +3 -0
  58. package/3.guide/3.ai/1.mcp.md +277 -0
  59. package/3.guide/3.ai/2.llms-txt.md +65 -0
  60. package/3.guide/4.modules/.navigation.yml +3 -0
  61. package/3.guide/4.modules/1.getting-started.md +103 -0
  62. package/3.guide/4.modules/2.module-anatomy.md +138 -0
  63. package/3.guide/4.modules/3.recipes-basics.md +420 -0
  64. package/3.guide/4.modules/4.recipes-advanced.md +243 -0
  65. package/3.guide/4.modules/5.testing.md +76 -0
  66. package/3.guide/4.modules/6.best-practices.md +104 -0
  67. package/3.guide/4.modules/7.ecosystem.md +32 -0
  68. package/3.guide/4.modules/index.md +36 -0
  69. package/3.guide/{3.recipes → 5.recipes}/1.custom-routing.md +3 -3
  70. package/3.guide/{3.recipes → 5.recipes}/2.vite-plugin.md +4 -0
  71. package/3.guide/{3.recipes → 5.recipes}/3.custom-usefetch.md +2 -2
  72. package/3.guide/{3.recipes → 5.recipes}/4.sessions-and-authentication.md +3 -3
  73. package/3.guide/{4.going-further → 6.going-further}/1.events.md +3 -4
  74. package/3.guide/{4.going-further → 6.going-further}/1.experimental-features.md +211 -86
  75. package/3.guide/6.going-further/1.features.md +108 -0
  76. package/3.guide/{4.going-further → 6.going-further}/1.internals.md +4 -3
  77. package/3.guide/{4.going-further → 6.going-further}/10.runtime-config.md +2 -2
  78. package/3.guide/{4.going-further → 6.going-further}/11.nightly-release-channel.md +1 -1
  79. package/3.guide/{4.going-further → 6.going-further}/2.hooks.md +5 -5
  80. package/3.guide/{4.going-further → 6.going-further}/4.kit.md +3 -3
  81. package/3.guide/{4.going-further → 6.going-further}/6.nuxt-app.md +6 -6
  82. package/3.guide/{4.going-further → 6.going-further}/7.layers.md +31 -5
  83. package/3.guide/{4.going-further → 6.going-further}/9.debugging.md +3 -2
  84. package/4.api/1.components/1.nuxt-client-fallback.md +5 -1
  85. package/4.api/1.components/10.nuxt-picture.md +1 -1
  86. package/4.api/1.components/11.teleports.md +2 -2
  87. package/4.api/1.components/12.nuxt-route-announcer.md +0 -2
  88. package/4.api/1.components/13.nuxt-time.md +0 -2
  89. package/4.api/1.components/2.nuxt-page.md +3 -3
  90. package/4.api/1.components/3.nuxt-layout.md +6 -6
  91. package/4.api/1.components/4.nuxt-link.md +13 -13
  92. package/4.api/1.components/5.nuxt-loading-indicator.md +1 -1
  93. package/4.api/1.components/6.nuxt-error-boundary.md +2 -2
  94. package/4.api/1.components/7.nuxt-welcome.md +2 -2
  95. package/4.api/1.components/8.nuxt-island.md +9 -2
  96. package/4.api/2.composables/use-app-config.md +1 -1
  97. package/4.api/2.composables/use-async-data.md +5 -5
  98. package/4.api/2.composables/use-cookie.md +16 -16
  99. package/4.api/2.composables/use-error.md +3 -3
  100. package/4.api/2.composables/use-fetch.md +37 -37
  101. package/4.api/2.composables/use-head-safe.md +1 -1
  102. package/4.api/2.composables/use-head.md +22 -7
  103. package/4.api/2.composables/use-lazy-async-data.md +1 -1
  104. package/4.api/2.composables/use-lazy-fetch.md +9 -9
  105. package/4.api/2.composables/use-nuxt-app.md +9 -7
  106. package/4.api/2.composables/use-route-announcer.md +1 -3
  107. package/4.api/2.composables/use-route.md +2 -2
  108. package/4.api/2.composables/use-router.md +15 -15
  109. package/4.api/2.composables/use-runtime-config.md +5 -5
  110. package/4.api/2.composables/use-seo-meta.md +2 -2
  111. package/4.api/2.composables/use-server-seo-meta.md +2 -2
  112. package/4.api/2.composables/use-state.md +12 -2
  113. package/4.api/3.utils/$fetch.md +1 -1
  114. package/4.api/3.utils/abort-navigation.md +2 -2
  115. package/4.api/3.utils/call-once.md +2 -4
  116. package/4.api/3.utils/clear-error.md +1 -1
  117. package/4.api/3.utils/create-error.md +7 -7
  118. package/4.api/3.utils/define-lazy-hydration-component.md +5 -5
  119. package/4.api/3.utils/define-nuxt-component.md +1 -1
  120. package/4.api/3.utils/define-nuxt-plugin.md +12 -12
  121. package/4.api/3.utils/define-nuxt-route-middleware.md +2 -2
  122. package/4.api/3.utils/define-page-meta.md +18 -11
  123. package/4.api/3.utils/define-route-rules.md +2 -2
  124. package/4.api/3.utils/navigate-to.md +14 -14
  125. package/4.api/3.utils/on-before-route-leave.md +1 -1
  126. package/4.api/3.utils/on-before-route-update.md +1 -1
  127. package/4.api/3.utils/preload-route-components.md +2 -2
  128. package/4.api/3.utils/refresh-cookie.md +0 -2
  129. package/4.api/3.utils/refresh-nuxt-data.md +1 -1
  130. package/4.api/3.utils/reload-nuxt-app.md +1 -1
  131. package/4.api/3.utils/set-page-layout.md +36 -0
  132. package/4.api/3.utils/set-response-status.md +3 -3
  133. package/4.api/3.utils/show-error.md +4 -4
  134. package/4.api/3.utils/update-app-config.md +1 -1
  135. package/4.api/4.commands/add.md +12 -12
  136. package/4.api/4.commands/analyze.md +11 -11
  137. package/4.api/4.commands/build-module.md +11 -11
  138. package/4.api/4.commands/build.md +12 -12
  139. package/4.api/4.commands/cleanup.md +6 -6
  140. package/4.api/4.commands/dev.md +23 -23
  141. package/4.api/4.commands/devtools.md +7 -7
  142. package/4.api/4.commands/generate.md +12 -12
  143. package/4.api/4.commands/info.md +6 -6
  144. package/4.api/4.commands/init.md +18 -18
  145. package/4.api/4.commands/module.md +18 -18
  146. package/4.api/4.commands/prepare.md +10 -10
  147. package/4.api/4.commands/preview.md +11 -11
  148. package/4.api/4.commands/test.md +9 -9
  149. package/4.api/4.commands/typecheck.md +10 -10
  150. package/4.api/4.commands/upgrade.md +10 -10
  151. package/4.api/5.kit/1.modules.md +31 -18
  152. package/4.api/5.kit/10.templates.md +23 -23
  153. package/4.api/5.kit/11.nitro.md +40 -36
  154. package/4.api/5.kit/12.resolving.md +2 -2
  155. package/4.api/5.kit/14.builder.md +35 -23
  156. package/4.api/5.kit/16.layers.md +16 -16
  157. package/4.api/5.kit/2.programmatic.md +2 -2
  158. package/4.api/5.kit/3.compatibility.md +2 -2
  159. package/4.api/5.kit/4.autoimports.md +23 -19
  160. package/4.api/5.kit/5.components.md +35 -35
  161. package/4.api/5.kit/6.context.md +1 -1
  162. package/4.api/5.kit/8.layout.md +1 -1
  163. package/4.api/6.advanced/1.hooks.md +85 -85
  164. package/4.api/index.md +7 -7
  165. package/5.community/4.contribution.md +10 -10
  166. package/5.community/5.framework-contribution.md +9 -9
  167. package/5.community/6.roadmap.md +26 -26
  168. package/5.community/7.changelog.md +10 -0
  169. package/6.bridge/1.overview.md +8 -0
  170. package/6.bridge/3.bridge-composition-api.md +2 -2
  171. package/6.bridge/4.plugins-and-middleware.md +2 -2
  172. package/6.bridge/5.nuxt3-compatible-api.md +1 -1
  173. package/6.bridge/8.nitro.md +4 -0
  174. package/7.migration/10.bundling.md +1 -1
  175. package/7.migration/11.server.md +3 -3
  176. package/7.migration/2.configuration.md +5 -5
  177. package/7.migration/20.module-authors.md +3 -3
  178. package/7.migration/4.meta.md +1 -1
  179. package/7.migration/5.plugins-and-middleware.md +3 -3
  180. package/7.migration/6.pages-and-layouts.md +5 -5
  181. package/7.migration/7.component-options.md +6 -6
  182. package/7.migration/8.runtime-config.md +1 -1
  183. package/package.json +1 -1
  184. package/3.guide/4.going-further/1.features.md +0 -103
  185. package/3.guide/4.going-further/3.modules.md +0 -901
  186. /package/3.guide/{3.recipes → 5.recipes}/.navigation.yml +0 -0
  187. /package/3.guide/{4.going-further → 6.going-further}/.navigation.yml +0 -0
  188. /package/3.guide/{4.going-further → 6.going-further}/index.md +0 -0
@@ -48,21 +48,21 @@ Nuxt provides two globally available helpers that can be returned directly from
48
48
  1. [`navigateTo`](/docs/3.x/api/utils/navigate-to) - Redirects to the given route
49
49
  2. [`abortNavigation`](/docs/3.x/api/utils/abort-navigation) - Aborts the navigation, with an optional error message.
50
50
 
51
- Unlike [navigation guards](https://router.vuejs.org/guide/advanced/navigation-guards.html#global-before-guards) from `vue-router`, a third `next()` argument is not passed, and **redirect or route cancellation is handled by returning a value from the middleware**.
51
+ Unlike [navigation guards](https://router.vuejs.org/guide/advanced/navigation-guards#Global-Before-Guards) from `vue-router`, a third `next()` argument is not passed, and **redirect or route cancellation is handled by returning a value from the middleware**.
52
52
 
53
53
  Possible return values are:
54
54
 
55
55
  * nothing (a simple `return` or no return at all) - does not block navigation and will move to the next middleware function, if any, or complete the route navigation
56
- * `return navigateTo('/')` - redirects to the given path and will set the redirect code to [`302` Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302) if the redirect happens on the server side
57
- * `return navigateTo('/', { redirectCode: 301 })` - redirects to the given path and will set the redirect code to [`301` Moved Permanently](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301) if the redirect happens on the server side
56
+ * `return navigateTo('/')` - redirects to the given path and will set the redirect code to [`302` Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/302) if the redirect happens on the server side
57
+ * `return navigateTo('/', { redirectCode: 301 })` - redirects to the given path and will set the redirect code to [`301` Moved Permanently](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/301) if the redirect happens on the server side
58
58
  * `return abortNavigation()` - stops the current navigation
59
59
  * `return abortNavigation(error)` - rejects the current navigation with an error
60
60
 
61
- :read-more{to="/docs/api/utils/navigate-to"}
62
- :read-more{to="/docs/api/utils/abort-navigation"}
61
+ :read-more{to="/docs/3.x/api/utils/navigate-to"}
62
+ :read-more{to="/docs/3.x/api/utils/abort-navigation"}
63
63
 
64
64
  ::important
65
- We recommend using the helper functions above for performing redirects or stopping navigation. Other possible return values described in [the vue-router docs](https://router.vuejs.org/guide/advanced/navigation-guards.html#global-before-guards) may work but there may be breaking changes in future.
65
+ We recommend using the helper functions above for performing redirects or stopping navigation. Other possible return values described in [the vue-router docs](https://router.vuejs.org/guide/advanced/navigation-guards#Global-Before-Guards) may work but there may be breaking changes in future.
66
66
  ::
67
67
 
68
68
  ## Middleware Order
@@ -222,7 +222,7 @@ definePageMeta({
222
222
 
223
223
  Now, before navigation to that page can complete, the `auth` route middleware will be run.
224
224
 
225
- :link-example{to="/docs/examples/routing/middleware"}
225
+ :link-example{to="/docs/3.x/examples/routing/middleware"}
226
226
 
227
227
  ## Setting Middleware at Build Time
228
228
 
@@ -18,7 +18,7 @@ You don't need to add those local modules to your [`nuxt.config.ts`](/docs/3.x/d
18
18
  ```ts twoslash [modules/hello/index.ts]
19
19
  // `nuxt/kit` is a helper subpath import you can use when defining local modules
20
20
  // that means you do not need to add `@nuxt/kit` to your project's dependencies
21
- import { addServerHandler, createResolver, defineNuxtModule } from 'nuxt/kit'
21
+ import { addComponentsDir, addServerHandler, createResolver, defineNuxtModule } from 'nuxt/kit'
22
22
 
23
23
  export default defineNuxtModule({
24
24
  meta: {
@@ -32,6 +32,12 @@ export default defineNuxtModule({
32
32
  route: '/api/hello',
33
33
  handler: resolver.resolve('./runtime/api-route'),
34
34
  })
35
+
36
+ // Add components
37
+ addComponentsDir({
38
+ path: resolver.resolve('./runtime/app/components'),
39
+ pathPrefix: true, // Prefix your exports to avoid conflicts with user code or other modules
40
+ })
35
41
  },
36
42
  })
37
43
  ```
@@ -59,7 +65,7 @@ modules/
59
65
  2.second-module.ts
60
66
  ```
61
67
 
62
- :read-more{to="/docs/guide/going-further/modules"}
68
+ :read-more{to="/docs/3.x/guide/modules"}
63
69
 
64
70
  ::tip{icon="i-lucide-video" to="https://vueschool.io/lessons/creating-your-first-module-from-scratch?friend=nuxt" target="_blank"}
65
71
  Watch Vue School video about Nuxt private modules.
@@ -5,7 +5,7 @@ head.title: "node_modules/"
5
5
  navigation.icon: i-vscode-icons-folder-type-node
6
6
  ---
7
7
 
8
- The package manager ([`npm`](https://docs.npmjs.com/cli/commands/npm/) or [`yarn`](https://yarnpkg.com) or [`pnpm`](https://pnpm.io/cli/install) or [`bun`](https://bun.com/package-manager)) creates this directory to store the dependencies of your project.
8
+ The package manager ([`npm`](https://docs.npmjs.com/cli/commands/npm/) or [`yarn`](https://yarnpkg.com) or [`pnpm`](https://pnpm.io/cli/install) or [`bun`](https://bun.com/package-manager) or [`deno`](https://docs.deno.com/runtime/getting_started/installation/)) creates this directory to store the dependencies of your project.
9
9
 
10
10
  ::important
11
11
  This directory should be added to your [`.gitignore`](/docs/3.x/directory-structure/gitignore) file to avoid pushing the dependencies to your repository.
@@ -6,12 +6,12 @@ navigation.icon: i-vscode-icons-folder-type-view
6
6
  ---
7
7
 
8
8
  ::note
9
- To reduce your application's bundle size, this directory is **optional**, meaning that [`vue-router`](https://router.vuejs.org) won't be included if you only use [`app.vue`](/docs/3.x/directory-structure/app). To force the pages system, set `pages: true` in `nuxt.config` or have a [`app/router.options.ts`](/docs/3.x/guide/recipes/custom-routing#using-approuteroptions).
9
+ To reduce your application's bundle size, this directory is **optional**, meaning that [`vue-router`](https://router.vuejs.org) won't be included if you only use [`app.vue`](/docs/3.x/directory-structure/app). To force the pages system, set `pages: true` in `nuxt.config` or have a [`router.options.ts`](/docs/3.x/guide/recipes/custom-routing#using-routeroptions).
10
10
  ::
11
11
 
12
12
  ## Usage
13
13
 
14
- Pages are Vue components and can have any [valid extension](/docs/3.x/api/configuration/nuxt-config#extensions) that Nuxt supports (by default `.vue`, `.js`, `.jsx`, `.mjs`, `.ts` or `.tsx`).
14
+ Pages are Vue components and can have any [valid extension](/docs/3.x/api/nuxt-config#extensions) that Nuxt supports (by default `.vue`, `.js`, `.jsx`, `.mjs`, `.ts` or `.tsx`).
15
15
 
16
16
  Nuxt will automatically create a route for every page in your `~/pages/` directory.
17
17
 
@@ -33,7 +33,7 @@ export default defineComponent({
33
33
  ```
34
34
 
35
35
  ```tsx twoslash [pages/index.tsx]
36
- // https://nuxt.com/docs/examples/advanced/jsx
36
+ // https://nuxt.com/docs/3.x/examples/advanced/jsx
37
37
  // https://vuejs.org/guide/extras/render-function.html#jsx-tsx
38
38
  export default defineComponent({
39
39
  render () {
@@ -93,7 +93,7 @@ Here are some examples to illustrate what a page with a single root element look
93
93
 
94
94
  ## Dynamic Routes
95
95
 
96
- If you place anything within square brackets, it will be turned into a [dynamic route](https://router.vuejs.org/guide/essentials/dynamic-matching.html) parameter. You can mix and match multiple parameters and even non-dynamic text within a file name or directory.
96
+ If you place anything within square brackets, it will be turned into a [dynamic route](https://router.vuejs.org/guide/essentials/dynamic-matching) parameter. You can mix and match multiple parameters and even non-dynamic text within a file name or directory.
97
97
 
98
98
  If you want a parameter to be _optional_, you must enclose it in double square brackets - for example, `~/pages/[[slug]]/index.vue` or `~/pages/[[slug]].vue` will match both `/` and `/test`.
99
99
 
@@ -154,7 +154,7 @@ Navigating to `/hello/world` would render:
154
154
 
155
155
  ## Nested Routes
156
156
 
157
- It is possible to display [nested routes](https://next.router.vuejs.org/guide/essentials/nested-routes.html) with `<NuxtPage>`.
157
+ It is possible to display [nested routes](https://router.vuejs.org/guide/essentials/nested-routes) with `<NuxtPage>`.
158
158
 
159
159
  Example:
160
160
 
@@ -228,7 +228,7 @@ definePageMeta({
228
228
  </script>
229
229
  ```
230
230
 
231
- :link-example{to="/docs/examples/routing/pages"}
231
+ :link-example{to="/docs/3.x/examples/routing/pages"}
232
232
 
233
233
  ## Route Groups
234
234
 
@@ -246,6 +246,27 @@ For example:
246
246
 
247
247
  This will produce `/`, `/about` and `/contact` pages in your app. The `marketing` group is ignored for purposes of your URL structure.
248
248
 
249
+ ### Accessing Route Groups
250
+
251
+ Route groups are automatically available in the route metadata as `route.meta.groups`.
252
+ This allows you to access the group information in your components for conditional logic, styling, or other purposes.
253
+
254
+ ```vue {}[pages/(marketing)/about.vue]
255
+ <script setup lang="ts">
256
+ const route = useRoute()
257
+
258
+ console.log(route.meta.groups) // Output: ['marketing']
259
+ </script>
260
+
261
+ <template>
262
+ <div>
263
+ <p v-if="route.meta.groups?.includes('marketing')">
264
+ This is a marketing page
265
+ </p>
266
+ </div>
267
+ </template>
268
+ ```
269
+
249
270
  ## Page Metadata
250
271
 
251
272
  You might want to define metadata for each route in your app. You can do this using the `definePageMeta` macro, which will work both in `<script>` and in `<script setup>`:
@@ -268,9 +289,9 @@ console.log(route.meta.title) // My home page
268
289
  </script>
269
290
  ```
270
291
 
271
- If you are using nested routes, the page metadata from all these routes will be merged into a single object. For more on route meta, see the [vue-router docs](https://router.vuejs.org/guide/advanced/meta.html#route-meta-fields).
292
+ If you are using nested routes, the page metadata from all these routes will be merged into a single object. For more on route meta, see the [vue-router docs](https://router.vuejs.org/guide/advanced/meta).
272
293
 
273
- Much like `defineEmits` or `defineProps` (see [Vue docs](https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits)), `definePageMeta` is a **compiler macro**. It will be compiled away so you cannot reference it within your component. Instead, the metadata passed to it will be hoisted out of the component.
294
+ Much like `defineEmits` or `defineProps` (see [Vue docs](https://vuejs.org/api/sfc-script-setup#defineprops-defineemits)), `definePageMeta` is a **compiler macro**. It will be compiled away so you cannot reference it within your component. Instead, the metadata passed to it will be hoisted out of the component.
274
295
  Therefore, the page meta object cannot reference the component. However, it can reference imported bindings, as well as locally defined **pure functions**.
275
296
 
276
297
  ::warning
@@ -301,19 +322,19 @@ Of course, you are welcome to define metadata for your own use throughout your a
301
322
 
302
323
  #### `alias`
303
324
 
304
- You can define page aliases. They allow you to access the same page from different paths. It can be either a string or an array of strings as defined [in the vue-router documentation](https://router.vuejs.org/guide/essentials/redirect-and-alias.html#Alias).
325
+ You can define page aliases. They allow you to access the same page from different paths. It can be either a string or an array of strings as defined [in the vue-router documentation](https://router.vuejs.org/guide/essentials/redirect-and-alias#Alias).
305
326
 
306
327
  #### `keepalive`
307
328
 
308
- Nuxt will automatically wrap your page in [the Vue `<KeepAlive>` component](https://vuejs.org/guide/built-ins/keep-alive.html#keepalive) if you set `keepalive: true` in your `definePageMeta`. This might be useful to do, for example, in a parent route that has dynamic child routes, if you want to preserve page state across route changes.
329
+ Nuxt will automatically wrap your page in [the Vue `<KeepAlive>` component](https://vuejs.org/guide/built-ins/keep-alive#keepalive) if you set `keepalive: true` in your `definePageMeta`. This might be useful to do, for example, in a parent route that has dynamic child routes, if you want to preserve page state across route changes.
309
330
 
310
- When your goal is to preserve state for parent routes use this syntax: `<NuxtPage keepalive />`. You can also set props to be passed to `<KeepAlive>` (see [a full list](https://vuejs.org/api/built-in-components.html#keepalive)).
331
+ When your goal is to preserve state for parent routes use this syntax: `<NuxtPage keepalive />`. You can also set props to be passed to `<KeepAlive>` (see [a full list](https://vuejs.org/api/built-in-components#keepalive)).
311
332
 
312
333
  You can set a default value for this property [in your `nuxt.config`](/docs/3.x/api/nuxt-config#keepalive).
313
334
 
314
335
  #### `key`
315
336
 
316
- [See above](#child-route-keys).
337
+ [See above](/docs/3.x/directory-structure/pages#child-route-keys).
317
338
 
318
339
  #### `layout`
319
340
 
@@ -321,13 +342,13 @@ You can define the layout used to render the route. This can be either false (to
321
342
 
322
343
  #### `layoutTransition` and `pageTransition`
323
344
 
324
- You can define transition properties for the `<transition>` component that wraps your pages and layouts, or pass `false` to disable the `<transition>` wrapper for that route. You can see [a list of options that can be passed](https://vuejs.org/api/built-in-components.html#transition) or read [more about how transitions work](https://vuejs.org/guide/built-ins/transition.html#transition).
345
+ You can define transition properties for the `<transition>` component that wraps your pages and layouts, or pass `false` to disable the `<transition>` wrapper for that route. You can see [a list of options that can be passed](https://vuejs.org/api/built-in-components#transition) or read [more about how transitions work](https://vuejs.org/guide/built-ins/transition#transition).
325
346
 
326
347
  You can set default values for these properties [in your `nuxt.config`](/docs/3.x/api/nuxt-config#layouttransition).
327
348
 
328
349
  #### `middleware`
329
350
 
330
- You can define middleware to apply before loading this page. It will be merged with all the other middleware used in any matching parent/child routes. It can be a string, a function (an anonymous/inlined middleware function following [the global before guard pattern](https://router.vuejs.org/guide/advanced/navigation-guards.html#global-before-guards)), or an array of strings/functions. [More about named middleware](/docs/3.x/directory-structure/middleware).
351
+ You can define middleware to apply before loading this page. It will be merged with all the other middleware used in any matching parent/child routes. It can be a string, a function (an anonymous/inlined middleware function following [the global before guard pattern](https://router.vuejs.org/guide/advanced/navigation-guards#Global-Before-Guards)), or an array of strings/functions. [More about named middleware](/docs/3.x/directory-structure/middleware).
331
352
 
332
353
  #### `name`
333
354
 
@@ -335,7 +356,7 @@ You may define a name for this page's route.
335
356
 
336
357
  #### `path`
337
358
 
338
- You may define a path matcher, if you have a more complex pattern than can be expressed with the file name. See [the `vue-router` docs](https://router.vuejs.org/guide/essentials/route-matching-syntax.html#custom-regex-in-params) for more information.
359
+ You may define a path matcher, if you have a more complex pattern than can be expressed with the file name. See [the `vue-router` docs](https://router.vuejs.org/guide/essentials/route-matching-syntax#Custom-regex-in-params) for more information.
339
360
 
340
361
  #### `props`
341
362
 
@@ -370,7 +391,7 @@ A simple link to the `index.vue` page in your `pages` folder:
370
391
  </template>
371
392
  ```
372
393
 
373
- ::read-more{to="/docs/api/components/nuxt-link"}
394
+ ::read-more{to="/docs/3.x/api/components/nuxt-link"}
374
395
  Learn more about `<NuxtLink>` usage.
375
396
  ::
376
397
 
@@ -415,7 +436,7 @@ Server-only pages must have a single root element. (HTML comments are considered
415
436
 
416
437
  As your app gets bigger and more complex, your routing might require more flexibility. For this reason, Nuxt directly exposes the router, routes and router options for customization in different ways.
417
438
 
418
- :read-more{to="/docs/guide/recipes/custom-routing"}
439
+ :read-more{to="/docs/3.x/guide/recipes/custom-routing"}
419
440
 
420
441
  ## Multiple Pages Directories
421
442
 
@@ -443,4 +464,4 @@ export default defineNuxtConfig({
443
464
  })
444
465
  ```
445
466
 
446
- :read-more{to="/docs/guide/going-further/layers"}
467
+ :read-more{to="/docs/3.x/guide/going-further/layers"}
@@ -205,7 +205,7 @@ Note that we highly recommend using [`composables`](/docs/3.x/directory-structur
205
205
 
206
206
  ::warning
207
207
  **If your plugin provides a `ref` or `computed`, it will not be unwrapped in a component `<template>`.** :br
208
- This is due to how Vue works with refs that aren't top-level to the template. You can read more about it [in the Vue documentation](https://vuejs.org/guide/essentials/reactivity-fundamentals.html#caveat-when-unwrapping-in-templates).
208
+ This is due to how Vue works with refs that aren't top-level to the template. You can read more about it [in the Vue documentation](https://vuejs.org/guide/essentials/reactivity-fundamentals#caveat-when-unwrapping-in-templates).
209
209
  ::
210
210
 
211
211
  ## Typing Plugins
@@ -253,6 +253,9 @@ pnpm add -D vue-gtag-next
253
253
  ```bash [bun]
254
254
  bun add -D vue-gtag-next
255
255
  ```
256
+ ```bash [deno]
257
+ deno add -D npm:vue-gtag-next
258
+ ```
256
259
  ::
257
260
 
258
261
  Then create a plugin file:
@@ -22,6 +22,6 @@ useSeoMeta({
22
22
  </script>
23
23
  ```
24
24
 
25
- ::tip{to="https://v2.nuxt.com/docs/directory-structure/static" target="_blank"}
25
+ ::tip{to="https://v2.nuxt.com/docs/directory-structure/static/" target="_blank"}
26
26
  This is known as the [`static/`] directory in Nuxt 2.
27
27
  ::
@@ -112,8 +112,6 @@ For example, you can define a custom handler utility that wraps the original han
112
112
  **Example:**
113
113
 
114
114
  ```ts [server/utils/handler.ts]
115
- import type { EventHandler, EventHandlerRequest } from 'h3'
116
-
117
115
  export const defineWrappedResponseHandler = <T extends EventHandlerRequest, D> (
118
116
  handler: EventHandler<T, D>,
119
117
  ): EventHandler<T, D> =>
@@ -130,6 +128,28 @@ export const defineWrappedResponseHandler = <T extends EventHandlerRequest, D> (
130
128
  })
131
129
  ```
132
130
 
131
+ ```ts [server/api/hello.get.ts]
132
+ export default defineWrappedResponseHandler(event => 'hello world')
133
+ ```
134
+
135
+ ## Server Alias
136
+
137
+ You can use the `#server` alias to import files from anywhere within the `server/` directory, regardless of the importing file's location.
138
+
139
+ ```ts [server/api/users/[id]/profile.ts]
140
+ // Instead of relative paths like this:
141
+ // import { formatUser } from '../../../utils/formatUser'
142
+
143
+ // Use the #server alias:
144
+ import { formatUser } from '#server/utils/formatUser'
145
+ ```
146
+
147
+ This alias ensures consistent imports across your server code, especially useful in deeply nested route handlers.
148
+
149
+ ::note
150
+ The `#server` alias can only be used within the `server/` directory. Importing from `#server` in client code will result in an error.
151
+ ::
152
+
133
153
  ## Server Types
134
154
 
135
155
  ::tip
@@ -168,7 +188,7 @@ You can now universally call this API on `/api/hello/nuxt` and get `Hello, nuxt!
168
188
 
169
189
  ### Matching HTTP Method
170
190
 
171
- Handle file names can be suffixed with `.get`, `.post`, `.put`, `.delete`, ... to match request's [HTTP Method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods).
191
+ Handle file names can be suffixed with `.get`, `.post`, `.put`, `.delete`, ... to match request's [HTTP Method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods).
172
192
 
173
193
  ```ts [server/api/test.get.ts]
174
194
  export default defineEventHandler(() => 'Test get handler')
@@ -236,7 +256,7 @@ export default defineEventHandler(async (event) => {
236
256
  })
237
257
  ```
238
258
 
239
- ::tip{to="https://unjs.io/blog/2023-08-15-h3-towards-the-edge-of-the-web#runtime-type-safe-request-utils"}
259
+ ::tip{to="https://unjs.io/blog/2023-08-15-h3-towards-the-edge-of-the-web/#runtime-type-safe-request-utils"}
240
260
  Alternatively, use `readValidatedBody` with a schema validator such as Zod for runtime and type safety.
241
261
  ::
242
262
 
@@ -287,8 +307,8 @@ export default defineEventHandler((event) => {
287
307
 
288
308
  if (!Number.isInteger(id)) {
289
309
  throw createError({
290
- statusCode: 400,
291
- statusMessage: 'ID should be an integer',
310
+ status: 400,
311
+ statusText: 'ID should be an integer',
292
312
  })
293
313
  }
294
314
  return 'All good'
@@ -402,7 +422,7 @@ export default defineNuxtConfig({
402
422
  })
403
423
  ```
404
424
 
405
- :read-more{to="/docs/guide/concepts/server-engine"}
425
+ :read-more{to="/docs/3.x/guide/concepts/server-engine"}
406
426
 
407
427
  ### Nested Router
408
428
 
@@ -464,7 +484,7 @@ Never combine `next()` callback with a legacy middleware that is `async` or retu
464
484
 
465
485
  ### Server Storage
466
486
 
467
- Nitro provides a cross-platform [storage layer](https://nitro.build/guide/storage). In order to configure additional storage mount points, you can use `nitro.storage`, or [server plugins](#server-plugins).
487
+ Nitro provides a cross-platform [storage layer](https://nitro.build/guide/storage). In order to configure additional storage mount points, you can use `nitro.storage`, or [server plugins](/docs/3.x/directory-structure/server#server-plugins).
468
488
 
469
489
  **Example of adding a Redis storage:**
470
490
 
@@ -41,7 +41,7 @@ export default function (input: string) {
41
41
  }
42
42
  ```
43
43
 
44
- You can now use [auto-imported](/docs/3.x/directory-structure/shared#auto-imports) utilities in your Nuxt app and `server/` directory.
44
+ You can now use [auto-imported](/docs/3.x/directory-structure/shared) utilities in your Nuxt app and `server/` directory.
45
45
 
46
46
  ```vue [app.vue]
47
47
  <script setup lang="ts">
@@ -71,7 +71,7 @@ Only files in the `shared/utils/` and `shared/types/` directories will be auto-i
71
71
  The way `shared/utils` and `shared/types` auto-imports work and are scanned is identical to the [`composables/`](/docs/3.x/directory-structure/composables) and [`utils/`](/docs/3.x/directory-structure/utils) directories.
72
72
  ::
73
73
 
74
- :read-more{to="/docs/guide/directory-structure/composables#how-files-are-scanned"}
74
+ :read-more{to="/docs/3.x/directory-structure/composables#how-files-are-scanned"}
75
75
 
76
76
  ```bash [Directory Structure]
77
77
  -| shared/
@@ -101,4 +101,4 @@ import upper from '#shared/utils/formatters/upper'
101
101
 
102
102
  This alias ensures consistent imports across your application, regardless of the importing file's location.
103
103
 
104
- :read-more{to="/docs/guide/concepts/auto-imports"}
104
+ :read-more{to="/docs/3.x/guide/concepts/auto-imports"}
@@ -35,9 +35,9 @@ You can now use auto imported utility functions in `.js`, `.ts` and `.vue` files
35
35
  </template>
36
36
  ```
37
37
 
38
- :read-more{to="/docs/guide/concepts/auto-imports"}
38
+ :read-more{to="/docs/3.x/guide/concepts/auto-imports"}
39
39
 
40
- :link-example{to="/docs/examples/features/auto-imports"}
40
+ :link-example{to="/docs/3.x/examples/features/auto-imports"}
41
41
 
42
42
  ::tip
43
43
  The way `utils/` auto-imports work and are scanned is identical to the [`composables/`](/docs/3.x/directory-structure/composables) directory.
@@ -56,7 +56,7 @@ Since `.env` files are not used in production, you must explicitly set environme
56
56
  * Many cloud service providers, such as Vercel, Netlify, and AWS, provide interfaces for setting environment variables via their dashboards, CLI tools or configuration files.
57
57
 
58
58
  ::important
59
- `runtimeConfig` [won't pick up environment variables that don't start with `NUXT_` in production] (https://nuxt.com/docs/guide/going-further/runtime-config#environment-variables).
59
+ `runtimeConfig` [won't pick up environment variables that don't start with `NUXT_` in production] (https://nuxt.com/docs/3.x/guide/going-further/runtime-config#environment-variables).
60
60
  ::
61
61
 
62
62
  ## Production Preview
@@ -71,9 +71,9 @@ DATABASE_HOST=mydatabaseconnectionstring node .output/server/index.mjs
71
71
 
72
72
  Note that for a purely static site, it is not possible to set runtime configuration config after your project is prerendered.
73
73
 
74
- :read-more{to="/docs/guide/going-further/runtime-config"}
74
+ :read-more{to="/docs/3.x/guide/going-further/runtime-config"}
75
75
 
76
76
  ::note
77
77
  If you want to use environment variables set at build time but do not care about updating these down the line (or only need to update them reactively _within_ your app) then `appConfig` may be a better choice. You can define `appConfig` both within your `nuxt.config` (using environment variables) and also within an `~/app.config.ts` file in your project.
78
- :read-more{to="/docs/guide/directory-structure/app-config"}
78
+ :read-more{to="/docs/3.x/directory-structure/app-config"}
79
79
  ::
@@ -3,6 +3,7 @@ title: .nuxtignore
3
3
  head.title: '.nuxtignore'
4
4
  description: The .nuxtignore file lets Nuxt ignore files in your project’s root directory during the build phase.
5
5
  navigation.icon: i-vscode-icons-file-type-nuxt
6
+
6
7
  ---
7
8
 
8
9
  The `.nuxtignore` file tells Nuxt to ignore files in your project’s root directory ([`rootDir`](/docs/3.x/api/nuxt-config#rootdir)) during the build phase.
@@ -2,7 +2,7 @@
2
2
  title: ".nuxtrc"
3
3
  description: "The .nuxtrc file allows you to define nuxt configurations in a flat syntax."
4
4
  head.title: ".nuxtrc"
5
- navigation.icon: i-vscode-icons-file-type-nuxt
5
+ navigation.icon: i-vscode-icons-file-type-nuxt
6
6
  ---
7
7
 
8
8
  The `.nuxtrc` file can be used to configure Nuxt with a flat syntax. It is based on [`unjs/rc9`](https://github.com/unjs/rc9).
@@ -23,6 +23,9 @@ devtools.enabled=true
23
23
  # Add Nuxt modules
24
24
  modules[]=@nuxt/image
25
25
  modules[]=nuxt-security
26
+
27
+ # Module setups (automatically added by Nuxt)
28
+ setups.@nuxt/test-utils="3.23.0"
26
29
  ```
27
30
 
28
31
  If present, the properties in the `nuxt.config` file will overwrite the properties in `.nuxtrc` file.
@@ -31,7 +34,7 @@ If present, the properties in the `nuxt.config` file will overwrite the properti
31
34
  Nuxt automatically adds a `setups` section to track module installation and upgrade state. This is used internally for [module lifecycle hooks](/docs/3.x/api/kit/modules#using-lifecycle-hooks-for-module-installation-and-upgrade) and should not be modified manually.
32
35
  ::
33
36
 
34
- ::read-more{to="/docs/api/configuration/nuxt-config"}
37
+ ::read-more{to="/docs/3.x/api/configuration/nuxt-config"}
35
38
  Discover all the available options in the **Nuxt configuration** documentation.
36
39
  ::
37
40
 
@@ -5,7 +5,7 @@ description: Expose reactive configuration within your application with the App
5
5
  navigation.icon: i-vscode-icons-file-type-light-config
6
6
  ---
7
7
 
8
- Nuxt provides an `app.config` config file to expose reactive configuration within your application with the ability to update it at runtime within lifecycle or using a nuxt plugin and editing it with HMR (hot-module-replacement).
8
+ Nuxt provides an `app.config.ts` config file to expose reactive configuration within your application with the ability to update it at runtime within lifecycle or using a nuxt plugin and editing it with HMR (hot-module-replacement).
9
9
 
10
10
  You can easily provide runtime app configuration using `app.config.ts` file. It can have either of `.ts`, `.js`, or `.mjs` extensions.
11
11
 
@@ -59,7 +59,7 @@ console.log(appConfig) // { foo: 'baz' }
59
59
  </script>
60
60
  ```
61
61
 
62
- ::read-more{to="/docs/api/utils/update-app-config"}
62
+ ::read-more{to="/docs/3.x/api/utils/update-app-config"}
63
63
  Read more about the `updateAppConfig` utility.
64
64
  ::
65
65
 
@@ -21,7 +21,7 @@ With Nuxt, the [`pages/`](/docs/3.x/directory-structure/pages) directory is opti
21
21
  </template>
22
22
  ```
23
23
 
24
- :link-example{to="/docs/examples/hello-world"}
24
+ :link-example{to="/docs/3.x/examples/hello-world"}
25
25
 
26
26
  ### Usage with Pages
27
27
 
@@ -51,7 +51,7 @@ You can also define the common structure of your application directly in `app.vu
51
51
  Remember that `app.vue` acts as the main component of your Nuxt application. Anything you add to it (JS and CSS) will be global and included in every page.
52
52
  ::
53
53
 
54
- ::read-more{to="/docs/guide/directory-structure/pages"}
54
+ ::read-more{to="/docs/3.x/directory-structure/pages"}
55
55
  Learn more about how to structure your pages using the `pages/` directory.
56
56
  ::
57
57
 
@@ -67,6 +67,6 @@ When your application requires different layouts for different pages, you can us
67
67
  </template>
68
68
  ```
69
69
 
70
- ::read-more{to="/docs/guide/directory-structure/layouts"}
70
+ ::read-more{to="/docs/3.x/directory-structure/layouts"}
71
71
  Learn more about how to structure your layouts using the `layouts/` directory.
72
72
  ::
@@ -16,7 +16,7 @@ const props = defineProps<{ error: NuxtError }>()
16
16
 
17
17
  <template>
18
18
  <div>
19
- <h1>{{ error.statusCode }}</h1>
19
+ <h1>{{ error.status }}</h1>
20
20
  <NuxtLink to="/">Go back home</NuxtLink>
21
21
  </div>
22
22
  </template>
@@ -31,12 +31,16 @@ The error page has a single prop - `error` which contains an error for you to ha
31
31
  The `error` object provides the following fields:
32
32
  ```ts
33
33
  interface NuxtError {
34
- statusCode: number
34
+ status: number
35
35
  fatal: boolean
36
36
  unhandled: boolean
37
- statusMessage?: string
37
+ statusText?: string
38
38
  data?: unknown
39
39
  cause?: unknown
40
+ // legacy/deprecated equivalent of `status`
41
+ statusCode: number
42
+ // legacy/deprecated equivalent of `statusText`
43
+ statusMessage?: string
40
44
  }
41
45
  ```
42
46
 
@@ -44,8 +48,8 @@ If you have an error with custom fields they will be lost; you should assign the
44
48
 
45
49
  ```ts
46
50
  throw createError({
47
- statusCode: 404,
48
- statusMessage: 'Page Not Found',
51
+ status: 404,
52
+ statusText: 'Page Not Found',
49
53
  data: {
50
54
  myCustomField: true,
51
55
  },
@@ -27,7 +27,7 @@ export default defineNuxtConfig({
27
27
  })
28
28
  ```
29
29
 
30
- ::read-more{to="/docs/api/configuration/nuxt-config"}
30
+ ::read-more{to="/docs/3.x/api/configuration/nuxt-config"}
31
31
  Discover all the available options in the **Nuxt configuration** documentation.
32
32
  ::
33
33
 
@@ -27,6 +27,6 @@ The minimal `package.json` of your Nuxt application should looks like:
27
27
  }
28
28
  ```
29
29
 
30
- ::read-more{icon="i-simple-icons-npm" to="https://docs.npmjs.com/cli/configuring-npm/package-json" target="_blank"}
30
+ ::read-more{icon="i-simple-icons-npm" to="https://docs.npmjs.com/cli/configuring-npm/package-json/" target="_blank"}
31
31
  Read more about the `package.json` file.
32
32
  ::
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  title: "tsconfig.json"
3
- description: "Nuxt generates a .nuxt/tsconfig.json file with sensible defaults and your aliases."
3
+ description: "Learn how Nuxt manages TypeScript configuration across different parts of your project."
4
4
  head.title: "tsconfig.json"
5
5
  navigation.icon: i-vscode-icons-file-type-tsconfig
6
6
  ---
7
7
 
8
8
  Nuxt [automatically generates](/docs/3.x/guide/concepts/typescript) a `.nuxt/tsconfig.json` file with the resolved aliases you are using in your Nuxt project, as well as with other sensible defaults.
9
9
 
10
- You can benefit from this by creating a `tsconfig.json` in the root of your project with the following content:
10
+ Your Nuxt project should include the following `tsconfig.json` file at the root of the project:
11
11
 
12
12
  ```json [tsconfig.json]
13
13
  {
@@ -28,6 +28,7 @@ If you need to customize your `paths`, this will override the auto-generated pat
28
28
  You can customize the TypeScript configuration of your Nuxt project for each context (`app` and `server`) in the `nuxt.config.ts` file.
29
29
  <!-- @case-police-ignore tsConfig -->
30
30
  ```ts twoslash [nuxt.config.ts]
31
+ // @errors: 2353
31
32
  export default defineNuxtConfig({
32
33
  typescript: {
33
34
  // customize tsconfig.app.json
@@ -10,7 +10,7 @@ Nuxt applications have a specific directory structure that is used to organize t
10
10
 
11
11
  The root directory of a Nuxt application is the directory that contains the `nuxt.config.ts` file. This file is used to configure the Nuxt application.
12
12
 
13
- ### App Directory & Files
13
+ ## App Directory
14
14
 
15
15
  The following directories are related to the universal Nuxt application:
16
16
  - [`assets/`](/docs/3.x/directory-structure/assets): website's assets that the build tool (Vite or webpack) will process
@@ -27,7 +27,13 @@ This directory also includes specific files:
27
27
  - [`app.vue`](/docs/3.x/directory-structure/app): the root component of your Nuxt application
28
28
  - [`error.vue`](/docs/3.x/directory-structure/error): the error page of your Nuxt application
29
29
 
30
- ### Server Directory
30
+ ## Public Directory
31
+
32
+ The [`public/`](/docs/3.x/directory-structure/public) directory is the directory that contains the public files of the Nuxt application. Files contained within this directory are served at the root and are not modified by the build process.
33
+
34
+ This is suitable for files that have to keep their names (e.g. `robots.txt`) _or_ likely won't change (e.g. `favicon.ico`).
35
+
36
+ ## Server Directory
31
37
 
32
38
  The [`server/`](/docs/3.x/directory-structure/server) directory is the directory that contains the server-side code of the Nuxt application. It contains the following subdirectories:
33
39
  - [`api/`](/docs/3.x/directory-structure/server#server-routes): contains the API routes of the application.
@@ -36,12 +42,6 @@ The [`server/`](/docs/3.x/directory-structure/server) directory is the directory
36
42
  - [`plugins/`](/docs/3.x/directory-structure/server#server-plugins): use plugins and more at the creation of the Nuxt server
37
43
  - [`utils/`](/docs/3.x/directory-structure/server#server-utilities): add functions throughout your application that can be used in your server code.
38
44
 
39
- ## Public Directory
40
-
41
- The [`public/`](/docs/3.x/directory-structure/public) directory is the directory that contains the public files of the Nuxt application. Files contained within this directory are served at the root and are not modified by the build process.
42
-
43
- This is suitable for files that have to keep their names (e.g. `robots.txt`) _or_ likely won't change (e.g. `favicon.ico`).
44
-
45
45
  ## Shared Directory
46
46
 
47
47
  The [`shared/`](/docs/3.x/directory-structure/shared) directory is the directory that contains the shared code of the Nuxt application and Nuxt server. This code can be used in both the Vue app and the Nitro server.
@@ -54,6 +54,10 @@ The [`content/`](/docs/3.x/directory-structure/content) directory is enabled by
54
54
 
55
55
  The [`modules/`](/docs/3.x/directory-structure/modules) directory is the directory that contains the local modules of the Nuxt application. Modules are used to extend the functionality of the Nuxt application.
56
56
 
57
+ ## Layers Directory
58
+
59
+ The [`layers/`](/docs/3.x/directory-structure/layers) directory allows you to organize and share reusable code, components, composables, and configurations. Layers within this directory are automatically registered in your project.
60
+
57
61
  ## Nuxt Files
58
62
 
59
63
  - [`nuxt.config.ts`](/docs/3.x/directory-structure/nuxt-config) file is the main configuration file for the Nuxt application.