This document provides a high-level introduction to the Nuxt framework repository structure, architecture, and core systems. Nuxt is a full-stack web framework built on Vue.js that provides server-side rendering (SSR), static site generation (SSG), file-based routing, auto-imports, and a pluggable module ecosystem.
This page covers the monorepo organization, package relationships, and fundamental architectural patterns. For detailed information about specific subsystems, refer to:
Sources: README.md1-120 packages/nuxt/package.json1-144 docs/5.community/5.framework-contribution.md1-143
The Nuxt repository is organized as a pnpm workspace monorepo containing seven primary packages:
| Package | NPM Name | Purpose | Key Exports |
|---|---|---|---|
packages/nuxt | nuxt | Core framework providing application runtime, modules, and CLI | dist/index.mjs, dist/app/index.js |
packages/kit | @nuxt/kit | Toolkit for authoring modules with utilities like defineNuxtModule, addComponent | dist/index.mjs |
packages/schema | @nuxt/schema | TypeScript types and configuration defaults shared across packages | dist/index.mjs |
packages/vite | @nuxt/vite-builder | Vite bundler integration for development and production builds | dist/index.mjs |
packages/webpack | @nuxt/webpack-builder | Webpack 5 bundler integration | dist/index.mjs |
packages/rspack | @nuxt/rspack-builder | Rspack bundler integration for faster builds | dist/index.mjs |
packages/nitro-server | @nuxt/nitro-server | Server runtime for SSR rendering, API routes, and middleware | dist/index.mjs |
Sources: package.json1-133 pnpm-lock.yaml1-243 packages/nuxt/package.json56-112 packages/kit/package.json26-47 packages/schema/package.json70-76 packages/vite/package.json40-69 packages/webpack/package.json31-75 packages/rspack/package.json31-74
Nuxt's architecture consists of four distinct layers:
Sources: packages/nuxt/package.json14-39 packages/kit/package.json1-64 packages/schema/package.json1-80
The following diagram shows how HTTP requests flow through Nuxt's server-side rendering pipeline, mapping to actual code constructs:
Sources: packages/nitro-server/package.json344-425 packages/nuxt/package.json34-39
Nuxt uses a layered configuration system with type safety provided by @nuxt/schema:
nuxt.config.ts: Main configuration file defining modules, build settings, and runtime configapp.config.ts: Reactive application configuration exposed to both client and serverextends property using c12 packageSources: packages/schema/package.json70-76 packages/nuxt/package.json67
Nuxt provides three pluggable bundler options:
vite@^7.3.1 with Environment API for parallel client/server buildswebpack@^5.105.4 with vue-loader@^17.4.2@rspack/core@^1.7.7 for faster compilationAll builders share common plugins for transformations: TreeShakeComposablesPlugin, UnctxTransformPlugin, DevOnlyPlugin, LayerAliasingPlugin.
Sources: packages/vite/package.json65 packages/webpack/package.json70 packages/rspack/package.json34 pnpm-lock.yaml50-55
Nuxt automatically discovers and registers application code:
| Directory | Purpose | Scanner | Output |
|---|---|---|---|
pages/ | File-based routing | resolvePagesRoutes | routes.mjs via unrouting |
components/ | Component auto-registration | scanComponents | components.d.ts |
composables/ | Auto-imports | unimport scanner | imports.d.ts, #imports |
plugins/ | Plugin registration | resolvePaths | plugins.mjs |
middleware/ | Route middleware | scanMiddleware | Route guards |
layouts/ | Layout components | scanLayouts | Layout system |
Sources: packages/nuxt/package.json94-111
Nuxt's extensibility is powered by @nuxt/kit, which provides:
defineNuxtModule: Type-safe module definition with metadata and setup hooksaddTemplate, addTypeTemplate for virtual filesaddComponent, addComponentsDiraddImports, addImportsDiraddBuildPlugin, addVitePlugin, addWebpackPluginaddServerHandler, addServerImportsSources: packages/kit/package.json26-47
The @nuxt/nitro-server package provides:
defineRenderHandler creates the HTML responseserver/api/server/middleware/devalue@^5.6.3 and @nuxt/devalue@^2.0.2vue-bundle-renderer@^2.2.0Sources: packages/nitro-server/package.json344-425
| Technology | Version | Purpose |
|---|---|---|
| Vue.js | 3.5.29 | UI framework (pinned via resolutions) |
| Vue Router | ^5.0.3 | Client-side routing |
| Vite | ^7.3.1 | Default bundler |
| Webpack | ^5.105.4 | Alternative bundler |
| Rspack | ^1.7.7 | Fast bundler alternative |
| Nitropack | ^2.13.1 | Server engine |
| unimport | ^6.0.1 | Auto-imports implementation |
| oxc-parser | ^0.116.0 | Fast AST parsing for metadata |
| h3 | ^1.15.5 | HTTP server framework |
| unhead | ^2.1.10 | Head management |
Sources: package.json43-56 pnpm-lock.yaml7-19 packages/nuxt/package.json56-112
The repository uses a comprehensive CI/CD pipeline:
CI Configuration:
ubuntu-24.04-arm and windows-latest across multiple configurationsvite, vite-env-api, webpack, rspackdev (development) and built (production)async/default context, manifest-on/manifest-off, json/js payloadSources: .github/workflows/ci.yml1-490 test/bundle.test.ts1-178
pnpm@10.30.3obuild@0.4.31 for package buildingvue-tsc@3.2.5 with strict TypeScriptvitest@4.0.18 for unit tests, @playwright/test@1.58.2 for E2ESources: package.json130 pnpm-lock.yaml1-243
pnpm install --frozen-lockfilepnpm dev:prepare (generates types and stubs packages)pnpm dev (runs playground with HMR)pnpm test (runs all test suites)pnpm typecheck (Vue TSC validation)| Script | Command | Purpose |
|---|---|---|
dev:prepare | pnpm --filter './packages/**' build:stub && nuxt prepare | Stub packages and generate types |
build | pnpm --filter './packages/**' prepack | Build all packages |
test:fixtures | vitest run --project fixtures | Run fixture tests |
test:e2e | playwright test | Run end-to-end tests |
test:types | pnpm --filter './test/fixtures/**' test:types | Type check fixtures |
Sources: package.json10-42 docs/5.community/5.framework-contribution.md18-96
The nuxi CLI is the primary interface for developers:
Sources: packages/nuxt/package.json14-17
The #app alias provides the client-side runtime:
#app/nuxt: Core NuxtApp instance and composables#app/composables: Built-in composables like useFetch, useRoute, useStatedist/app/index.js: Main application bundle exportSources: packages/nuxt/package.json34-39
Nuxt supports 300+ community modules for extending functionality. Modules use the @nuxt/kit APIs to:
addComponent({ name: 'MyComponent', filePath: './component.vue' })addImports({ name: 'useMyComposable', from: './composable' })addTypeTemplate({ filename: 'types/my-module.d.ts', getContents: () => '...' })extendPages((pages) => { /* modify routes */ })addVitePlugin(() => myPlugin())Sources: README.md26 packages/kit/package.json1-64
Sources: LICENSE1-22 README.md1-120 .github/workflows/scorecards.yml1-75
Refresh this wiki
This wiki was recently refreshed. Please wait 7 days to refresh again.