CodeVetter · Repo Unpack · Extension points
nuxt/nuxt
Nuxt exposes build-time modules, hooks, templates, discovery registries, and runtime plugins as its primary extension model. App and server builders can be supplied independently, with renderer options providing a further runtime adapter boundary. Fetch factories and middleware allow reusable application-level policy without replacing the core async-data machinery. Some server-build helpers are explicitly internal and experimental, so their existence does not imply stable public API.
- defineNuxtModule accepts function or object definitions and normalizes metadata; getOptions merges inline options, configKey values, defaults, and optional schema defaults, with duplicate installation prevented by module name/configKey.
- Modules can enter through layer configuration, automatically scanned local module directories, project modules, or private _modules; resolveModules tracks both module identity and resolved paths.
- Build-time hooks are attached through layer config.hooks and caller override hooks, while createNuxt exposes hook, addHooks, callHook, and runWithContext.
- addTemplate registers generated files and replaces entries targeting the same destination; addServerTemplate contributes Nitro virtual files, and addTypeTemplate attaches declarations to selected type contexts.
- Auto-import customization uses imports:sources, imports:context, imports:extend, presets, and Unimport addons; component customization receives scan results through components:extend.
- Router customization can replace or modify generated routes through routerOptions.routes and supply a custom history implementation, while router.options.mjs aggregates discovered router-options files.
- Runtime plugins can provide injected values, register hooks, declare dependsOn, execute in parallel, and opt out of island execution; applyPlugins selects dependency-aware execution when needed.
- A custom app builder can be supplied as a bundle-capable object; a server builder can likewise be an object or package, and core wrappers route failures through build:error.
- setServerBuild updates input/output paths, capabilities, runtime descriptors, and other server-build properties; the source explicitly marks this internal shape as subject to change without a major release.
- createNuxtRenderer accepts runtime options or an existing renderer instance; runtime hooks can adjust streaming preference through render:route and mutate final document fragments through render:html.
- createUseFetch and createUseAsyncData are keyed composable factories with addon handling; plain factory options act as defaults while function-derived fetch options override caller options.
- Async-data middleware wraps the handler in reverse registration order, receiving next and a signal-bearing context; payload revivers provide a separate registration point for reconstructing rich client values.