Skip to content

Astro

Astro scores 24 of 28 points. That is 12 of 14 on the 7 features that affect first paint (the moment the browser first draws content), and 12 of 14 on the 7 other features.

Rank 3 of 2324/28 points: 12/14 first-paint, 12/14 other · 86% complete
Version checked
Astro 7.4.13 (npm latest on 2026-11-20; labels were drafted against 7.4.10, and the astro-books port locks 7.4.12)
Performance guide
Why Astro? | DocsNo dedicated performance page (docs.astro.build/en/guides/performance/ is 404); closest official page.
Issues
github.com/withastro/astro/issues

Scorecard

All 14 features, in two groups. Each row shows Astro's label, how that label compares across all 23 frameworks, and how to enable the feature. Feature names link to Astro's entry on that feature's page.

Astro's labels across 14 features

  • 1st-party11
  • Experimental0
  • Third-party2
  • Manual1
  • of 14

How it compares

On 11 of 14 features, no framework has a higher-scoring label than Astro. On the other 3, at least one does.

Tested in our port

The astro-books port passes 11/11 feature tests. Run on 2026-11-26 at MaxwellCohen/astro-books@bdf27d7. How we test labels

First-paint levers

12/14
  • 1st-party, like 7 of the other 22 frameworks. None scores higher.

    Show the how-to

    build.inlineStylesheets: 'always' | 'auto' | 'never' (stable, astro@2.6.0+). Default auto inlines styles under 4kB and links larger ones; 'always' inlines all. (configuration-reference, styling)

    Code example

    build.inlineStylesheets controls whether project CSS ships as <style> tags or linked files. 'always' inlines every stylesheet; the default 'auto' inlines only files under Vite's 4kB assetsInlineLimit.

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      build: {
        inlineStylesheets: 'always', // 'auto' (default) | 'never'
      },
    });

    Source: Astro: configuration reference, build.inlineStylesheets

  • 02Font optimization1st-party2 pts

    1st-party, like 3 of the other 22 frameworks. None scores higher.

    Show the how-to

    Fonts API: top-level fonts config (astro@6.0.0+) plus <Font cssVariable preload /> from astro:assets, not under experimental flags. Providers include Google, Bunny, Fontsource, Fontshare, Adobe, local; fonts are downloaded, cached, served from _astro/fonts, with a subsets option (default latin) and optimized fallbacks. preload defaults to false. (fonts, astro-assets)

    Code example

    Register the font in the top-level fonts config, then render <Font /> in the layout head. Astro downloads and serves the files itself, and preload adds a preload link.

    // astro.config.mjs
    import { defineConfig, fontProviders } from 'astro/config';
    
    export default defineConfig({
      fonts: [{
        provider: fontProviders.fontsource(),
        name: 'Roboto',
        cssVariable: '--font-roboto',
      }],
    });
    ---
    // src/layouts/Layout.astro
    import { Font } from 'astro:assets';
    ---
    <html>
      <head>
        <Font cssVariable="--font-roboto" preload />
      </head>
      <body><slot /></body>
    </html>

    Source: Astro: Using custom fonts

  • 03Image pipeline1st-party2 pts

    1st-party, like 8 of the other 22 frameworks. None scores higher.

    Show the how-to

    <Image /> from astro:assets optimizes local and authorized remote images; Sharp is the default service; responsive layout/srcset since astro@5.10.0; public/ images are not optimized. Cloudflare, Vercel, and Netlify adapters have host image services. (images, cloudflare, vercel, netlify)

    Code example

    <Image /> from astro:assets resizes and converts imported local images at build time. layout="constrained" adds a responsive srcset, and image.domains lets remote images through the same pipeline.

    ---
    // src/components/Cover.astro
    import { Image } from 'astro:assets';
    import cover from '../assets/cover.jpg';
    ---
    <Image src={cover} alt="Book cover" layout="constrained" width={800} height={600} />
    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      image: {
        domains: ['covers.example.com'],
      },
    });

    Source: Astro: Images

    Art direction with <picture>

    1st-party

    Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

    <Picture /> (astro@3.3.0+) emits <picture> with formats (default webp) plus a fallback <img>. Breakpoint art direction is not in the component docs; the official recipe uses getImage() and a hand-written <picture>/<source media>. (astro-assets, build-custom-img-component)

    Example

    <Picture /> handles formats, not breakpoints. Astro's recipe calls getImage() once per crop and writes the <picture> by hand.

    ---
    // src/components/Hero.astro
    import { getImage } from "astro:assets";
    import wide from "../assets/hero-wide.jpg";
    import square from "../assets/hero-square.jpg";
    
    const desktop = await getImage({ src: wide, width: 1600, format: "avif" });
    const mobile = await getImage({ src: square, width: 600, format: "webp" });
    const fallback = await getImage({ src: square, width: 600 });
    ---
    <picture>
      <source media="(min-width: 768px)" srcset={desktop.src} type="image/avif" />
      <source srcset={mobile.src} type="image/webp" />
      <img src={fallback.src} {...fallback.attributes} alt="Shelves of books" />
    </picture>

    Source: Astro: build a custom image component

  • 04Data/HTML caching1st-party2 pts

    1st-party, like 16 of the other 22 frameworks. None scores higher.

    Show the how-to

    Route caching for on-demand pages (astro@7.0.0+): top-level cache: { provider } with memoryCache(), Astro.cache.set({ maxAge, swr, tags }), routeRules, cache.invalidate(). Host providers (cacheNetlify(), cacheVercel(), cacheCloudflare()) are experimental and manually enabled. Also Vercel isr: true and Netlify cacheOnDemandPages. (caching, astro-7, vercel, netlify)

    Code example

    Pick a cache provider in the config, then set cache options from an on-demand page. routeRules sets defaults for groups of routes, and cache.invalidate() purges by tag or path.

    // astro.config.mjs
    import { defineConfig, memoryCache } from 'astro/config';
    
    export default defineConfig({
      cache: { provider: memoryCache() },
      routeRules: {
        '/books/[...slug]': { maxAge: 3600, tags: ['books'] },
      },
    });
    ---
    // src/pages/index.astro
    export const prerender = false;
    Astro.cache.set({ maxAge: 120, swr: 60, tags: ['home'] });
    ---
    // src/pages/api/revalidate.ts
    import type { APIRoute } from 'astro';
    
    export const POST: APIRoute = async (context) => {
      await context.cache.invalidate({ tags: ['books'] });
      return new Response(null, { status: 204 });
    };

    Source: Astro: Route caching

  • 05Route prefetching1st-party2 pts

    1st-party, like 18 of the other 22 frameworks. None scores higher.

    Show the how-to

    prefetch: true adds the script; links opt in via data-astro-prefetch or prefetch.prefetchAll: true. Strategies hover (default), tap, viewport, load; falls back to tap on data saver. <ClientRouter /> pages prefetch by default. eagerness and Speculation Rules need experimental clientPrerender. (prefetch)

    Code example

    prefetch: true turns on the prefetch script. Links opt in with data-astro-prefetch and a strategy, or prefetchAll covers every link.

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      prefetch: {
        prefetchAll: true,
        defaultStrategy: 'viewport', // 'hover' (default) | 'tap' | 'viewport' | 'load'
      },
    });
    <!-- src/components/Nav.astro -->
    <a href="/books" data-astro-prefetch="tap">Books</a>
    <a href="/account" data-astro-prefetch="false">Account</a>

    Source: Astro: Prefetch

  • 06Streaming SSR1st-party2 pts

    1st-party, like 17 of the other 22 frameworks. None scores higher.

    Show the how-to

    On-demand pages use HTML streaming: the document is sent in chunks, in order, as each component renders, so <head> and the top of the page go out before a slow await further down finishes. Nothing to enable. Move slow fetches into child components so they do not block the parts above them; server:defer server islands cover content that should arrive out of order. (on-demand-rendering)

    Code example

    On-demand pages stream by default. Put a slow fetch in its own component: the HTML above it is sent while it waits.

    ---
    // src/pages/books/[id].astro
    export const prerender = false; // render on demand
    import Layout from "../../layouts/Layout.astro";
    import BookDetail from "../../components/BookDetail.astro";
    import Reviews from "../../components/Reviews.astro";
    ---
    <Layout title="Book">
      <BookDetail id={Astro.params.id} />
      <!-- head, header and BookDetail are already sent while Reviews awaits -->
      <Reviews id={Astro.params.id} />
    </Layout>
    ---
    // src/components/Reviews.astro
    const res = await fetch(`https://api.example.com/books/${Astro.props.id}/reviews`);
    const reviews = await res.json();
    ---
    <ul>{reviews.map((r) => <li>{r.text}</li>)}</ul>

    Source: Astro: On-demand rendering, HTML streaming, Astro: Streaming for page performance

  • Manual, like 15 of the other 22 frameworks. 7 frameworks score higher.

    Show the how-to

    No first-party preload Link headers or 103 Early Hints documented; the configuration reference has no option for either. Set a Link header by hand with Astro.response.headers or at the host. (configuration-reference, on-demand-rendering)

    Code example

    Set a Link header on HTML responses in the middleware. This one preconnects to the font host. To preload a built file with a hashed name, read its URL from the Vite manifest.

    // src/middleware.ts
    import { defineMiddleware } from 'astro:middleware'
    
    const LINK = '<https://fonts.gstatic.com>; rel=preconnect; crossorigin'
    
    export const onRequest = defineMiddleware(async (_context, next) => {
      const response = await next()
      if (!response.headers.get('content-type')?.includes('text/html')) return response
      const headers = new Headers(response.headers)
      headers.set('Link', LINK)
      return new Response(response.body, { status: response.status, statusText: response.statusText, headers })
    })

    Source: Astro middleware

