Skip to content

Streaming SSR

Streaming SSR sends the HTML in pieces. The server flushes the page shell (<head>, layout, loading placeholders) as soon as it is rendered, and sends each slow part when its data resolves. A buffered server waits for the slowest query before it sends the first byte, so one slow query delays the stylesheet, the fonts, and first paint. The row is ✅ when the framework's own server renderer can flush the shell before all data is ready, with a documented way to mark the deferred parts. In-order streaming counts the same as out-of-order streaming.

06 / 14First-paint leverOne of 7 features that affect first paint, the moment the browser first draws content. Together they are worth 14 of the 28 points.

Labels across 23 frameworks

  • 1st-party18
  • Experimental2
  • Third-party0
  • Manual3
  • of 23

How to enable it, by framework

One card per framework, in the same order on every feature page. Where a framework has no built-in support (Manual), a short example shows how to build it yourself.

Next

1st-party2 ptsOverview

Streaming is built into the App Router. Add a loading.tsx 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.

import { Suspense } from 'react'

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

Adapted from the Next streaming guide (imports of the page's own components omitted).

Nuxt

Experimental1 ptOverview

Set experimental.ssrStreaming: true. The server sends the shell (<head>, styles, preload hints, entry scripts) first and then streams the body with Vue's renderToWebStream. routeRules can switch it off per route.

export default defineNuxtConfig({
  experimental: {
    ssrStreaming: true,
  },
  routeRules: {
    '/no-stream/**': { streaming: false },
  },
})

From the Nuxt experimental features docs.

SvelteKit

1st-party2 ptsOverview

Return a promise from a server load without awaiting it (streaming with promises). The page renders with the awaited data, and each promise is streamed to the browser when it resolves; {#await} shows the placeholder.

export async function load({ params }) {
  return {
    comments: loadComments(params.slug),
    post: await loadPost(params.slug)
  };
}

From the SvelteKit load docs (comments omitted).

SolidStart

1st-party2 ptsOverview

With ssr: true, pages stream from the server (choose a rendering mode): the shell is sent first, then one HTML fragment per <Loading> boundary as its data resolves (performance guide).

plugins: [solid({ start: true, ssr: true })],
<Loading fallback={<p>Loading product…</p>}>
  <article>
    <h1>{product().name}</h1>
  </article>
</Loading>

Adapted from the Solid docs (vite.config.ts line and a shortened <Loading> example).

The default server entry uses defaultStreamHandler (server entry point), so streaming SSR is on without a flag. Return a promise from a loader without awaiting it and render it with <Await>.

export const Route = createFileRoute('/posts/$postId')({
  loader: async () => {
    const slowDataPromise = fetchSlowData()
    const fastData = await fetchFastData()
    return { fastData, deferredSlowData: slowDataPromise }
  },
})
// ...
<Await promise={deferredSlowData} fallback={<div>Loading...</div>}>
  {(data) => <div>{data}</div>}
</Await>

Adapted from the TanStack Router deferred data loading guide (comments omitted).

The same setup applies: defaultStreamHandler from @tanstack/solid-start/server (server entry point) and unawaited loader promises rendered with <Await> (deferred data loading).

Code example

The server entry renders with defaultStreamHandler. A loader returns a slow promise without awaiting it, and <Await> shows its fallback until the promise resolves and the rest of the HTML streams in.

// src/server.ts
import { createStartHandler, defaultStreamHandler } from '@tanstack/solid-start/server'
import { createServerEntry } from '@tanstack/solid-start/server-entry'

const processRequest = createStartHandler(defaultStreamHandler)
export default createServerEntry({ fetch: (request, opts) => processRequest(request, opts) })
// src/routes/$id.tsx
import { createFileRoute, Await } from '@tanstack/solid-router'

export const Route = createFileRoute('/$id')({
  loader: async ({ params }) => ({
    book: await getBook(params.id),       // awaited: in the first chunk
    reviews: getReviews(params.id),       // not awaited: streamed later
  }),
  component: BookPage,
})

function BookPage() {
  const data = Route.useLoaderData()
  return (
    <>
      <h1>{data().book.title}</h1>
      <Await promise={data().reviews} fallback={<p>Loading reviews…</p>}>
        {(reviews) => <ul>{reviews.map((r) => <li>{r.text}</li>)}</ul>}
      </Await>
    </>
  )
}

Source: TanStack Start: Server Entry Point · TanStack Router: Deferred Data Loading

Pracht

1st-party2 ptsOverview

Set the route option streaming: true and wrap slow loader values in defer(). It needs render: "ssr" and full hydration. Pages-router files use export const STREAMING = true.

route("/product/:id", () => import("./routes/product.tsx"), {
  render: "ssr",
  streaming: true,
});

From the Pracht data loading docs ("Streaming the document").

Waku

1st-party2 ptsOverview

Waku renders React Server Components to a stream, and a <Suspense> boundary around an async server component sends its fallback with the shell. There is no flag. The docs describe this only in passing: the redirects and not-found guide covers what happens "inside a Suspense boundary after the shell has already been sent".

Code example

Make the slow part an async server component and wrap it in <Suspense>. Waku sends the page shell with the fallback first, then streams the pagination once its count query resolves.

// src/pages/index.tsx
import { Suspense } from 'react';

export default async function HomePage({ query }: { query: string }) {
  const searchParams = parseSearchParams(queryToRecord(query));
  const books = await getBooksPage(toBookQuery(searchParams));
  return (
    <div>
      <BookGrid books={books} searchParams={searchParams} />
      <footer>
        <Suspense fallback={<BookPaginationSkeleton />}>
          <BookPagination searchParams={searchParams} />
        </Suspense>
      </footer>
    </div>
  );
}

// src/features/book/components/book-pagination.tsx
export async function BookPagination({ searchParams }: { searchParams: SearchParams }) {
  const totalResults = await getBooksCount(toBookFilters(toBookQuery(searchParams)));
  // … render page links
}

Source: Waku: Redirects and not found · React: Suspense

Ember

Manual0 ptsOverview

No streaming render is documented. The FastBoot user guide and the community vite-ember-ssr layer this port uses both render the whole page and then send it.

Code example

Return a ReadableStream from the request handler. It sends the top of the HTML template right away, then waits for the Ember render and sends the rest. The status code is fixed at 200 once the first chunk is out.

// server/handle-request.js
import { assembleHTML } from 'vite-ember-ssr/server';

const HEAD_MARKER = '<!-- VITE_EMBER_SSR_HEAD -->';
// … in handleFetch, for page requests
const template = await getTemplate();
const early = template.slice(0, template.indexOf(HEAD_MARKER));
const encoder = new TextEncoder();

const body = new ReadableStream({
  async start(controller) {
    controller.enqueue(encoder.encode(early)); // charset, viewport, favicon
    const emberApp = await getEmberApp();
    const rendered = await emberApp.renderRoute(`${url.pathname}${url.search}`, { settledTimeout: 8000 });
    controller.enqueue(encoder.encode(assembleHTML(template, rendered).slice(early.length)));
    controller.close();
  },
});
return new Response(body, { headers: { 'content-type': 'text/html; charset=utf-8' } });

Source: vite-ember-ssr · MDN: ReadableStream

Astro

1st-party2 ptsOverview

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

React Router

1st-party2 ptsOverview

Return a promise from a loader without awaiting it, then render it with <Await resolve={...}> inside <Suspense>; the awaited data renders first and the rest streams in. The loader must return an object with keys, not a single promise. (suspense)

Code example

The loader awaits the critical data and returns the slow promise as-is. The component renders that promise with <Await> inside <Suspense>, so the fallback goes out first.

// app/routes/book.tsx
import { Suspense } from 'react'
import { Await } from 'react-router'
import type { Route } from './+types/book'

export async function loader({ params }: Route.LoaderArgs) {
  const reviews = getReviews(params.id) // NOT awaited
  const book = await getBook(params.id)
  return { book, reviews }
}

export default function Book({ loaderData }: Route.ComponentProps) {
  return (
    <>
      <h1>{loaderData.book.title}</h1>
      <Suspense fallback={<p>Loading reviews…</p>}>
        <Await resolve={loaderData.reviews}>
          {(reviews) => <ul>{reviews.map((r) => <li key={r.id}>{r.text}</li>)}</ul>}
        </Await>
      </Suspense>
    </>
  )
}

Source: React Router: Streaming with Suspense

Qwik City

1st-party2 ptsOverview

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, qwik-server)

Code example

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.

// 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

No streaming render documented. The SSR guide describes rendering the page to a complete HTML document and then sending it, and the word "stream" does not appear in it. (ssr)

Code example

Angular renders the whole document before sending it. To get bytes out sooner, flush a fixed <head> from the Express handler while Angular renders, then send the rest of Angular's HTML. The status code and head are fixed before rendering starts.

// src/server.ts
import { AngularNodeAppEngine } from '@angular/ssr/node';
import express from 'express';

const app = express();
const angularApp = new AngularNodeAppEngine();
// Copy the <head> of the built index.server.html, with its hashed CSS link.
const HEAD = `<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Books</title>
<link rel="stylesheet" href="/styles-HASH.css"></head>`;

app.use(async (req, res, next) => {
  if (!req.accepts('html')) return next();
  res.status(200).type('html').write(HEAD); // sent before Angular renders
  const response = await angularApp.handle(req);
  const html = response ? await response.text() : '<body></body>';
  res.end(html.slice(html.indexOf('</head>') + '</head>'.length)); // body only
});

Source: Angular: Server-side rendering

Marko

1st-party2 ptsOverview

Streaming is the default. Marko flushes HTML up to each <await> and sends the rest when its promise resolves; a <try> with @placeholder opts into out-of-order streaming and shows the placeholder first. (streaming)

Code example

The handler passes the queries to the page as unresolved promises. Each <await> sits in a <try> with @placeholder, so the skeleton is sent first and the grid streams in when its promise resolves.

// src/routes/+handler.ts
export const GET = Run.GET((ctx, next) => {
  const params = parseSearchParams(ctx.search ?? {});
  return next({
    books: loadBooksPage(params),   // not awaited
    count: loadBooksCount(params),  // not awaited
  });
});
// src/routes/+page.marko
<try>
  <await|books|=$global.data.books>
    <book-grid books=books/>
  </await>
  <@placeholder><book-grid-skeleton/></@placeholder>
  <@catch|err|><error-state title="Can't load books" body=err.message/></@catch>
</try>

Source: Marko: Streaming

Fresh

Manual0 ptsOverview

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

Analog

Experimental1 ptOverview

The streaming SSR page says it "is experimental and opt-in". Set analog({ experimental: { streaming: true } }) in the Vite config and export renderStream(AppComponent, config) from @analogjs/router/server in main.server.ts; it needs Angular 21+ and Vite 6+, and builds on incremental hydration (@defer blocks). The default SSR path stays buffered. (streaming-ssr)

Code example

Turn on the experimental flag and export renderStream from the server entry. It needs Angular 21+ and Vite 6+.

// vite.config.ts
import analog from '@analogjs/platform';
import { defineConfig } from 'vite';

export default defineConfig({
  plugins: [analog({ experimental: { streaming: true } })],
});

// src/main.server.ts
import { renderStream } from '@analogjs/router/server';
import { config } from './app/app.config.server';
import { AppComponent } from './app/app.component';

export default renderStream(AppComponent, config);

Source: Analog: Streaming SSR

Vike

1st-party2 ptsOverview

Set stream: true in a +config.js, for the whole app or per page; it needs ssr: true and one of vike-react, vike-vue or vike-solid. The default is false. The deferred parts are the UI framework's own async boundaries: vike-react streams through react-streaming, and vike-react-query's useSuspenseQuery() shows a <Suspense> fallback while the rest of the page renders. (stream, streaming, vike-react-query)

Code example

Set stream: true in +config. With vike-react-query, a component that calls useSuspenseQuery() streams in later, and withFallback() gives it a loading fallback.

// pages/+config.ts
import vikeReact from 'vike-react/config'
import vikeReactQuery from 'vike-react-query/config'

export default { extends: [vikeReact, vikeReactQuery], stream: true }

// pages/book/@id/Reviews.tsx
import { useSuspenseQuery } from '@tanstack/react-query'
import { withFallback } from 'vike-react-query'

export const Reviews = withFallback(
  ({ id }: { id: string }) => {
    const { data } = useSuspenseQuery({
      queryKey: ['reviews', id],
      queryFn: () => fetch(`/api/reviews/${id}`).then((r) => r.json()),
    })
    return <ul>{data.map((r: { id: string; text: string }) => <li key={r.id}>{r.text}</li>)}</ul>
  },
  () => <p>Loading reviews…</p>,
)

Source: Vike: stream · vike-react-query README

RedwoodSDK

1st-party2 ptsOverview

Server components are "rendered on the server as HTML and then streamed to the client". Wrap an async server component in <Suspense fallback={...}> to show a loading state while its data is fetched. Nothing to enable. (react-server-components)

Code example

Make a server component async and wrap it in <Suspense>. The page shell streams first with the fallback, and the list streams in when the query resolves.

// src/app/pages/todos/TodoPage.tsx
import { Suspense } from "react";

export async function Todos({ ctx }) {
  const todos = await db.todo.findMany({ where: { userId: ctx.user.id } });
  return <ol>{todos.map((todo) => <li key={todo.id}>{todo.title}</li>)}</ol>;
}

export async function TodoPage({ ctx }) {
  return (
    <div>
      <h1>Todos</h1>
      <Suspense fallback={<div>Loading...</div>}>
        <Todos ctx={ctx} />
      </Suspense>
    </div>
  );
}

Source: RedwoodSDK: React Server Components

Remix 3

1st-party2 ptsOverview

Give a <Frame src="..."> a fallback; the fallback is part of the initial HTML, and when the frame's route finishes Remix streams its HTML and replaces the fallback. The render() middleware from remix/middleware/render streams the component tree. A frame without a fallback blocks the first chunk. (streaming-ui-with-frames)

Code example

The render() middleware streams the component tree. A <Frame> with a fallback sends the fallback in the first chunk, then streams the frame route's HTML when it is ready.

// app/router.ts
import { render } from "remix/middleware/render";
import { createRouter } from "remix/router";
import { assets } from "./assets.ts";

export const router = createRouter({
  middleware: [render({ assets })],
});

// app/actions/books/show-page.tsx
<main>
  <h1>{book.title}</h1>
  <Frame
    src={routes.books.reviews.href({ bookId: book.id })}
    fallback={<p>Loading reviews…</p>}
  />
</main>

Source: Remix: Streaming UI with frames, stream a fallback first

Void (React)

1st-party2 ptsOverview

Wrap slow loader values in defer(): "The page renders immediately and receives the result when it is ready." The page reads the value with use() under <Suspense>; "React Pages requires React 19 and uses streaming SSR for the initial deferred shell". defer('group', fn) resolves several props from one call. (loaders, pages adapters)

Code example

Wrap a slow value in defer(). The page is sent first, and the value follows later in the same response. Read it with use() under <Suspense>; React Pages needs React 19.

// pages/[id].server.ts
import { defer, defineHandler } from 'void'

export const loader = defineHandler(async (c) => ({
  book: await getBook(c.req.param('id')),
  reviews: defer(() => getReviews(c.req.param('id'))),
}))
// pages/[id].tsx
import { Suspense, use } from 'react'

function ReviewList({ reviews }: { reviews: Promise<Review[]> }) {
  return <Reviews items={use(reviews)} />
}

export default function Book({ book, reviews }: Props) {
  return (
    <>
      <h1>{book.title}</h1>
      <Suspense fallback={<p>Loading reviews…</p>}><ReviewList reviews={reviews} /></Suspense>
    </>
  )
}

Source: Void: Deferred props · React: use

Void (Vue)

1st-party2 ptsOverview

Wrap slow loader values in defer(): "The page renders immediately and receives the result when it is ready." The Vue page gets a { loading, value, error } object and renders the loading branch first; the value is streamed into the same response when it resolves. defer('group', fn) resolves several props from one call. (loaders, pages adapters)

Code example

Wrap a slow value in defer(). The page is sent first, and the value follows later in the same response. The Vue page gets an object with loading, value and error.

// pages/[id].server.ts
import { defer, defineHandler } from 'void'

export const loader = defineHandler(async (c) => ({
  book: await getBook(c.req.param('id')),
  reviews: defer(() => getReviews(c.req.param('id'))),
}))
<!-- pages/[id].vue -->
<script setup lang="ts">
const props = defineProps<Props>()
</script>

<template>
  <h1>{{ props.book.title }}</h1>
  <p v-if="props.reviews.loading">Loading reviews…</p>
  <p v-else-if="props.reviews.error">Reviews failed to load.</p>
  <Reviews v-else :items="props.reviews.value" />
</template>

Source: Void: Deferred props

Void (Svelte)

1st-party2 ptsOverview

Wrap slow loader values in defer(): "The page renders immediately and receives the result when it is ready." The Svelte page gets a { loading, value, error } object and renders the loading branch first; the value is streamed into the same response when it resolves. defer('group', fn) resolves several props from one call. (loaders, pages adapters)

Code example

Wrap a slow value in defer(). The page is sent first, and the value follows later in the same response. The Svelte page gets an object with loading, value and error.

// pages/[id].server.ts
import { defer, defineHandler } from 'void'

export const loader = defineHandler(async (c) => ({
  book: await getBook(c.req.param('id')),
  reviews: defer(() => getReviews(c.req.param('id'))),
}))
<!-- pages/[id].svelte -->
<script lang="ts">
  let { book, reviews } = $props()
</script>
<h1>{book.title}</h1>
{#if reviews.loading}<p>Loading reviews…</p>{:else}<Reviews items={reviews.value} />{/if}

Source: Void: Deferred props

Void (Solid)

1st-party2 ptsOverview

Wrap slow loader values in defer(): "The page renders immediately and receives the result when it is ready." The Solid page gets a { loading, value, error } object and renders the loading branch first; the value is streamed into the same response when it resolves. defer('group', fn) resolves several props from one call. (loaders, pages adapters)

Code example

Wrap a slow value in defer(). The page is sent first, and the value follows later in the same response. The Solid page gets an object with loading, value and error.

// pages/[id].server.ts
import { defer, defineHandler } from 'void'

export const loader = defineHandler(async (c) => ({
  book: await getBook(c.req.param('id')),
  reviews: defer(() => getReviews(c.req.param('id'))),
}))
// pages/[id].tsx
export default function Book(props: Props) {
  return (
    <>
      <h1>{props.book.title}</h1>
      {props.reviews.loading ? <p>Loading reviews…</p> : props.reviews.error ? <p>Reviews failed to load.</p> : <Reviews items={props.reviews.value} />}
    </>
  )
}

Source: Void: Deferred props

Gotchas

  • The status code and headers are sent with the shell. A redirect or 404 found after that point cannot change them, so frameworks fall back to a client-side redirect or an error boundary.
  • A cached or prerendered page is already complete, so streaming changes nothing for it. Nuxt turns streaming off for routes with cache, isr, or swr rules.
  • A proxy or CDN that buffers the response removes the benefit. Check that your host passes chunks through.
  • Nuxt sends bots the buffered HTML by default. Pracht needs full hydration on a streamed route.