CodeVetter · Repo Unpack · Data flow
nuxt/nuxt
Configuration and filesystem inputs are transformed into resolved options, discovered application structure, generated modules, and bundled artifacts. Incoming requests enter a server adapter and receive a fresh SSR context before Vue plugins, routing, and page data execute. Async results and useState values become serialized payloads that the browser revives before mounting. Session persistence follows a separate cookie-sealing path and does not use the hydration-state registry.
- loadNuxtConfig populates environment-based defaults before loading the schema, imports executable config with native import or Jiti fallback, and passes layered configuration through c12.
- Resolved layer configuration supplies user hooks in reverse layer order; module resolution similarly registers extended-layer modules before project modules and deduplicates resolved module paths.
- generateApp resolves application structure, combines default and user templates, invokes app:templates, compiles contents, and stores changed results under absolute paths and #build aliases in nuxt.vfs.
- Page files from layer appPages directories become prioritized InputFile entries, then a PagesContext route tree and augmented NuxtPage records; routes.mjs serializes normalized routes and imports for runtime use.
- Nitro's renderer adapter converts ServerRequest through createEvent, then renderRoute calls createSSRContext to attach URL, runtime config, head manager, payload, reducer registry, and module tracking.
- createNuxtApp connects its payload to ssrContext and exposes only runtimeConfig.public and runtimeConfig.app as client config, while private runtime config remains available through the server context.
- useFetch derives a hashed key from the request and option segments, selects custom $fetch or request-scoped server fetching, and delegates execution to useAsyncData with a cancellation signal.
- Async-data execution applies transform and pick before assigning data/status; unless serialize is false, the same result is written into nuxtApp.payload.data[key], and stale replaced promises are prevented from updating state.
- Payload output uses devalue stringify with custom reducers; splitPayload separates data and prerenderedAt from initial state, and renderRoute chooses full inline JSON or initial JSON referencing an external payload URL.
- Client payload loading parses __NUXT_DATA__, optionally retrieves external JSON with force-cache for prerendered pages or no-cache for runtime pages, merges client config, and installs registered revivers before assigning the result to NuxtApp.
- Hydration reads async-data values from payload.data and useState values from payload.state; ordinary nonmanual async-data cache lookup can instead read nuxtApp.static.data after hydration.
- Session input arrives through a named request cookie, is unsealed once per event/name, and becomes a cached Session object; updates merge data, reseal the versioned payload, and replace that session's Set-Cookie header.