Other features

12/14
  • 1st-party, like 14 of the other 22 frameworks. None scores higher.

    Show the how-to

    Zero client JS by default; client:load, client:idle, client:visible, client:media, client:only. server:defer server islands need an adapter; props travel in an encrypted query string. Server islands were experimental in astro@4.12 (experimental.serverIslands) and the flag was removed in astro@5.0, where the feature is available without it; the guide carries no experimental label. (islands, framework-components, server-islands, upgrade-to/v5, astro-4120)

    Code example

    Components render to HTML with no client JS unless a client:* directive hydrates them. server:defer turns an Astro component into a server island that renders after the page, with fallback content until it arrives.

    ---
    // src/pages/index.astro
    import Counter from '../components/Counter.jsx';
    import Avatar from '../components/Avatar.astro';
    import GenericAvatar from '../components/GenericAvatar.astro';
    ---
    <Counter client:visible />
    
    <Avatar server:defer>
      <GenericAvatar slot="fallback" />
    </Avatar>

    Source: Astro: Server islands

  • 1st-party, like 18 of the other 22 frameworks. None scores higher.

    Show the how-to

    Default static; export const prerender = false per page/endpoint for on-demand rendering; with output: 'server', prerender = true opts back in. On-demand pages need an adapter. (on-demand-rendering)

    Code example

    Pages prerender by default. export const prerender = false renders one page on demand; with output: 'server', prerender = true opts a page back into static output.

    ---
    // src/pages/[id].astro
    export const prerender = false; // render on each request (needs an adapter)
    
    const { id } = Astro.params;
    ---
    <h1>Book {id}</h1>

    Source: Astro: On-demand rendering

  • 1st-party, like 21 of the other 22 frameworks. None scores higher.

    Show the how-to

    No reactivity of its own in .astro components; the official Astro-team integrations @astrojs/solid-js, @astrojs/svelte, and @astrojs/vue (installed with astro add) bring Solid signals, Svelte runes, and Vue refs to islands. (framework-components, solid-js, svelte, vue)

    Code example

    .astro components have no client state. Add a UI framework integration (here Solid via astro add solid) and use its signals inside an island.

    // src/components/Counter.tsx
    import { createSignal } from 'solid-js';
    
    export default function Counter() {
      const [count, setCount] = createSignal(0);
      return <button onClick={() => setCount(count() + 1)}>Clicked {count()}</button>;
    }
    ---
    // src/pages/index.astro
    import Counter from '../components/Counter';
    ---
    <Counter client:load />

    Source: Astro: @astrojs/solid-js

  • Third-party, like 18 of the other 22 frameworks. 2 frameworks score higher.

    Show the how-to

    No first-party analyzer documented; the official recipe adds rollup-plugin-visualizer, with a caveat that the report may not match what the client downloads. (analyze-bundle-size)

    Code example

    Astro's recipe adds rollup-plugin-visualizer as a Vite plugin. astro build then writes stats.html. The report covers the whole site, not each page.

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import { visualizer } from 'rollup-plugin-visualizer';
    
    export default defineConfig({
      vite: {
        plugins: [visualizer({ emitFile: true, filename: 'stats.html' })],
      },
    });

    Source: Astro: Analyze bundle size

  • 1st-party, like 4 of the other 22 frameworks. None scores higher.

    Show the how-to

    Official @astrojs/partytown integration: astro add partytown, then type="text/partytown" on scripts. (partytown)

    Code example

    Install the integration with npx astro add partytown, then mark scripts type="text/partytown" so they run in a web worker. forward exposes globals such as dataLayer.push to the worker.

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import partytown from '@astrojs/partytown';
    
    export default defineConfig({
      integrations: [partytown({ config: { forward: ['dataLayer.push'] } })],
    });
    <!-- src/layouts/Layout.astro -->
    <script type="text/partytown" src="https://example.com/analytics.js"></script>

    Source: Astro: @astrojs/partytown

  • 1st-party, like 7 of the other 22 frameworks. None scores higher.

    Show the how-to

    Official adapters for Node (standalone/middleware), Vercel, Netlify, and Cloudflare; the on-demand rendering page names all four as official, and astro add <adapter> installs them. (on-demand-rendering, deploy, node, vercel, netlify, cloudflare)

    Code example

    The Books port picks an official adapter from the build environment and falls back to Node. Each adapter is installed with astro add <name>.

    // astro.config.mjs
    import node from '@astrojs/node';
    import { defineConfig } from 'astro/config';
    
    async function pickAdapter() {
      if (process.env.NETLIFY) return (await import('@astrojs/netlify')).default();
      if (process.env.CF_PAGES) return (await import('@astrojs/cloudflare')).default();
      if (process.env.VERCEL) return (await import('@astrojs/vercel')).default();
      return node({ mode: 'standalone' });
    }
    
    export default defineConfig({
      output: 'server',
      adapter: await pickAdapter(),
    });

    Source: Astro: @astrojs/node

  • Third-party, like 2 of the other 22 frameworks. 2 frameworks score higher.

    Show the how-to

    No first-party service worker documented. The community @vite-pwa/astro integration (2.0.4) generates the worker and precache manifest with Workbox and registers it; the Astro docs do not mention it. (vite-pwa astro)

    Code example

    Add the @vite-pwa/astro integration, which generates a Workbox worker and precache manifest at build time. Register it from the main layout.

    // astro.config.mjs (npm install -D @vite-pwa/astro)
    import { defineConfig } from "astro/config";
    import AstroPWA from "@vite-pwa/astro";
    
    export default defineConfig({
      integrations: [AstroPWA({ workbox: { navigateFallback: "/404" } })],
    });
    ---
    // src/layouts/Layout.astro
    import { pwaInfo } from "virtual:pwa-info";
    ---
    <head>
      <script src="/src/pwa.ts"></script>
      {pwaInfo && <Fragment set:html={pwaInfo.webManifest.linkTag} />}
    </head>
    // src/pwa.ts
    import { registerSW } from "virtual:pwa-register";
    registerSW({ immediate: true });

    Source: Vite PWA: Astro

