# Nuxt

Nuxt scores 22 of 28 points on 14 speed features: 11/14 on first-paint levers and 11/14 on other features. Rank 6 of 23. Labels: 8 1st-party, 5 Experimental, 1 Third-party, 0 Manual.

- Version checked: nuxt aliased to nuxt-nightly 4.6.0-29813110.5c8fe35d (pre-release nightly; npm latest 4.6.4), compatibilityVersion 5 (optimized and nuxt-books-optimized-max branches (main is nuxt ^4.5.2); Vercel runtime cache; routeRules; Fontsource fonts; no @nuxt/fonts)
- Performance guide: [Nuxt performance · Best Practices v4](https://nuxt.com/docs/4.x/guide/best-practices/performance)
- Issue tracker: https://github.com/nuxt/nuxt/issues
- Books demo port: [nuxt-books](https://github.com/MaxwellCohen/nuxt-books)

## Summary

| Feature | Group | Label | Points |
| --- | --- | --- | --- |
| [Production CSS inlining](https://framework-compare.vercel.app/features/css-inlining.md) | First-paint levers | 1st-party | 2 |
| [Font optimization](https://framework-compare.vercel.app/features/font-optimization.md) | First-paint levers | 1st-party | 2 |
| [Image pipeline](https://framework-compare.vercel.app/features/image-pipeline.md) | First-paint levers | 1st-party | 2 |
| [Data/HTML caching](https://framework-compare.vercel.app/features/caching.md) | First-paint levers | 1st-party | 2 |
| [Route prefetching](https://framework-compare.vercel.app/features/route-prefetching.md) | First-paint levers | Experimental | 1 |
| [Streaming SSR](https://framework-compare.vercel.app/features/streaming-ssr.md) | First-paint levers | Experimental | 1 |
| [Early Hints / preload headers](https://framework-compare.vercel.app/features/early-hints.md) | First-paint levers | Experimental | 1 |
| [Islands / partial hydration / lazy slices](https://framework-compare.vercel.app/features/islands.md) | Other features | Experimental | 1 |
| [Per-route render modes](https://framework-compare.vercel.app/features/render-modes.md) | Other features | 1st-party | 2 |
| [Fine-grained client reactivity](https://framework-compare.vercel.app/features/reactivity.md) | Other features | 1st-party | 2 |
| [Built-in bundle analysis](https://framework-compare.vercel.app/features/bundle-analysis.md) | Other features | Experimental | 1 |
| [Third-party script strategies](https://framework-compare.vercel.app/features/third-party-scripts.md) | Other features | 1st-party | 2 |
| [Portable multi-host deployment](https://framework-compare.vercel.app/features/multi-host-deployment.md) | Other features | 1st-party | 2 |
| [Service worker / offline support](https://framework-compare.vercel.app/features/service-worker.md) | Other features | Third-party | 1 |

## First-paint levers

### Production CSS inlining

Label: **1st-party** (2 of 2 points).

Set [`features.inlineStyles: true`](https://nuxt.com/docs/4.x/guide/going-further/features), but only on this repo's `nuxt-books-optimized-max` branch; the plain `optimized` build leaves the global stylesheet linked.

```ts
export default defineNuxtConfig({
  features: {
    // Production SSR embeds entry and component CSS in the HTML.
    inlineStyles: true,
  },
});
```

*From this repo's `nuxt-books/nuxt.config.ts` (`nuxt-books-optimized-max` branch).*

Gotchas:

- Nuxt keeps `inlineStyles` off in dev so stylesheet HMR still works; check the production build.

### Font optimization

Label: **1st-party** (2 of 2 points).

Add the official [`@nuxt/fonts`](https://nuxt.com/modules/fonts) module. It resolves the fonts used in CSS, downloads them at build time, serves them from your own origin, injects `@font-face` rules, generates fallback metrics for lower CLS, and can subset.

```ts
export default defineNuxtConfig({
  modules: [
    '@nuxt/fonts',
  ]
})
```

*Adapted from [the module page](https://nuxt.com/modules/fonts).* This port does not use it; it imports `@fontsource-variable/geist` manually, so the capability exists in the framework even though this repo took the third-party route:

```css
@import '@fontsource-variable/geist';
```

*From this repo's `nuxt-books/app/assets/css/main.css` (`optimized` branch).*

Gotchas:

- `@nuxt/fonts` reads Tailwind v4's `--font-*` theme variables, so the family name must be written there literally (not `var(--font-geist-sans)`) for it to resolve, download and preload the font.

### Image pipeline

Label: **1st-party** (2 of 2 points).

Install [`@nuxt/image`](https://nuxt.com/modules/image) (separate official module) and use [`<NuxtImg preload>`](https://nuxt.com/modules/image/usage/nuxt-img) on the first covers.

```ts
modules: ['@nuxt/image'],
image: {
  provider: isCloudflare ? 'none' : 'auto',
  quality: 82,
},
```

```vue
<NuxtImg :src="source" :sizes="sizes" :preload="priority" :width="400" :height="600" />
```

*From this repo's `nuxt-books/nuxt.config.ts` (`nuxt-books-optimized-max` branch) and `app/components/BookCover.vue` (`optimized` branch; some props and options omitted).*

Art direction with `<picture>` (1st-party, not scored):

[`<NuxtPicture>`](https://nuxt.com/modules/image/usage/nuxt-picture) serves modern formats with a fallback via `@nuxt/image`; its docs say it does not support multiple image sources, so no breakpoint art direction.

```vue
<NuxtPicture
  format="avif,webp"
  src="/nuxt-icon.png"
/>
```

*From [the NuxtPicture docs](https://nuxt.com/modules/image/usage/nuxt-picture).*

Gotchas:

- IPX does not run on Cloudflare Workers, so this port switches image optimization off there.

### Data/HTML caching

Label: **1st-party** (2 of 2 points).

Wrap handlers in [`defineCachedEventHandler`](https://v2.nitro.build/guide/cache) (the Nitro v2 API that this Nuxt 4 port runs on, `nitropack` 2.13.4; Nitro v3 calls it `defineCachedHandler`), configure `nitro.storage.cache`, and add a header-only [`routeRules`](https://nuxt.com/docs/4.x/guide/concepts/rendering#hybrid-rendering) cache. The optimized branch uses the Vercel runtime cache, and the max branch adds Netlify Blobs and Cloudflare KV drivers.

```ts
export default defineCachedEventHandler(
  async event => { /* ... */ },
  {
    getKey: event => hashCacheKey(/* filters from the query */),
    maxAge: 60 * 60,
    name: 'books-count',
    swr: true,
  },
);
```

```ts
routeRules: {
  '/**': { cache: { headersOnly: true, maxAge: 3600 } },
  '/api/**': { cache: false },
},
```

*From this repo's `nuxt-books/server/api/books/count.get.ts` (`optimized` branch; handler body elided) and `nuxt.config.ts` (`nuxt-books-optimized-max` branch).*

### Route prefetching

Label: **Experimental** (1 of 2 points).

Use [`<NuxtLink>`](https://nuxt.com/docs/4.x/api/components/nuxt-link) `prefetch-on="visibility" | "interaction"`, `_payload.json` payload prefetch, and [`experimental.prefetchPreloadTags`](https://nuxt.com/docs/4.x/guide/going-further/experimental-features) (experimental, off by default).

```vue
<FastLink :prefetch-on="eagerPrefetch ? 'visibility' : 'interaction'" :to="href">
```

```ts
experimental: {
  prefetchPreloadTags: true,
},
```

*From this repo's `nuxt-books/app/components/BookCard.vue` (`FastLink` is this repo's wrapper around `NuxtLink`; class omitted) and `nuxt.config.ts` (`optimized` branch; `early404` omitted).*

### Streaming SSR

Label: **Experimental** (1 of 2 points).

Set [`experimental.ssrStreaming: true`](https://nuxt.com/docs/4.x/guide/going-further/experimental-features). The server sends the shell (`<head>`, styles, preload hints, entry scripts) first and then streams the body with Vue's `renderToWebStream`. `routeRules` can switch it off per route.

```ts
export default defineNuxtConfig({
  experimental: {
    ssrStreaming: true,
  },
  routeRules: {
    '/no-stream/**': { streaming: false },
  },
})
```

*From [the Nuxt experimental features docs](https://nuxt.com/docs/4.x/guide/going-further/experimental-features).*

### Early Hints / preload headers

Label: **Experimental** (1 of 2 points).

Set [`experimental.writeEarlyHints: true`](https://nuxt.com/docs/4.x/guide/going-further/experimental-features). Nuxt then writes a 103 with the page's preload links. The docs limit it to the Node server.

```ts
export default defineNuxtConfig({
  experimental: {
    writeEarlyHints: true,
  },
})
```

*From [the Nuxt experimental features docs](https://nuxt.com/docs/4.x/guide/going-further/experimental-features).*

## Other features

### Islands / partial hydration / lazy slices

Label: **Experimental** (1 of 2 points).

Documented [lazy hydration](https://nuxt.com/docs/4.x/directory-structure/app/components) (`hydrate-on-visible`, `-on-idle`, `-on-interaction`, `-on-media-query`, `hydrate-never` on `Lazy*` components, SFC only; on by default; the switch is `experimental.lazyHydration`) and [`features.noScripts`](https://nuxt.com/docs/4.x/guide/going-further/features) / `noScripts`:

```vue
<template>
  <div>
    <LazyMyComponent hydrate-on-visible />
  </div>
</template>
```

*Adapted from [the components docs](https://nuxt.com/docs/4.x/directory-structure/app/components).* Server components and islands stay experimental: [server components and islands](https://nuxt.com/docs/4.x/guide/concepts/server-components) render a component with no client JS; prop changes refetch the island ([`<NuxtIsland>`](https://nuxt.com/docs/4.x/api/components/nuxt-island)), and props travel as query parameters so island responses can be cached by a CDN. `nuxt-client` selective hydration works only on local `.vue` SFCs, and slots passed to `nuxt-client` components are server-rendered and not interactive.

Gotchas:

- `nuxt-client` hydration and `Lazy*` hydration only work on SFCs; slot content passed to `nuxt-client` components is not interactive.

### Per-route render modes

Label: **1st-party** (2 of 2 points).

[`routeRules`](https://nuxt.com/docs/4.x/guide/concepts/rendering#hybrid-rendering): globs map to `prerender`, `swr`, `isr`, `ssr: false`, cache headers, redirects, and proxy rules.

```ts
export default defineNuxtConfig({
  routeRules: {
    '/admin/**': { ssr: false },
  },
})
```

*Adapted from [the rendering docs](https://nuxt.com/docs/4.x/guide/concepts/rendering#hybrid-rendering).* This port uses a header-only cache rule on `/**` (needed for `_payload.json` prefetch) and disables caching on `/api/**`, shown in [section 4](https://framework-compare.vercel.app/features/caching).

### Fine-grained client reactivity

Label: **1st-party** (2 of 2 points).

Vue's [`ref`/`reactive`](https://vuejs.org/guide/essentials/reactivity-fundamentals) tracks dependencies and updates the affected effects. Nothing to enable.

```ts
const value = ref('');
```

*From this repo's `nuxt-books/app/components/BookSearch.vue` (`optimized` branch).*

### Built-in bundle analysis

Label: **Experimental** (1 of 2 points).

[`nuxt analyze`](https://nuxt.com/docs/4.x/api/commands/analyze) (experimental) builds the app and serves client and Nitro reports; `--json` writes machine-readable output.

```bash
npx nuxt analyze [ROOTDIR] [--serve] [--prerender] [--json]
```

*Adapted from [the analyze command docs](https://nuxt.com/docs/4.x/api/commands/analyze) (other flags omitted).* With Nuxt 5 behaviour the Nitro report needs `rollup-plugin-visualizer`. The non-experimental [`build.analyze`](https://nuxt.com/docs/4.x/api/nuxt-config#analyze) config option also writes a client-bundle report during a normal `nuxt build`; with the default Vite builder it loads the community `rollup-plugin-visualizer`, which must be installed in the project (optional peer dependency), so the cell stays 🧪.

### Third-party script strategies

Label: **1st-party** (2 of 2 points).

`@nuxt/scripts` is a separate official module ([modules page](https://nuxt.com/modules/scripts), [GitHub](https://github.com/nuxt/scripts)) with per-script strategy and proxying; [`useScript`](https://scripts.nuxt.com/docs/api/use-script)'s `partytown` option loads a script in a web worker and needs `@nuxtjs/partytown` installed and configured separately.

```ts
const { onLoaded, onError, status } = useScript('https://example.com/sdk.js')
```

*From [the useScript docs](https://scripts.nuxt.com/docs/api/use-script).*

Gotchas:

- Nuxt's `partytown` option needs `@nuxtjs/partytown` installed and configured separately.

### Portable multi-host deployment

Label: **1st-party** (2 of 2 points).

Nitro [`presets`](https://nitro.build/deploy) cover every host this repo targets (Node, Vercel, Netlify, Cloudflare). Vercel and Netlify auto-detect their presets; force Workers explicitly:

```ts
nitro: {
  preset: isCloudflare ? 'cloudflare_module' : undefined,
},
```

*From this repo's `nuxt-books/nuxt.config.ts` (`nuxt-books-optimized-max` branch).*

### Service worker / offline support

Label: **Third-party** (1 of 2 points).

Add the community [`@vite-pwa/nuxt`](https://vite-pwa-org.netlify.app/frameworks/nuxt) module (listed in the [Nuxt modules directory](https://nuxt.com/modules/vite-pwa-nuxt)). It generates the service worker and the precache manifest with Workbox and registers it.

```ts
export default defineNuxtConfig({
  modules: ['@vite-pwa/nuxt'],
  pwa: {
    /* PWA options */
  },
})
```

*From [the Vite PWA Nuxt docs](https://vite-pwa-org.netlify.app/frameworks/nuxt).*

## Other performance features

`crossOriginPrefetch`, `payloadExtraction` ([experimental features](https://nuxt.com/docs/4.x/guide/going-further/experimental-features)).

## Deployments of the Books demo

| Branch | Note | Vercel | Netlify | Cloudflare |
| --- | --- | --- | --- | --- |
| `main` | vibe port | https://nuxt-books-navy.vercel.app | https://nuxt-books.netlify.app | https://nuxt-books.to-email-max.workers.dev |
| `optimized` | fork from work by atinux — thanks | https://nuxt-books-optimized.vercel.app | https://nuxt-books-max-optimized.netlify.app | https://nuxt-books-optimized.to-email-max.workers.dev |
| `nuxt-books-optimized-max` | atinux port + persistent Nitro cache on Netlify and Cloudflare | https://nuxt-books-optimized-max.vercel.app | https://nuxt-books-optimized-max.netlify.app | https://nuxt-books-optimized-max.to-email-max.workers.dev |

## Benchmark, 2026-11-28

Tool: PageSpeed Insights v5 (Lighthouse lab run), mobile strategy. 3 measured runs per deployment, median reported; cold runs are left out of the median when a warm run exists. Each build's figure is the average of its hosts' medians (vercel, netlify, cloudflare). Pages measured: book list (/) and one book (/10145787). Times are lab values from one run on 2026-11-28. FCP is the Lighthouse estimate for simulated Slow 4G; Raw FCP, where shown, is the first paint in the real, unthrottled load that estimate is built from. Builds in the same FCP band (https://framework-compare.vercel.app/measured.md) are a tie, so read "fastest first" as band order.

| Page | Build | Branch | Hosts | Performance | FCP | Raw FCP | LCP | TBT | CLS |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| book list (/) | baseline | `main` | cloudflare, netlify, vercel | 84 | 1.53 s | 1.99 s | 4.26 s | 0 ms | 0.000 |
| book list (/) | optimized | `optimized` | cloudflare, netlify, vercel | 93 | 0.93 s | 0.24 s | 3.15 s | 15 ms | 0.001 |
| one book (/10145787) | baseline | `main` | cloudflare, netlify, vercel | 96 | 1.51 s | 0.98 s | 2.57 s | 0 ms | 0.000 |
| one book (/10145787) | optimized | `optimized` | cloudflare, netlify, vercel | 100 | 0.93 s | 0.60 s | 1.63 s | 7 ms | 0.001 |

Full run: https://framework-compare.vercel.app/benchmark.md

---

HTML version: https://framework-compare.vercel.app/frameworks/nuxt · All pages: https://framework-compare.vercel.app/llms.txt · Data: https://framework-compare.vercel.app/api/index.json
