Skip to content

Fresh

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

Rank 22 of 237/28 points: 2/14 first-paint, 5/14 other · 25% complete
Version checked
Fresh 2.3.3 (jsr:@fresh/core, JSR latest; Deno; docs at usefresh.dev)
Performance guide
Islands | Fresh docsNo dedicated performance page; closest official page.
Issues
github.com/freshframework/fresh/issues

Scorecard

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

Fresh's labels across 14 features

  • 1st-party2
  • Experimental0
  • Third-party3
  • Manual9
  • of 14

How it compares

On 2 of 14 features, no framework has a higher-scoring label than Fresh. On the other 12, at least one does.

Tested in our port

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

First-paint levers

2/14
  • Manual, like 11 of the other 22 frameworks. 11 frameworks score higher.

    Show the how-to

    No first-party CSS inlining documented. Vite bundles CSS imported from client.ts; a per-route css export adds stylesheets. A Vite ?inline import would be hand-wired (not found in the Fresh docs). (vite, file-routing)

    Code example

    You import the stylesheet with Vite's ?inline suffix in _app.tsx and render it in a <style> tag. Drop the import from client.ts so Vite stops adding the <link>.

    // routes/_app.tsx
    import globalCss from "../assets/global.css?inline";
    import { define } from "../utils.ts";
    
    export default define.page(function App({ Component }) {
      return (
        <html lang="en">
          <head>
            <meta charset="utf-8" />
            {/* _app.tsx is server-only, so the CSS string never reaches an island bundle */}
            <style dangerouslySetInnerHTML={{ __html: globalCss }} />
            {/* … */}
          </head>
          <body f-client-nav>{/* … */}</body>
        </html>
      );
    });
    
    // client.ts
    // import "./assets/global.css";  ← removed, or the <link> comes back

    Source: Vite: disabling CSS injection

  • 02Font optimizationThird-party1 pt

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

    Show the how-to

    No first-party font handling documented; fonts appear only as files in static/ referenced by URL. The third-party route is Fontsource packages, which the Fresh docs do not mention. (static-files)

    Code example

    The Books port self-hosts Geist with Fontsource packages mapped in deno.json. The CSS @import brings in the @font-face rules, and Vite bundles the font files when client.ts imports the stylesheet.

    // deno.json
    "imports": {
      "@fontsource-variable/geist": "npm:@fontsource-variable/geist@^5.3.0"
    }
    /* assets/global.css (imported from client.ts) */
    @import '@fontsource-variable/geist';
    @import 'tailwindcss';
    
    @theme {
      --font-sans: 'Geist Variable', ui-sans-serif, system-ui, sans-serif;
    }

    Source: Fontsource: Install

  • 03Image pipelineThird-party1 pt

    Third-party, like 13 of the other 22 frameworks. 9 frameworks score higher.

    Show the how-to

    The docs say there is no built-in optimization pipeline and suggest vite-imagetools or a CDN. Fresh adds long-lived cache headers to src/srcset (opt out with data-fresh-disable-lock); asset() / assetSrcSet() exist in fresh/runtime. (static-files, api-reference)

    Code example

    Fresh 2 builds with Vite, so vite-imagetools resizes and converts images at build time. The query string on the import picks widths and format, and as=srcset returns a ready srcset string.

    // vite.config.ts
    import { defineConfig } from "vite";
    import { fresh } from "@fresh/plugin-vite";
    import { imagetools } from "vite-imagetools";
    
    export default defineConfig({
      plugins: [fresh(), imagetools()],
    });
    // routes/about.tsx
    import heroAvif from "../static/hero.jpg?format=avif&w=800";
    import heroSrcset from "../static/hero.jpg?w=400;800;1200&format=webp&as=srcset";
    
    export default function About() {
      return <img src={heroAvif} srcset={heroSrcset} sizes="100vw" alt="Shelves of books" width={800} />;
    }

    Source: Fresh: Static files

    Art direction with <picture>

    Manual

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

    No first-party <picture> component documented; the docs point to vite-imagetools or a CDN, with markup hand-written. (static-files)

    Example

    You write the <picture> markup in a Preact component and put each pre-encoded format and crop in static/ yourself.

    // components/Hero.tsx
    export function Hero() {
      return (
        <picture>
          <source media="(min-width: 1000px)" type="image/avif" srcset="/hero-wide.avif" />
          <source media="(min-width: 1000px)" srcset="/hero-wide.jpg" />
          <source type="image/avif" srcset="/hero-tall.avif" />
          <img
            src="/hero-tall.jpg"
            alt="Shelves of books"
            width={750}
            height={1334}
            fetchPriority="high"
            decoding="async"
          />
        </picture>
      );
    }

    Source: Fresh static files

  • Manual, like 4 of the other 22 frameworks. 18 frameworks score higher.

    Show the how-to

    No first-party cache documented; set Cache-Control by hand via page(data, { headers }). Build-time prerender exists only as an open, unmerged PR, not in the docs and not credited. (data-fetching, 3766)

    Code example

    You wrap each query in a TTL cache backed by a host store, and set the HTML Cache-Control in app middleware. This comes from the port.

    // lib/catalog-cache.server.ts
    export function withTtlCache<Args extends unknown[], Result>(
      name: string,
      fn: (...args: Args) => Promise<Result>,
    ): (...args: Args) => Promise<Result> {
      // in-memory Map → Workers KV / Vercel getCache / Netlify Blobs → fn()
      return (...args: Args) => cacheLifeHours(`${name}:${JSON.stringify(args)}`, () => fn(...args))
    }
    
    // features/book/book-queries.server.ts
    export const getBooksPage = withTtlCache('getBooksPage', getBooksPageUncached)
    
    // main.ts
    app.use(async (ctx) => {
      const res = await ctx.next();
      if (!res.headers.get("content-type")?.includes("text/html")) return res;
      const headers = new Headers(res.headers);
      headers.set("Cache-Control", hostDocumentCacheControl());
      return new Response(res.body, { status: res.status, statusText: res.statusText, headers });
    });

    Source: Fresh data fetching

  • Manual, like 2 of the other 22 frameworks. 20 frameworks score higher.

    Show the how-to

    No first-party prefetch documented; partials (f-client-nav, f-partial) fetch on click only. (partials)

    Code example

    Add a Speculation Rules block to _app.tsx. Supporting browsers prefetch same-origin pages on hover, and other browsers ignore it. The prefetch only helps full-page navigations, so it does not speed up links that use Fresh partials (f-client-nav).

    // routes/_app.tsx
    const speculationRules = JSON.stringify({
      prefetch: [{
        where: { and: [
          { href_matches: "/*" },
          { not: { selector_matches: "[rel~=nofollow]" } },
        ] },
        eagerness: "moderate",
      }],
    });
    
    // … inside <head>:
    <script type="speculationrules" dangerouslySetInnerHTML={{ __html: speculationRules }} />

    Source: MDN: speculationrules

  • 06Streaming SSRManual0 pts

    Manual, like 2 of the other 22 frameworks. 20 frameworks score higher.

    Show the how-to

    No streamed page rendering documented. The docs show a ReadableStream returned from an API handler only, and describe no way to flush part of a page early. (common-patterns, data-fetching)

    Code example

    Write the route handler yourself and return a ReadableStream of HTML. The shell and a placeholder go out first. When the query resolves, the handler sends the rendered grid and a small script that swaps it in. This page skips Fresh's layouts and islands.

    // routes/books.tsx
    import { define } from "@/utils.ts";
    import { renderToString } from "preact-render-to-string";
    
    export const handler = define.handlers({
      GET() {
        const enc = new TextEncoder();
        const body = new ReadableStream({
          async start(controller) {
            controller.enqueue(enc.encode(
              `<!doctype html><html><head><link rel="stylesheet" href="/styles.css"></head>` +
              `<body><main id="grid">Loading…</main>`,
            ));
            const books = await getBooks();
            controller.enqueue(enc.encode(
              `<template id="grid-html">${renderToString(<BookGrid books={books} />)}</template>` +
              `<script>document.getElementById("grid").replaceWith(document.getElementById("grid-html").content)</script></body></html>`,
            ));
            controller.close();
          },
        });
        return new Response(body, { headers: { "Content-Type": "text/html; charset=utf-8" } });
      },
    });

    Source: Fresh: Common patterns

  • 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. Set a Link header by hand through page(data, { headers }) or a middleware. (data-fetching)

    Code example

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

    // main.ts
    const LINK = '<https://fonts.gstatic.com>; rel=preconnect; crossorigin';
    
    app.use(async (ctx) => {
      const res = await ctx.next();
      if (res.headers.get('content-type')?.includes('text/html')) res.headers.append('Link', LINK);
      return res;
    });

    Source: Fresh middleware

