CodeVetter · Repo Unpack · Behavior traces
nuxt/nuxt
The traced flows cover framework startup/build, an SSR page request through browser hydration, SSR-friendly fetching, and cookie persistence across requests. Each trace follows concrete functions and state transitions in the inspected implementation. Development regeneration and error rendering add alternate paths that influence these flows. These are source-derived execution sequences, not observed runtime executions.
- Startup begins with kit loadNuxt normalizing cwd and dev overrides, resolving the installed nuxt package, and importing its loadNuxt; core loadNuxt then calls loadNuxtConfig and createNuxt, and awaits ready unless ready:false.
- Initialization registers core pages/head/components/compiler/import/schema modules, installs resolved modules, emits modules:done, calls bundleServer, registers payload support, and emits ready.
- A normal build calls ensureGeneratedTsConfigs → createApp → generateApp → resolveBuilder → build:before → builder.bundle → build:done; a production build then closes Nuxt.
- In the separate Nitro build path, build:done invokes nitro:build:before → prepare; development calls build and waits for compiled, while production calls prerender and then build, with public assets copied through rollup:before.
- A buffered SSR request follows Nitro handler.fetch → createEvent → renderer.fetch → renderRoute → createSSRContext → instance.getRenderer; build-files loads the server entry and creates vue-bundle-renderer's renderer.
- The server entry runs createApp(RootComponent) → createNuxtApp → applyPlugins → app:created; buffered rendering then calls renderToString, app:rendered, render:html, and runtime.createResponse for the document.
- Browser startup detects serverRendered/data-ssr → chooses createSSRApp or createApp → creates NuxtApp → applies plugins, including payload revival → emits app:created and app:beforeMount → mounts → emits app:mounted.
- SSR fetching follows useFetch → useAsyncData → createInitialFetch/buildAsyncData → execute → selected $fetch; server execution registers its promise with onServerPrefetch or app:created, then applies transforms and writes serializable data to the payload.
- Cookie persistence follows useSession → getSession → loadSession → getCookie/unsealSession; missing or invalid seals create a UUID session, and updateSession → sealSession → setSessionCookie writes a cookie that the next request can load.
- Development changes enter builder:watch: structural changes invalidate application discovery, eligible content changes regenerate filtered templates, and unfiltered builder:generateApp requests force complete structure resolution.
- Renderer error dispatch rejects direct external /__nuxt_error access, avoids inline HTML handling for JSON requests and recursive error renders, and otherwise catches route-render failures through renderErrorResponse.