1st-party scores 2 points, Experimental and Third-party 1, Manual 0. How scoring works

The port

The books demo app built with this framework, and where each branch is deployed.

Latest benchmark

Mobile Lighthouse lab results from PageSpeed Insights on : the median of 3 runs per host, averaged across the hosts listed. The benchmark page explains each metric and has every other framework.

Astro: latest benchmark per build and page
BuildPathPerfFCPRaw FCPLCPTBTCLSSITTIDocHosts
Book list /
baseline/85(good)1.531.35(poor)4.36(good)0(good)0.0002.524.361963/3 Vercel, Netlify, Cloudflare
optimized/98(good)0.940.21(good)2.06(good)0(good)0.0011.092.06783/3 Vercel, Netlify, Cloudflare
Book page /10145787
baseline/1014578796(good)1.520.95(needs improvement)2.57(good)0(good)0.0002.152.571373/3 Vercel, Netlify, Cloudflare
optimized/10145787100(good)0.930.21(good)1.25(good)0(good)0.0000.931.25833/3 Vercel, Netlify, Cloudflare
  • Good
  • Needs improvement
  • Poor

FCP 1.8 s / 3 s · LCP 2.5 s / 4 s · TBT 200 ms / 600 ms · CLS 0.1 / 0.25

Per host