Other features

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

    Show the how-to

    Islands are the core model: only island JS ships and bundles are code-split; files live in islands/ or (_islands); props must be serializable. No lazy/idle/visible hydration timing is documented; Preact lazy() + <Suspense> is documented for code-splitting an island. (islands, architecture, common-patterns)

    Code example

    Any component in islands/ ships JS; everything else renders to HTML only. In the Books port the layout is server-only, and just the search box and the mobile drawer hydrate.

    // routes/_layout.tsx
    import BookSearch from '@/islands/BookSearch.tsx';
    import MobileSidebar from '@/islands/MobileSidebar.tsx';
    import MobileSidebarTrigger from '@/islands/MobileSidebarTrigger.tsx';
    import { define } from '../utils.ts';
    
    export default define.layout(function Layout({ Component, url }) {
      const current = searchParamsFromUrl(url.searchParams);
      return (
        <>
          <MobileSidebar pathname={url.pathname}>
            {/* server-rendered children passed into an island */}
            <BookSidebar current={current} idPrefix="mobile" mobile />
          </MobileSidebar>
          <header>
            <MobileSidebarTrigger />
            <BookSearch current={current} />
          </header>
          <main><Component /></main>
        </>
      );
    });

    Source: Fresh: Islands

  • Manual, like 3 of the other 22 frameworks. 19 frameworks score higher.

    Show the how-to

    Pages render to HTML on the server; no per-route prerender/SPA/ISR option is documented (RouteConfig covers routeOverride, skipAppWrapper, skipInheritedLayouts, csp and methods; none selects a render mode). No first-party per-route render mode documented. (architecture, routing, file-routing)

    Code example

    Every route still renders on the server. You pick a mode per route with CDN Cache-Control headers in app middleware, adapting the port's main.ts middleware.

    // main.ts
    const modes: Record<string, string> = {
      "/about": "public, s-maxage=31536000",                    // "static": cached until redeploy
      "/": "public, s-maxage=60, stale-while-revalidate=86400", // "ISR": revalidate each minute
    };
    
    app.use(async (ctx) => {
      const res = await ctx.next();
      if (!res.headers.get("content-type")?.includes("text/html")) return res;
      const headers = new Headers(res.headers);
      headers.set("Cache-Control", modes[ctx.url.pathname] ?? "private, no-store"); // SSR
      return new Response(res.body, { status: res.status, statusText: res.statusText, headers });
    });
    
    app.fsRoutes();

    Source: Fresh data fetching (response headers)

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

    Show the how-to

    Preact signals (useSignal from @preact/signals, a dependency of @fresh/core and part of the @fresh/init scaffold). Fresh serializes signal props so islands share state. (signals, sharing-state-between-islands)

    Code example

    Preact signals. In the Books port, one module-level signal is shared by two islands: the trigger sets it and the drawer re-renders when it changes.

    // lib/catalog-nav.ts
    import { signal } from '@preact/signals';
    export const mobileSidebarOpen = signal(false);
    // islands/MobileSidebarTrigger.tsx
    import { mobileSidebarOpen } from '@/lib/catalog-nav.ts';
    
    export default function MobileSidebarTrigger() {
      return <button aria-label="Open filters" onClick={() => (mobileSidebarOpen.value = true)}>Filters</button>;
    }
    
    // islands/MobileSidebar.tsx
    export default function MobileSidebar({ children }: { children?: ComponentChildren }) {
      const isOpen = mobileSidebarOpen.value;
      return <aside hidden={!isOpen}>{children}</aside>;
    }

    Source: Fresh: Signals

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

    Show the how-to

    No first-party analyzer documented; the Vite page mentions only vite-plugin-inspect as a debugging aid. (vite)

    Code example

    Fresh has no analyzer. The Vite page suggests vite-plugin-inspect for looking at transforms during dev; for bundle sizes, add rollup-plugin-visualizer and run deno task build.

    // vite.config.ts
    import { defineConfig } from "vite";
    import { fresh } from "@fresh/plugin-vite";
    import inspect from "vite-plugin-inspect";
    import { visualizer } from "rollup-plugin-visualizer";
    
    export default defineConfig({
      plugins: [
        fresh(),
        inspect(), // dev UI at /__inspect
        visualizer({ filename: "stats.html", gzipSize: true }),
      ],
    });

    Source: Fresh: Vite

  • Manual, like 16 of the other 22 frameworks. 6 frameworks score higher.

    Show the how-to

    No first-party script primitive documented; the head page lists <script> with no loading-strategy guidance. (head)

    Code example

    You write the loading strategy into <head> in _app.tsx. Use async or defer on the tag, or inject it at idle time with an inline script, as the port does for its theme script.

    // routes/_app.tsx
    const loadChatWhenIdle = `(window.requestIdleCallback||setTimeout)(function(){
      var s=document.createElement("script");s.src="https://widget.example.com/chat.js";s.async=true;
      document.head.appendChild(s);});`;
    
    export default define.page(function App({ Component }) {
      return (
        <html lang="en">
          <head>
            {/* … */}
            <script async src="https://analytics.example.com/script.js" />      {/* parallel, non-blocking */}
            <script dangerouslySetInnerHTML={{ __html: loadChatWhenIdle }} />   {/* after load, at idle */}
          </head>
          {/* <head> sits outside <Partial>, so f-client-nav does not re-run these */}
          <body f-client-nav>{/* … */}</body>
        </html>
      );
    });

    Source: Fresh head

  • Manual, like 8 of the other 22 frameworks. 14 frameworks score higher.

    Show the how-to

    Documented: Deno Deploy, deno compile, Docker, and Cloudflare Workers (via @cloudflare/vite-plugin and a hand-written server.js; stability not stated). Node, Vercel, and Netlify are not documented; no official guide was found. (deployment, cloudflare-workers, docker, deno-deploy)

    Code example

    You write a post-build script that wraps _fresh/server.js in each host's entry shape. This comes from the port: an edge function for Netlify, and a Node handler plus Build Output API config for Vercel.

    // scripts/netlify-edge.mjs
    import server from "../_fresh/server.js";
    export default (request) => server.fetch(request);
    
    // scripts/adapt.mjs (runs after `vite build`; host picked by NETLIFY=1 | VERCEL=1)
    if (host === "vercel") {
      await build({ ...common, entryPoints: ["scripts/vercel-handler.mjs"],
        outfile: `${out}/functions/index.func/index.mjs`, platform: "node", target: "node24" });
      await Deno.writeTextFile(`${out}/functions/index.func/.vc-config.json`, JSON.stringify({
        runtime: "nodejs24.x", handler: "index.mjs", launcherType: "Nodejs", supportsResponseStreaming: true,
      }));
      // … copy _fresh/client to static/, write config.json routes
    } else if (host === "netlify") {
      await build({ ...common, entryPoints: ["scripts/netlify-edge.mjs"],
        outfile: "netlify/edge-functions/fresh.js", platform: "neutral", external: ["node:*"] });
    }

    Source: Fresh deployment

  • Manual, like 16 of the other 22 frameworks. 6 frameworks score higher.

    Show the how-to

    No service worker support documented. Put a hand-written worker in static/ and register it from an island. (static-files)

    Code example

    Put a hand-written worker in static/ and register it with an inline script in the app wrapper.

    // static/sw.js
    const CACHE = 'books-v1'; // change the name on each deploy
    
    self.addEventListener('activate', (event) => {
      event.waitUntil(
        caches.keys().then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))),
      );
    });
    
    self.addEventListener('fetch', (event) => {
      const { request } = event;
      if (request.method !== 'GET' || new URL(request.url).origin !== location.origin) return;
      // Network first, so pages stay current. The cached copy answers when offline.
      event.respondWith(
        fetch(request)
          .then((response) => {
            const copy = response.clone();
            caches.open(CACHE).then((cache) => cache.put(request, copy));
            return response;
          })
          .catch(() => caches.match(request)),
      );
    });
    // routes/_app.tsx
    const swScript = `if('serviceWorker' in navigator)addEventListener('load',function(){navigator.serviceWorker.register('/sw.js')});`;
    // … in <head>
            <script dangerouslySetInnerHTML={{ __html: swScript }} />

    Source: Using Service Workers (MDN) · Fresh static files

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.

