Root Directory
The root directory of a Nuxt application contains thenuxt.config.ts file. This file is used to configure your Nuxt application.
App Directory
Theapp/ directory is the main directory of your Nuxt application. It contains the following subdirectories:
assets/: Website assets that the build tool (Vite or webpack) will processcomponents/: Vue components of your applicationcomposables/: Vue composables for your application logiclayouts/: Vue components that wrap around your pages and avoid re-rendering between pagesmiddleware/: Code to run before navigating to a particular routepages/: File-based routing to create routes within your web applicationplugins/: Vue plugins and more at the creation of your Nuxt applicationutils/: Functions available throughout your application in components, composables, and pages
app.config.ts: Reactive configuration within your applicationapp.vue: The root component of your Nuxt applicationerror.vue: The error page of your Nuxt application
Public Directory
Thepublic/ directory contains public files served at the root. Files here are not modified by the build process.
This is suitable for files that need to keep their names (e.g., robots.txt) or likely won’t change (e.g., favicon.ico).
Server Directory
Theserver/ directory contains the server-side code of your Nuxt application. It includes:
api/: API routes of your applicationroutes/: Server routes (e.g., dynamic/sitemap.xml)middleware/: Code to run before a server route is processedplugins/: Plugins at the creation of the Nuxt serverutils/: Functions for your server code
Shared Directory
Theshared/ directory contains code shared between your Nuxt application and Nuxt server. This code can be used in both the Vue app and the Nitro server.
Content Directory
Thecontent/ directory is enabled by the Nuxt Content module. It creates a file-based CMS using Markdown files.
Modules Directory
Themodules/ directory contains local modules of your Nuxt application. Modules extend the functionality of your Nuxt application.
Layers Directory
Thelayers/ directory allows you to organize and share reusable code, components, composables, and configurations. Layers within this directory are automatically registered in your project.
Nuxt Files
nuxt.config.ts: Main configuration file for your Nuxt application.nuxtrc: Configuration syntax for global configurations.nuxtignore: Files to ignore in the root directory during the build phase