Nuxt applications have a specific directory structure that is used to organize the code. This structure is designed to be easy to understand and to be used in a consistent way.
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.
The app/ directory is the main directory of the Nuxt application. It contains the following subdirectories:
assets/: website's assets that the build tool (Vite or webpack) will processcomponents/: Vue components of the applicationcomposables/: add your Vue composableslayouts/: Vue components that wrap around your pages and avoid re-rendering between pagesmiddleware/: run code before navigating to a particular routepages/: file-based routing to create routes within your web applicationplugins/: use Vue plugins and more at the creation of your Nuxt applicationutils/: add functions throughout your application that can be used in your components, composables, and pages.This directory also includes specific files:
app.config.ts: a reactive configuration within your applicationapp.vue: the root component of your Nuxt applicationerror.vue: the error page of your Nuxt applicationThe 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.
This is suitable for files that have to keep their names (e.g. robots.txt) or likely won't change (e.g. favicon.ico).
The server/ directory is the directory that contains the server-side code of the Nuxt application. It contains the following subdirectories:
api/: contains the API routes of the application.routes/: contains the server routes of the application (e.g. dynamic /sitemap.xml).middleware/: run code before a server route is processedplugins/: use plugins and more at the creation of the Nuxt serverutils/: add functions throughout your application that can be used in your server code.The 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.
The content/ directory is enabled by the Nuxt Content module. It is used to create a file-based CMS for your application using Markdown files.
The 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.
nuxt.config.ts file is the main configuration file for the Nuxt application..nuxtrc file is another syntax for configuring the Nuxt application (useful for global configurations)..nuxtignore file is used to ignore files in the root directory during the build phase.