Fresh: latest benchmark per build and page
BuildPathPerfFCPRaw FCPLCPTBTCLSSITTIDocHosts
Book list /
baseline/84(good)1.510.95(poor)4.25(good)0(good)0.0002.134.251393/3 Vercel, Netlify, Cloudflare
optimized/90(good)0.920.99(needs improvement)3.60(good)0(good)0.0001.843.601763/3 Vercel, Netlify, Cloudflare
Book page /10145787
baseline/1014578797(good)1.510.31(good)2.49(good)0(good)0.0001.542.491533/3 Vercel, Netlify, Cloudflare
optimized/10145787100(good)0.870.63(good)1.81(good)0(good)0.0001.391.811353/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.

Fresh: latest benchmark per build, page and host
BuildPathHostPerfFCPRaw FCPLCPTBTCLSSITTIDocRunsStatus
Fresh
baseline/Vercel85(good)1.510.24(poor)4.05(good)0(good)0.0001.514.051003/3OK
baseline/Netlify84(good)1.511.30(poor)4.36(good)0(good)0.0002.444.361393/3OK
baseline/Cloudflare84(good)1.511.31(poor)4.36(good)0(good)0.0002.454.361773/3OK
baseline/10145787Vercel97(good)1.510.29(needs improvement)2.56(good)0(good)0.0001.542.561123/3OK
baseline/10145787Netlify97(good)1.510.33(good)2.44(good)0(good)0.0001.542.441233/3OK
baseline/10145787Cloudflare97(good)1.510.31(good)2.47(good)0(good)0.0001.542.472233/3OK
optimized/Vercel90(good)0.910.22(needs improvement)3.60(good)0(good)0.0000.913.601293/3OK
optimized/Netlify89(good)0.962.37(needs improvement)3.61(good)0(good)0.0003.713.611673/3OK
optimized/Cloudflare90(good)0.910.39(needs improvement)3.60(good)0(good)0.0000.923.602323/3OK
optimized/10145787Vercel100(good)0.910.24(good)1.80(good)0(good)0.0000.911.80893/3OK
optimized/10145787Netlify100(good)0.780.23(good)1.81(good)0(good)0.0000.781.81573/3OK
optimized/10145787Cloudflare99(good)0.931.41(good)1.82(good)0(good)0.0002.471.822593/3OK