How to understand a Nuxt codebase
Nuxt is the full-stack Vue framework. It relies heavily on conventions and auto-imports: components, composables and utilities can be used without import statements, and files under `server/` become API routes run by Nitro. Nuxt 4 moved app code into an `app/` directory by default.
How to tell it's Nuxt
nuxt.config.tsandnuxtinpackage.jsonpages/,components/,composables/andserver/folders (insideapp/on Nuxt 4)- A generated
.nuxt/folder with auto-import type declarations
Where things usually live
- nuxt.config.ts
- Modules, runtime config, route rules, app head settings.
- pages/
- File-based routes;
[id].vueis dynamic. - layouts/
- Page layouts selected with
definePageMeta. - components/ and composables/
- Auto-imported by name; nested folders prefix component names.
- middleware/
- Route middleware that runs before navigation (for example, auth).
- plugins/
- Code that runs when the app starts, on server, client or both.
- server/api/ and server/routes/
- Nitro handlers defined with
defineEventHandler.
Conventions, not rules. Real projects rename and move things, so confirm against the repository.
Where to start reading
nuxt.config.ts, to see modules and runtime config- The page under
pages/and itsuseFetchoruseAsyncDatacalls server/api/for the endpoints those calls hit
How a request moves through the code
- Server middleware and Nitro route rules run first.
- Route middleware in
middleware/runs, possibly redirecting. - The page renders on the server;
useFetchanduseAsyncDatafetch data and serialise it into the payload. - Fetches to
/api/*callserver/api/handlers directly during server rendering. - The browser hydrates, reusing the payload instead of fetching again.
Questions to ask about the repository
- Where is this auto-imported composable actually defined?
- Which server routes exist under
server/, and which pages call them? - What runs in plugins on startup, and on which side?
- Which values in
runtimeConfigare public, and which are server-only?
What trips people up
- Auto-imports hide where things come from; search
components/,composables/,utils/and installed modules by name. - Only
runtimeConfig.publicreaches the browser; everything else inruntimeConfigis server-only. - The folder layout differs between Nuxt 3 and Nuxt 4, so check whether an
app/directory is in use.