The medians above before averaging. Runs is how many measured runs went into each median. Host names link to the deployment.

Astro: latest benchmark per build, page and host
BuildPathHostPerfFCPRaw FCPLCPTBTCLSSITTIDocRunsStatus
Astro
baseline/Vercel84(good)1.541.29(poor)4.36(good)0(good)0.0002.444.361163/3OK
baseline/Netlify85(good)1.511.34(poor)4.36(good)0(good)0.0012.494.361873/3OK
baseline/Cloudflare85(good)1.541.44(poor)4.36(good)0(good)0.0002.644.362843/3OK
baseline/10145787Vercel96(good)1.511.33(needs improvement)2.56(good)0(good)0.0002.472.561333/3OK
baseline/10145787Netlify96(good)1.541.33(needs improvement)2.59(good)0(good)0.0012.482.591743/3OK
baseline/10145787Cloudflare97(good)1.510.18(needs improvement)2.56(good)0(good)0.0001.512.561053/3OK
optimized/Vercel100(good)0.930.16(good)1.35(good)0(good)0.0000.931.35463/3OK
optimized/Netlify100(good)0.940.25(good)1.66(good)0(good)0.0031.161.661063/3OK
optimized/Cloudflare93(good)0.940.22(needs improvement)3.15(good)0(good)0.0001.183.15813/3OK
optimized/10145787Vercel100(good)0.920.20(good)1.20(good)0(good)0.0000.921.20823/3OK
optimized/10145787Netlify100(good)0.930.23(good)1.21(good)0(good)0.0000.931.211243/3OK
optimized/10145787Cloudflare100(good)0.930.19(good)1.35(good)0(good)0.0000.931.35423/3OK