# Next

Next scores 25 of 28 points on 14 speed features: 13/14 on first-paint levers and 12/14 on other features. Rank 2 of 23. Labels: 11 1st-party, 1 Experimental, 2 Third-party, 0 Manual.

- Version checked: next 16.4.6 (npm latest) (Cache Components, inlineCss, reactCompiler, partialPrefetching, ensureStatic = 'shell')
- Performance guide: [How to optimize your Next.js application for production](https://nextjs.org/docs/app/guides/production-checklist)
- Issue tracker: https://github.com/vercel/next.js/issues
- Books demo port: [next-books](https://github.com/MaxwellCohen/next-books)

## Summary

| Feature | Group | Label | Points |
| --- | --- | --- | --- |
| [Production CSS inlining](https://framework-compare.vercel.app/features/css-inlining.md) | First-paint levers | Experimental | 1 |
| [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 | 1st-party | 2 |
| [Streaming SSR](https://framework-compare.vercel.app/features/streaming-ssr.md) | First-paint levers | 1st-party | 2 |
| [Early Hints / preload headers](https://framework-compare.vercel.app/features/early-hints.md) | First-paint levers | 1st-party | 2 |
| [Islands / partial hydration / lazy slices](https://framework-compare.vercel.app/features/islands.md) | Other features | 1st-party | 2 |
| [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 | 1st-party | 2 |
| [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 | Third-party | 1 |
| [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: **Experimental** (1 of 2 points).

Set [`experimental.inlineCss: true`](https://nextjs.org/docs/app/api-reference/config/next-config-js/inlineCss) in `next.config.ts` (documented as experimental). One flag.

```ts
const nextConfig: NextConfig = {
  experimental: {
    inlineCss: true,
  },
};
```

*From this repo's `next-books/next.config.ts` (other options omitted).*

### Font optimization

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

[`next/font/google`](https://nextjs.org/docs/app/api-reference/components/font) self-hosts, subsets, generates the `@font-face`, and preloads at build time. No config beyond using it in the layout.

```tsx
import { Geist } from 'next/font/google';

const geistSans = Geist({
  display: 'block',
  subsets: ['latin'],
  variable: '--font-geist-sans',
});
```

*From this repo's `next-books/app/layout.tsx` (the `Geist_Mono` import and instance omitted).*

### Image pipeline

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

Use [`next/image`](https://nextjs.org/docs/app/api-reference/components/image) plus the built-in optimizer, `priority` on the first ten covers (deprecated in v16 in favour of `preload`), `sizes`, and `placeholder="blur"` fed by ThumbHash data URIs generated by this port's own code.

```tsx
<Image
  alt={title}
  blurDataURL={thumbhash ? createPngDataUri(thumbhash) : undefined}
  fill
  placeholder={thumbhash ? 'blur' : 'empty'}
  priority={priority}
  sizes={sizes}
  src={resolved}
/>
```

*From this repo's `next-books/features/book/components/book-cover.tsx` (some props omitted).*

Art direction with `<picture>` (Manual, not scored):

[`getImageProps()`](https://nextjs.org/docs/app/api-reference/components/image#art-direction) returns per-breakpoint props; you hand-write the `<picture>` and `<source>` elements (hence 🔧). `getImageProps()` is stable (v14.1.0) and the built-in optimizer already negotiates AVIF/WebP from the `Accept` header; this row scores only whether the framework emits a `<picture>` for you.

```jsx
const {
  props: { srcSet: desktop },
} = getImageProps({ ...common, width: 1440, height: 875, quality: 80, src: '/desktop.jpg' })
const {
  props: { srcSet: mobile, ...rest },
} = getImageProps({ ...common, width: 750, height: 1334, quality: 70, src: '/mobile.jpg' })

return (
  <picture>
    <source media="(min-width: 1000px)" srcSet={desktop} />
    <source media="(min-width: 500px)" srcSet={mobile} />
    <img {...rest} style={{ width: '100%', height: 'auto' }} />
  </picture>
)
```

*Adapted from [the image docs](https://nextjs.org/docs/app/api-reference/components/image#art-direction), where `common` is `{ alt: 'Art Direction Example', sizes: '100vw' }`.*

### Data/HTML caching

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

Turn on [`cacheComponents: true`](https://nextjs.org/docs/app/api-reference/config/next-config-js/cacheComponents) (enabled here), then mark queries with [`'use cache'`](https://nextjs.org/docs/app/api-reference/directives/use-cache) and `cacheLife('hours')`.

```ts
const nextConfig: NextConfig = {
  cacheComponents: true,
};
```

```ts
export async function getBooksPage(query: BookQuery): Promise<BookSummary[]> {
  'use cache';
  cacheLife('hours');
  // ...query the database
}
```

*From this repo's `next-books/next.config.ts` (other options omitted) and `features/book/book-queries.ts` (query body omitted).*

### Route prefetching

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

Set [`partialPrefetching`](https://nextjs.org/docs/app/api-reference/config/next-config-js/partialPrefetching) (needs `cacheComponents`; 16.3+), pass `prefetch={true}` on high-value links ([`<Link>`](https://nextjs.org/docs/app/api-reference/components/link)), and optionally add the `FastLink` mouse-down navigation.

```ts
const nextConfig: NextConfig = {
  cacheComponents: true,
  partialPrefetching: true,
};
```

```tsx
<FastLink href={href} prefetch={true}>
```

*Adapted from this repo's `next-books/next.config.ts` (other options omitted) and `features/book/components/book-pagination.tsx` (`href` expression simplified; other props omitted); `FastLink` is this repo's wrapper around `Link`.*

### Streaming SSR

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

Streaming is built into the App Router. Add a [`loading.tsx`](https://nextjs.org/docs/app/guides/streaming) file next to a page, or wrap a slow component in `<Suspense>`; the fallback is sent with the shell and the content follows in the same response.

```tsx
import { Suspense } from 'react'

export default function Page() {
  return (
    <Suspense fallback={<p>Loading feed...</p>}>
      <PostFeed />
    </Suspense>
  )
}
```

*Adapted from [the Next streaming guide](https://nextjs.org/docs/app/guides/streaming) (imports of the page's own components omitted).*

### Early Hints / preload headers

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

Nothing to enable in the App Router. During prerendering React emits preload headers for fonts, scripts, and stylesheets, and Next adds them to the response. [`reactMaxHeadersLength`](https://nextjs.org/docs/app/api-reference/config/next-config-js/reactMaxHeadersLength) caps their total length (default 6000) for proxies that truncate long headers. Next does not document sending a 103 itself.

```js
module.exports = {
  reactMaxHeadersLength: 1000,
}
```

*From [the reactMaxHeadersLength docs](https://nextjs.org/docs/app/api-reference/config/next-config-js/reactMaxHeadersLength).*

## Other features

### Islands / partial hydration / lazy slices

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

Server Components keep a component's JavaScript out of the browser ([server and client components](https://nextjs.org/docs/app/getting-started/server-and-client-components)). Every Client Component still hydrates: no hydrate-on-visible/idle/never control is documented (`next/dynamic` with `ssr: false` is client-only rendering, not deferred hydration), although React hydrates each `<Suspense>` boundary as its own unit and prioritizes the one being interacted with ([streaming guide](https://nextjs.org/docs/app/guides/streaming)). Enabling [`cacheComponents: true`](https://nextjs.org/docs/app/api-reference/config/next-config-js/cacheComponents) (the same flag as in [section 4](https://framework-compare.vercel.app/features/caching), enabled here) renders a cached shell and fills request-time holes. That is functionally close to a server island, but the API is an uncached data boundary inside Suspense, not a named island with its own cache entry.

Example of building it yourself:

Pages and layouts are Server Components by default and send no component JavaScript. Mark only the interactive part with `'use client'`. That component still hydrates, but the rest of the page stays server-only.

```tsx
// app/[id]/page.tsx (Server Component)
import LikeButton from '@/app/ui/like-button'
import { getPost } from '@/lib/data'

export default async function Page({ params }: { params: Promise<{ id: string }> }) {
  const { id } = await params
  const post = await getPost(id)
  return (
    <main>
      <h1>{post.title}</h1>
      <LikeButton likes={post.likes} />
    </main>
  )
}
```

```tsx
// app/ui/like-button.tsx
'use client'

import { useState } from 'react'

export default function LikeButton({ likes }: { likes: number }) {
  // …
}
```

Source: [Next.js: Server and Client Components](https://nextjs.org/docs/app/getting-started/server-and-client-components)

### Per-route render modes

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

Next documents stable per-route exports: without Cache Components, `dynamic` and `revalidate` ([previous-model guide](https://nextjs.org/docs/app/guides/caching-without-cache-components#route-segment-config)); with Cache Components, [`ensureStatic`](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic) (v16.4.0+; this port sets `ensureStatic = 'shell'` in the root layout) plus `'use cache'` boundaries (see [section 4](https://framework-compare.vercel.app/features/caching)). This port enables Cache Components, where `dynamic`, `revalidate`, `fetchCache`, and `dynamicParams` are removed ([route segment config](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config)).

Example of building it yourself:

With `cacheComponents: true`, a layout or page exports `ensureStatic` to say how much of the route must be static. The port sets `'shell'` on the root layout, so the App Shell is prerendered and request-specific content streams in behind `<Suspense>`. `'navigation'` would require the whole route to be static.

```tsx
// app/layout.tsx
import { Suspense } from 'react'
// …
// Every route's App Shell (sidebar, header, Suspense fallbacks) must stay static;
// request-specific content streams in behind Suspense at prefetch/navigation time.
export const ensureStatic = 'shell'

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <Suspense fallback={<HomeLinkFallback />}>
          <HomeLink />
        </Suspense>
        {children}
      </body>
    </html>
  )
}
```

Source: [Next.js: ensureStatic](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config/ensureStatic)

Gotchas:

- With Cache Components on, the `dynamic`, `revalidate`, `fetchCache`, and `dynamicParams` exports are removed and `runtime` is unsupported; other segment config such as `maxDuration` and `ensureStatic` remains. Do not expect `export const dynamic` to work.

### Fine-grained client reactivity

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

The first-party [React Compiler](https://react.dev/learn/react-compiler), switched on with [`reactCompiler: true`](https://nextjs.org/docs/app/api-reference/config/next-config-js/reactCompiler) (stable since v16.0.0; enabled in this port). Next runs it through the Babel plugin, applied only to files with JSX or hooks; Next 16.4 also has an experimental native Rust build of the compiler, `experimental.turbopackRustReactCompiler: true`, used alongside `reactCompiler: true`.

```ts
const nextConfig: NextConfig = {
  reactCompiler: true,
};
```

*From this repo's `next-books/next.config.ts` (other options omitted).*

Gotchas:

- The native Rust build of the React Compiler (`experimental.turbopackRustReactCompiler`) is experimental in Next 16.4; the stable path runs the Babel plugin.

### Built-in bundle analysis

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

The Turbopack bundle analyzer ([guide](https://nextjs.org/docs/app/guides/package-bundling)) shipped in v16.1 as `next experimental-analyze` and is `next analyze` as of v16.4.0 (the old name remains an alias). It opens the Turbopack module graph with per-route client/server filtering; `--output` saves a static report and `next analyze export` (v16.4.0+) streams the saved data. This port runs 16.4.6 and uses `next analyze`. The same guide covers the `@next/bundle-analyzer` plugin for webpack builds.

```bash
npx next analyze
npx next analyze --output
```

*From [the package bundling guide](https://nextjs.org/docs/app/guides/package-bundling).*

### Third-party script strategies

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

Use [`next/script`](https://nextjs.org/docs/app/api-reference/components/script) with `beforeInteractive`, `afterInteractive`, and `lazyOnload` strategies for the App Router. `worker` is experimental, `pages/`-only, and needs `experimental.nextScriptWorkers`. The experimental `@next/third-parties` ([guide](https://nextjs.org/docs/app/guides/third-party-libraries)) wraps common embeds.

```tsx
import Script from 'next/script'

export default function Page() {
  return (
    <>
      <Script src="https://example.com/script.js" strategy="lazyOnload" />
    </>
  )
}
```

*From [the Script docs](https://nextjs.org/docs/app/api-reference/components/script).*

Gotchas:

- Next's `worker` strategy is experimental and `pages/`-only.

### Portable multi-host deployment

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

A stable [Adapter API](https://nextjs.org/docs/app/api-reference/config/next-config-js/adapterPath) (`adapterPath`, v16.2+) with verified Vercel and Bun adapters; Cloudflare and Netlify "are working on verified adapters" ([deploying](https://nextjs.org/docs/app/getting-started/deploying)). They use their own integrations today: [OpenNext](https://opennext.js.org/) for Cloudflare and `@netlify/plugin-nextjs` for Netlify in this port. [`output: 'standalone'`](https://nextjs.org/docs/app/api-reference/config/next-config-js/output) covers self-hosting, though this port does not set it.

```js
const nextConfig = {
  adapterPath: require.resolve('./my-adapter.js'),
}
```

*Adapted from [the adapterPath docs](https://nextjs.org/docs/app/api-reference/config/next-config-js/adapterPath).*

Gotchas:

- Next on Cloudflare and Netlify uses adapters that are experimental or maintained by the host.

### Service worker / offline support

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

Next has no service worker build step. Its [PWA guide](https://nextjs.org/docs/app/guides/progressive-web-apps) hand-writes `public/sw.js` for push notifications and names the community [Serwist](https://serwist.pages.dev/docs/next) package for offline caching. `@serwist/next` wraps the Next config, compiles your worker, and injects the precache list. Next's own experimental `useOffline` hook retries failed navigations once the network returns; it is not a service worker.

```js
import withSerwistInit from "@serwist/next";

const withSerwist = withSerwistInit({
  swSrc: "app/sw.ts",
  swDest: "public/sw.js",
});

export default withSerwist({
  // Your Next.js config
});
```

*Adapted from [the Serwist getting-started guide](https://serwist.pages.dev/docs/next/getting-started) (revision and offline-fallback entries omitted).*

## Other performance features

[`next/dynamic`](https://nextjs.org/docs/app/guides/lazy-loading) lazy loading; [`optimizePackageImports`](https://nextjs.org/docs/app/guides/package-bundling).

## Deployments of the Books demo

| Branch | Note | Vercel | Netlify | Cloudflare |
| --- | --- | --- | --- | --- |
| `main` | fork from work by aurorascharff | https://next-books-olive.vercel.app | https://max-next-books.netlify.app | https://next-books.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 | 97 | 0.91 s | 0.31 s | 2.63 s | 17 ms | 0.000 |
| book list (/) | optimized | `optimized` | cloudflare, netlify, vercel | 94 | 0.98 s | 1.43 s | 2.93 s | 29 ms | 0.000 |
| one book (/10145787) | baseline | `main` | cloudflare, netlify, vercel | 99 | 0.81 s | 0.81 s | 2.25 s | 31 ms | 0.000 |
| one book (/10145787) | optimized | `optimized` | cloudflare, netlify, vercel | 97 | 0.98 s | 1.27 s | 2.33 s | 45 ms | 0.000 |

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

---

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