angular-ssr-stream

Type at least two characters. Every page is searched, code included.

About

Streaming SSR for Angular: frequently asked questions

Short answers on Angular support, SEO, caching, the Angular CLI, failures and readiness, each linking the page with the long one.

On this page

Short answers, each with the page that has the long one.

Doesn't Angular stream on its own?#

No. Angular renders a page on the server and sends it whole, once every request it made has answered. It has incremental hydration, which this builds on, but nothing that sends a part of the page later. See Does Angular support streaming SSR?.

How is this different from incremental hydration?#

Incremental hydration decides when a part of the page becomes interactive in the browser. The part's HTML is still in the page the server sent whole. Streaming decides when that HTML arrives: the server sends the rest of the page first, and the part when its data is there. This uses the first to do the second; see What Angular has instead.

Do I need the Angular CLI?#

No. With the Angular CLI, @angular/ssr stays in charge and its server routes stream. Without it, the app builds with Vite and ngp, on any of the other runtimes, and gives up @angular/ssr's server routes and status codes. See Requirements.

Which Angular versions does it support?#

19.2, 20.3, 21.2 and 22, each from the patch the compatibility table names, zoneless and with Zone.js. The ngp setups build Angular 22.3.0-rc.0 only.

Is it ready for production?#

Judge it on what has been checked:

  • No release is out yet; see Releases and upgrading.
  • The hosted platforms were checked locally, with each platform's own tooling or a stand-in for it, not on a real deployment. Each runtime's page says what was checked.
  • ngp is a prototype, pinned to an Angular release candidate. The Angular CLI setup doesn't use it.
  • It uses private Angular APIs, and supports only the versions CI checks.

Going to production has what to settle first.

Does it hurt SEO?#

A crawler that runs scripts, as Google's does, sees the whole page once the stream ends. One that doesn't sees the shell, with each block's loading state. Titles and meta tags have to be set before the shell goes out. See Crawlers and metadata.

Can I cache a streamed page?#

Not as it stands: streamed responses are sent with Cache-Control: no-store. Cache the data the page waits for instead, and the browser build as usual. See Caching.

What if my API is slow, or down?#

Slow is what this is for: the rest of the page is there at once, and the slow part follows. Down is an error state in the block, and the browser tries the request again itself. See When a request fails.

Does the data have to come through HttpClient?#

No. The renderer follows HttpClient requests, and with them an httpResource(). It also follows a resource() and anything else the application holds in Angular's PendingTasks, though the browser then loads that data again. A plain fetch() or an SDK needs a few lines to stream. See Data from outside HttpClient.

Why does my page arrive all at once?#

Something kept it from streaming: a block that isn't set up to stream, data the renderer isn't told about, compression, or a proxy. See The page arrives all at once.

Can I use @angular/service-worker?#

With the Angular CLI, yes: it is the CLI's build step, and @angular/ssr serves the app as usual. The ngp setups have no such build step. An experimental worker of this project's own renders the pages in the browser instead; see Service Worker.

Does it work with i18n?#

With the Angular CLI, a localized build streams: withStreaming() provides LOCALE_ID and sets Content-Language for each locale, as @angular/ssr does. See the API reference. The ngp setups haven't been checked with a localized build.

How is this different from Analog's streaming?#

Both stream @defer blocks with a hydrate trigger. Here the first flush is the page itself, and each block arrives and hydrates when its own data does. In Analog the page, its data and hydration come together at the end. Analog in turn takes a block anywhere, and serves crawlers a buffered document. Analog's streaming SSR, compared sends one page through both and steps through the two responses.

Edit this page on GitHub