# Performance — a light, fast site by default What the plugin does for speed without any project work, what a project must still do, the budgets every site is held to, how to measure, and how to read the doctor's findings. The agent's short version is AGENT.md §6.11b and the `iapl-performance` skill. The measurements and the audit behind this page: [dev/perf/README.md](./dev/perf/README.md). Related: [media.md](./media.md), [frontend.md](./frontend.md), [consent.md](./consent.md), [doctor.md](./doctor.md), [design-tokens.md](./design-tokens.md). Targets on the built site, a phone on a slow connection (the numbers Google uses, [web.dev/articles/vitals](https://web.dev/articles/vitals)): **LCP < 2.5 s, CLS < 0.1, INP < 200 ms.** The reference site measures LCP 0.8 s, CLS 0–0.04 and a 32–48 ms tap response on that profile (the 404 page is the exception, below). ## 1. What the plugin does for you | Area | Default | Change it | |---|---|---| | Static pages | `createPageRoute` + `generateStaticParams` + `revalidate`: every page is prerendered (ISR); nothing in the layout reads `headers()` or `cookies()`, so the HTML is cached and the server answers in ~4 ms | your own `render`; never call `headers()` in the layout ([nextjs.org/docs/app/guides/caching](https://nextjs.org/docs/app/guides/caching)) | | Data per render | the `lib/content` helpers cache every read per request (`getSettings`, `resolveRoute`, `generatePageMetadata`, `getSiteShell`), keyed by value; Site settings at depth 1; one Site integrations read shared by analytics and Turnstile; reads that need one field `select` it | `createContentHelpers({ settingsDepth })`; your own getters with `cache()` | | LCP image | ``: `fetchpriority="high"`, `loading="eager"` and a preload; everything else lazy with `sizes` | `priority` / `eager` / `sizes` per image (`MEDIA_SIZES`) | | Image formats | `buildImagesConfig()`: AVIF and WebP, the width the screen needs, a 31-day cache, R2 allowed | `buildImagesConfig({ … })` ([media.md](./media.md)) | | Upload limits | `buildOptimizeUploadHook()`: images over 1.5 MB or 2560 px wide are stopped; the editor may let the plugin shrink them (WebP, metadata dropped) | `maxImageBytes`, `maxImageWidth`, `quality` | | Upload metadata | every JPEG and PNG that passes the limits loses its metadata (camera, date, GPS, comments) without re-encoding — pixels and colour profile byte for byte; an EXIF "rotate" is applied once (JPEG q92) | `buildOptimizeUploadHook({ stripMetadata: false })`; the building block `stripImageMetadata(buffer, mime)` | | No layout shift from images | width and height always from the document; a blur placeholder and the dominant colour (`buildMediaPlaceholderHook`) | `placeholderColor` | | Embeds | ``: a picture and a button; the iframe only after a click, from youtube-nocookie.com | `poster` | | Client JavaScript | small client leaves; a page ships only the client components it renders (the `/client` barrels are no longer one client boundary); the lightbox viewer loads on the first open; the form engine and the Turnstile widget load only on pages that show a form (`BuilderForm` / `Turnstile` from `/client` are lazy wrappers, the server renders the whole form) — 6–9 KB gzip less JavaScript on every other page of the reference site (webpack −8.8, Turbopack −6.1) | `@intecion/ipal-kit/client/eager` → `` | | Turnstile | its 73 px are kept free before Cloudflare draws the widget: the form does not jump | `turnstileReserveHeight={0}` (an invisible widget) | | Third parties before consent | none besides Google's tag in Consent Mode `advanced` (all signals denied); Meta, LinkedIn, TikTok and Clarity wait for consent; Turnstile only on a form's last step | `analytics={{ consentMode: 'basic' }}` — no request to Google before consent; `analytics={{ defer: true }}` — the tag after the first interaction | | Fonts | the reference layout (and every new site from `iapl create`) uses `next/font` (self-hosted, `display: 'swap'`, fallback metrics against layout shift) and does not preload the heading font: the stylesheet and the hero get the first round trips (phone: first paint and LCP 36–52 ms sooner) | the project's own fonts; `preload: true` on the heading font | | Motion | the token durations (`duration-fast`, `-base`, `-slow`) are 0 ms with `prefers-reduced-motion: reduce`; the cookie banner, its switches and the cookie button stop their transitions too; a background video (``) is paused for those visitors; the card hover fades a shadow layer (`opacity`, compositor-only) instead of animating `box-shadow` | `motion-reduce:` classes; ``; `CARD_INTERACTIVE_SHADOW_CLASS` (the 1.17 hover) | | 404 | the lazy 404 (`createNotFoundPage({ load })`) keeps its content's height with `placeholder` — the reference site sets it (phone: CLS 0.319 → 0, LCP 2.5 → 1.9 s) | the placeholder's height follows your 404 content | | Admin only | Payload's colour-scheme client hints only on `/admin`, so a public page is requested once | `withSecurityConfig(…, { adminClientHints: false })` | ## 2. What a project must do Every row is something the plugin cannot decide for you. `iapl-doctor --only performance` finds most of them. **Page loading** ([web.dev/articles/optimize-lcp](https://web.dev/articles/optimize-lcp)) - Exactly one `` per page: the first image a visitor sees (the library's hero does this itself via `leadsWithImage`). A header logo is `` — at once, but without competing with the hero. - Nothing render-blocking but the one stylesheet: no `