# Qwik City

Qwik City scores 23 of 28 points on 14 speed features: 11/14 on first-paint levers and 12/14 on other features. Rank 4 of 23, tied with SvelteKit. Labels: 10 1st-party, 1 Experimental, 2 Third-party, 1 Manual.

- Version checked: @builder.io/qwik / @builder.io/qwik-city 1.20.4 (npm latest); the cited docs use these v1 imports (Qwik v2 (@qwik.dev/core / @qwik.dev/router 2.0.0-rc.5) is a release candidate whose behavior is not verified here.)
- Performance guide: [Bundle Optimization | Guides 📚 Qwik Documentation](https://qwik.dev/docs/guides/bundle/)
- Issue tracker: https://github.com/QwikDev/qwik/issues
- Books demo port: [qwik-books](https://github.com/MaxwellCohen/qwik-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 | Third-party | 1 |
| [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 | Manual | 0 |
| [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 | Third-party | 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 | Experimental | 1 |

## First-paint levers

### Production CSS inlining

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

A global stylesheet under 10KB is inlined automatically in production; larger files load separately. `useStyles$` / `useStylesScoped$` are lazy-loadable. ([styles](https://qwik.dev/docs/core/styles/))

Example of building it yourself:

Import the global stylesheet in `root.tsx`. In production Qwik inlines it when it is under `inlineStylesUpToBytes` (20 KB by default). Component styles registered with `useStylesScoped$` load only with the component.

```tsx
// src/root.tsx
import { component$ } from '@builder.io/qwik'
import { QwikCityProvider, RouterOutlet } from '@builder.io/qwik-city'
import { RouterHead } from './components/router-head/router-head'

import './styles/global.css' // inlined in production if < 20 KB (inlineStylesUpToBytes)

export default component$(() => (
  <QwikCityProvider>
    <head><meta charset="utf-8" /><RouterHead /></head>
    <body><RouterOutlet /></body>
  </QwikCityProvider>
))
```

```tsx
// src/components/card/card.tsx
import { component$, useStylesScoped$ } from '@builder.io/qwik'
import styles from './card.css?inline'

export const Card = component$(() => {
  useStylesScoped$(styles)
  return <div class="card">…</div>
})
```

Source: [Qwik: Styling](https://qwik.dev/docs/components/styles/)

### Font optimization

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

The cookbook recommends Fontsource, manual `@font-face`, `unicode-range`, and Fontaine for fallback metrics; no preload guidance and no first-party font module documented. ([fonts](https://qwik.dev/docs/cookbook/fonts/))

Example of building it yourself:

The Qwik cookbook points to Fontsource for self-hosted files and Fontaine for fallback metrics. Install `@fontsource-variable/open-sans` and `fontaine`, import the font in the root layout, and add the Fontaine Vite plugin.

```tsx
// src/routes/layout.tsx
import '@fontsource-variable/open-sans/wght.css'
// global.css: body { font-family: "Open Sans Variable", sans-serif; }
```

```ts
// vite.config.ts
import { FontaineTransform } from 'fontaine'
// …
plugins: [
  qwikCity(), qwikVite(),
  FontaineTransform.vite({
    fallbacks: ['Arial'],
    resolvePath: (id) => new URL(`./public${id}`, import.meta.url),
  }),
],
```

Source: [Qwik: Fonts cookbook](https://qwik.dev/docs/cookbook/fonts/), [Fontsource: Qwik guide](https://fontsource.org/docs/guides/qwik)

Gotchas:

- `qwikVite` preloads every font file in the build by default (every Fontsource subset, on every page). This port turns that off with `disableFontPreload` and preloads one file.

### Image pipeline

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

built-in `?jsx` import suffix (the `qwikCity()` Vite plugin bundles `vite-imagetools`; the docs call it "a built-in feature ... no additional packages or components need to be installed"): `<img>` with `srcset` (200-1200w webp), `loading=lazy`, `decoding=async`, width/height. Local `src` images only per docs; `@unpic/qwik` is third-party (per the docs) and `qwik-image` is a separate CDN-loader component whose repo now sits in the QwikDev org. ([image-optimization](https://qwik.dev/docs/integrations/image-optimization/))

Example of building it yourself:

Add `?jsx` to a local image import to get a component. It renders an `<img>` with a webp `srcset` (200w to 1200w), `loading="lazy"`, `decoding="async"`, and width/height.

```tsx
// src/components/hero/hero.tsx
import { component$ } from '@builder.io/qwik'
import HeroImage from '~/media/hero.jpg?quality=80&jsx'

export const Hero = component$(() => (
  <HeroImage alt="Shelves of books" loading="eager" decoding="sync" />
))
```

Source: [Qwik: Image optimization](https://qwik.dev/docs/integrations/image-optimization/)

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

`?jsx` emits `<img>`/`srcset` as webp (format overridable); the docs mention no `<picture>` or `sizes`, so no first-party `<picture>` documented. ([image-optimization](https://qwik.dev/docs/integrations/image-optimization/))

The `?jsx` image import only emits an `<img>`, so write `<picture>` in JSX yourself, with files served from `public/`. Qwik uses HTML attribute names such as `srcset`.

```tsx
// src/components/hero-image/hero-image.tsx
import { component$ } from '@builder.io/qwik'

export const HeroImage = component$(() => (
  <picture>
    {/* art direction: a square crop on narrow screens */}
    <source media="(max-width: 640px)" type="image/avif"
            srcset="/media/hero-square-640.avif" width={640} height={640} />
    {/* format fallback: AVIF, then WebP, then the <img> JPEG */}
    <source type="image/avif" sizes="100vw"
            srcset="/media/hero-1280.avif 1280w, /media/hero-1920.avif 1920w" />
    <source type="image/webp" sizes="100vw"
            srcset="/media/hero-1280.webp 1280w, /media/hero-1920.webp 1920w" />
    <img src="/media/hero-1280.jpg" alt="Shelves of books" width={1280} height={720}
         fetchPriority="high" decoding="async" />
  </picture>
))
```

Source: [MDN: the picture element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/picture)

### Data/HTML caching

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

`cacheControl({ staleWhileRevalidate, maxAge, sMaxAge, public })` in `onGet` per layout/route. SSG via the static adapter; no data cache and no ISR documented. ([caching](https://qwik.dev/docs/caching/), [static-site-generation](https://qwik.dev/docs/guides/static-site-generation/))

Example of building it yourself:

Call `cacheControl` in a layout's or route's `onGet` to set the `Cache-Control` header for every page under it. A nested layout can override it.

```tsx
// src/routes/layout.tsx
import type { RequestHandler } from '@builder.io/qwik-city'

export const onGet: RequestHandler = async ({ cacheControl }) => {
  cacheControl({
    public: true,
    maxAge: 5,
    sMaxAge: 10,
    staleWhileRevalidate: 60 * 60 * 24 * 365,
  })
}
```

Source: [Qwik: Caching responses](https://qwik.dev/docs/caching/)

Gotchas:

- `cacheControl()` skips `maxAge: 0` and has no `must-revalidate` option; use `noCache` to revalidate on every request.

### Route prefetching

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

`<Link>` prefetches on hover by default (`prefetch={false}` disables). The preloader adds `<link rel="modulepreload">` for handlers and dependencies using a bundle graph; works only in preview/production builds. ([routing](https://qwik.dev/docs/routing/), [modules-prefetching](https://qwik.dev/docs/advanced/modules-prefetching/), [speculative-module-fetching](https://qwik.dev/docs/advanced/speculative-module-fetching/))

Example of building it yourself:

`<Link>` starts prefetching the next page when the user hovers it. Set `prefetch={false}` to turn that off for one link.

```tsx
// src/components/nav/nav.tsx
import { component$ } from '@builder.io/qwik'
import { Link } from '@builder.io/qwik-city'

export const Nav = component$(() => (
  <nav>
    <Link href="/books">Books</Link>
    <Link href="/account" prefetch={false}>Account</Link>
  </nav>
))
```

Source: [Qwik: Routing](https://qwik.dev/docs/routing/)

### Streaming SSR

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

Return an async function from `routeLoader$` and render it with `<Resource>`; Qwik streams the HTML up to that point and sends the rest when the function resolves. Streaming is in order, tuned by the `streaming.inOrder` render options. ([streaming-deferred-loaders](https://qwik.dev/docs/cookbook/streaming-deferred-loaders/), [qwik-server](https://qwik.dev/api/qwik-server/))

Example of building it yourself:

Return an async function from `routeLoader$` and render it with `<Resource>`. The HTML above the resource streams first, and the rest follows when the data resolves.

```tsx
// src/routes/books/[id]/index.tsx
import { Resource, component$ } from '@builder.io/qwik'
import { routeLoader$ } from '@builder.io/qwik-city'

export const useReviews = routeLoader$(({ params }) => {
  // returning a function defers it: rendering doesn't wait here
  return async () => {
    const res = await fetch(`https://api.example.com/books/${params.id}/reviews`)
    return (await res.json()) as { id: string; text: string }[]
  }
})

export default component$(() => {
  const reviews = useReviews()
  return (
    <>
      <h1>Reviews</h1>
      <Resource
        value={reviews}
        onPending={() => <p>Loading…</p>}
        onResolved={(list) => <ul>{list.map((r) => <li key={r.id}>{r.text}</li>)}</ul>}
      />
    </>
  )
})
```

Source: [Qwik: Streaming deferred loaders](https://qwik.dev/docs/cookbook/streaming-deferred-loaders/)

### Early Hints / preload headers

Label: **Manual** (0 of 2 points).

No first-party preload `Link` headers or 103 Early Hints documented; the preloader works through `<link rel="modulepreload">` tags in the HTML. Set a `Link` header by hand with `headers.set()` in a request handler. ([speculative-module-fetching](https://qwik.dev/docs/advanced/speculative-module-fetching/), [caching](https://qwik.dev/docs/caching/))

Example of building it yourself:

Set a `Link` header in the root layout's `onGet` handler. This one preconnects to the font host. To preload a built file with a hashed name, read its URL from the Vite manifest.

```tsx
// src/routes/layout.tsx
import type { RequestHandler } from '@builder.io/qwik-city'

export const onGet: RequestHandler = async ({ headers }) => {
  headers.set('Link', '<https://fonts.gstatic.com>; rel=preconnect; crossorigin')
}
```

Source: [Qwik City: caching and response headers](https://qwik.dev/docs/caching/)

## Other features

### Islands / partial hydration / lazy slices

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

Resumability: no hydration step; state and listeners are serialized in HTML and handler chunks load lazily. The FAQ says Qwik does not use partial hydration (islands). `qwikify$` (`@builder.io/qwik-react`) gives React islands with `client:visible`/`client:idle`. ([resumable](https://qwik.dev/docs/concepts/resumable/), [faq](https://qwik.dev/docs/faq/), [react](https://qwik.dev/docs/integrations/react/))

Example of building it yourself:

Qwik components do not hydrate. The click handler below is serialized into the HTML and its code chunk loads on the first click. React components can still run as islands through `qwikify$` with a `client:*` prop.

```tsx
// src/components/counter/counter.tsx
import { component$, useSignal } from '@builder.io/qwik'

export const Counter = component$(() => {
  const count = useSignal(0)
  // no JS runs until the first click; then only this handler loads
  return <button onClick$={() => count.value++}>Increment {count.value}</button>
})
```

```tsx
// src/integrations/react/slider.tsx
/** @jsxImportSource react */
import { qwikify$ } from '@builder.io/qwik-react'
import { Slider } from '@mui/material'

export const MUISlider = qwikify$(Slider)
// usage in a Qwik component: <MUISlider client:visible />
```

Source: [Qwik: Resumable](https://qwik.dev/docs/concepts/resumable/), [Qwik: React integration](https://qwik.dev/docs/integrations/react/)

### Per-route render modes

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

SSG and SSR can be mixed per route; dynamic routes export `onStaticGenerate`. No per-route options beyond that documented; the Cloudflare Pages adapter has `ssg` `include`/`exclude`. ([static-site-generation](https://qwik.dev/docs/guides/static-site-generation/), [cloudflare-pages](https://qwik.dev/docs/deployments/cloudflare-pages/))

Example of building it yourself:

A dynamic route that exports `onStaticGenerate` is prerendered for the params it returns. On Cloudflare Pages, the adapter's `ssg.include` and `ssg.exclude` choose which paths are static; the rest render on request.

```tsx
// src/routes/product/[id]/index.tsx
import { component$ } from '@builder.io/qwik'
import { useLocation, type StaticGenerateHandler } from '@builder.io/qwik-city'

export default component$(() => <p>Product {useLocation().params.id}</p>)

export const onStaticGenerate: StaticGenerateHandler = async () => {
  return { params: [{ id: '1' }, { id: '2' }] }
}
```

```ts
// adapters/cloudflare-pages/vite.config.ts
plugins: [
  cloudflarePagesAdapter({
    ssg: { include: ['/*'], exclude: ['/shop/*'], origin: 'https://example.com' },
  }),
],
```

Source: [Qwik: Static site generation](https://qwik.dev/docs/guides/static-site-generation/), [Qwik: Cloudflare Pages adapter](https://qwik.dev/docs/deployments/cloudflare-pages/)

### Fine-grained client reactivity

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

Signals/stores re-run dependent components; the FAQ says Qwik uses the vDOM "only sometimes" and otherwise updates the DOM directly (non-structural changes). The scope is not detailed. ([faq](https://qwik.dev/docs/faq/), [state](https://qwik.dev/docs/core/state/))

Example of building it yourself:

`useSignal` and `useStore` are tracked. Changing a value updates the parts of the DOM that read it.

```tsx
// src/components/counter/counter.tsx
import { component$, useSignal, useStore } from '@builder.io/qwik'

export const Counter = component$(() => {
  const count = useSignal(0)
  const state = useStore({ name: 'Qwik' })
  return (
    <>
      <button onClick$={() => count.value++}>Increment {count.value}</button>
      <input value={state.name} onInput$={(_, el) => (state.name = el.value)} />
    </>
  )
})
```

Source: [Qwik: State](https://qwik.dev/docs/components/state/)

### Built-in bundle analysis

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

No visualizer/analyzer documented. First-party knobs: `qwikVite` `entryStrategy` and `qsymbol`-event analytics. The Insights lab is prototyping-stage. ([bundle](https://qwik.dev/docs/guides/bundle/), [insights](https://qwik.dev/docs/labs/insights/))

Example of building it yourself:

Qwik has no analyzer of its own. Add `rollup-plugin-visualizer` to the base Vite config; `vite build` then writes a treemap of the client bundles.

```ts
// vite.config.ts
import { defineConfig } from 'vite'
import { qwikVite } from '@builder.io/qwik/optimizer'
import { qwikCity } from '@builder.io/qwik-city/vite'
import { visualizer } from 'rollup-plugin-visualizer'

export default defineConfig(() => ({
  plugins: [
    qwikCity(),
    qwikVite(),
    visualizer({ filename: 'stats.html', template: 'treemap', gzipSize: true }),
  ],
}))
```

Source: [rollup-plugin-visualizer: README](https://github.com/btd/rollup-plugin-visualizer), [Qwik: Bundle optimization](https://qwik.dev/docs/guides/bundle/)

### Third-party script strategies

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

`qwik add partytown` (CLI integration shipped in `@builder.io/qwik`; it installs `@qwik.dev/partytown`, published from the QwikDev/partytown repo): render `QwikPartytown` with `forward=[...]`, mark scripts `type="text/partytown"`. The docs page itself names no npm package. ([partytown](https://qwik.dev/docs/integrations/partytown/))

Example of building it yourself:

`qwik add partytown` creates a `QwikPartytown` component. Render it in the head with the globals to forward, and mark scripts `type="text/partytown"` so they run in a web worker.

```tsx
// src/root.tsx
import { QwikPartytown } from './components/partytown/partytown'
// …
<head>
  <QwikPartytown forward={['gtag', 'dataLayer.push']} />
  <script async type="text/partytown"
          src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX" />
  <RouterHead />
</head>
```

Source: [Qwik: Partytown](https://qwik.dev/docs/integrations/partytown/)

### Portable multi-host deployment

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

`qwik add` adapters: Node (`express`, `fastify`), `vercel-edge`, `netlify-edge`, `cloudflare-pages`, `cloudflare-workers`. Vercel and Netlify are Edge-runtime adapters only; the docs do not label adapters "first-party" (source is the QwikDev/qwik repo). ([deployments](https://qwik.dev/docs/deployments/), [node](https://qwik.dev/docs/deployments/node/), [vercel-edge](https://qwik.dev/docs/deployments/vercel-edge/), [netlify-edge](https://qwik.dev/docs/deployments/netlify-edge/), [cloudflare-pages](https://qwik.dev/docs/deployments/cloudflare-pages/), [cloudflare-workers](https://qwik.dev/docs/deployments/cloudflare-workers/))

Example of building it yourself:

`qwik add express` (or `vercel-edge`, `netlify-edge`, `cloudflare-pages`) writes an adapter config that extends the base Vite config. The Books port keeps one per host under `adapters/`.

```ts
// adapters/express/vite.config.ts
import { nodeServerAdapter } from '@builder.io/qwik-city/adapters/node-server/vite'
import { extendConfig } from '@builder.io/qwik-city/vite'
import baseConfig from '../../vite.config'

export default extendConfig(baseConfig, () => ({
  build: {
    ssr: true,
    rollupOptions: { input: ['src/entry.express.tsx', '@qwik-city-plan'] },
  },
  plugins: [nodeServerAdapter({ name: 'express' })],
}))
```

Source: [Qwik: Node middleware deployment](https://qwik.dev/docs/deployments/node/)

### Service worker / offline support

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

`@qwikdev/pwa` (0.0.4, published 2024-02-26 from the QwikDev org) adds a `qwikPwa()` Vite plugin and a `setupPwa()` call in `src/routes/service-worker.ts` that precaches built assets; its README says it is in its early stages, and qwik.dev does not document it. Qwik's own service worker only prefetched bundles and the preloader has replaced it. ([QwikDev/pwa](https://github.com/QwikDev/pwa), [bundle](https://qwik.dev/docs/guides/bundle/))

Example of building it yourself:

`@qwikdev/pwa` adds a `qwikPwa()` Vite plugin and a `setupPwa()` call in the service worker route. It precaches the built `q-*.js` files, images and `public/` assets.

```ts
// vite.config.ts (npm install -D @qwikdev/pwa)
import { qwikPwa } from '@qwikdev/pwa'
// …
plugins: [qwikCity(), qwikVite(), qwikPwa()],
```

```ts
// src/routes/service-worker.ts
import { setupServiceWorker } from '@builder.io/qwik-city/service-worker'
import { setupPwa } from '@qwikdev/pwa/sw'

setupServiceWorker()
setupPwa()
```

Source: [QwikDev/pwa README](https://github.com/QwikDev/pwa)

## Other performance features

- `qwikify$` hydration eagerness options. ([react](https://qwik.dev/docs/integrations/react/))
- Optimizer `$` boundaries make many lazy-loadable symbols. ([optimizer](https://qwik.dev/docs/advanced/optimizer/), [think-qwik](https://qwik.dev/docs/concepts/think-qwik/))

## Deployments of the Books demo

| Branch | Note | Vercel | Netlify | Cloudflare |
| --- | --- | --- | --- | --- |
| `main` | vibe port | https://qwik-books.vercel.app | https://qwik-books.netlify.app | https://qwik-books.to-email-max.workers.dev |
| `optimized` | cache + fonts | https://qwik-books-optimized-eight.vercel.app | https://qwik-books-max-optimized.netlify.app | https://qwik-books-optimized.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 | 85 | 1.61 s | 1.04 s | 4.15 s | 0 ms | 0.000 |
| book list (/) | optimized | `optimized` | cloudflare, netlify, vercel | 90 | 0.94 s | 1.64 s | 3.55 s | 0 ms | 0.000 |
| one book (/10145787) | baseline | `main` | cloudflare, netlify, vercel | 97 | 1.51 s | 0.63 s | 2.56 s | 0 ms | 0.000 |
| one book (/10145787) | optimized | `optimized` | cloudflare, netlify, vercel | 100 | 0.92 s | 0.58 s | 1.86 s | 0 ms | 0.000 |

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

---

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