Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk5 min

Angular SSR: How to Choose Server, Prerender, or Client Rendering

Angular supports route-level Server, Prerender, and Client rendering. Choose based on when data is available, personalization, browser dependencies, and deployment needs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Angular does not require you to choose one rendering method for the whole application. You can select Server rendering for routes that need request-time or user-specific data, Prerender for pages whose content is known at build time, and Client rendering for routes that depend on browser-only behavior. Angular’s route-level hybrid rendering lets one application combine all three.

What Angular SSR does—and when to use it

With server-side rendering (SSR), Angular renders a route on the server for each request and sends HTML containing the page content to the browser. This can put useful content in the initial response, but it also means running a server request handler and ensuring server-side code does not assume browser APIs are available.

As an Amazon Associate I earn from qualifying purchases.

SSR is one of Angular’s three route-level rendering modes. The right choice depends mainly on when a route’s data is available, whether the content varies by visitor or request, and whether the route depends on browser-only capabilities.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a mode by route

Mode What Angular does Good fit Trade-offs
Client (CSR) Renders the route in the browser. This is Angular’s default behavior. Highly interactive routes, browser-dependent libraries, or an installable/offline client experience. The browser must download, parse, and execute JavaScript before the complete content appears; additional data requests can add delay. Angular notes that CSR can be less favorable for SEO because crawlers may have limits on executing JavaScript.
Server (SSR) Renders the application on the server for each request and sends populated HTML. Content that depends on the request or user, or routes where rendered content should be present in the initial HTML. Requires a server runtime, server-compatible code, and request-time rendering work that can increase hosting costs.
Prerender (SSG) Generates static HTML for selected routes at build time. Shared pages whose required data is available during the build. Cannot include data specific to a later visitor’s request. Generating many route variants can increase build time and deployment size.

These are qualitative trade-offs in Angular’s guidance, not a guarantee of a particular performance or SEO result. A rendered HTML response can help make content available earlier, but the outcome still depends on the page, data, and deployment.

A practical route mix

  • Use Prerender for a shared About page whose content is known when you build.
  • Use Server rendering for a profile route that needs information tied to the current request.
  • Keep a route Client-rendered if its behavior depends on browser-only libraries or capabilities.

How to enable SSR in an Angular application

Angular’s documented setup uses the Angular CLI. For a new application, use ng new --ssr. To add SSR support to an existing application, use ng add @angular/ssr. The CLI SSR setup includes hydration by default.

Assign rendering modes to routes

Server route configuration typically lives in app.routes.server.ts. Define routes with RenderMode.Client, RenderMode.Server, or RenderMode.Prerender according to the route’s data and runtime needs. This lets you combine modes instead of applying SSR indiscriminately across the application.

Prerender parameterized routes

For a parameterized route, Angular’s getPrerenderParams supplies the parameter values for which HTML should be generated during the build. You can also set a fallback behavior for paths that were not generated: use server rendering, client rendering, or no fallback. Angular specifies that dependencies injected into getPrerenderParams must be obtained synchronously, before asynchronous work or an await.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does Angular SSR require Node.js?

Request-time SSR needs a server runtime and an appropriate request handler, so it cannot be deployed as only static files. Angular’s guidance describes the runtime requirement but does not establish that every deployment must use one particular runtime. Check that the runtime and hosting environment you choose can execute the server handler produced for your application.

Prerender-only output has a different deployment path. With outputMode: "static", Angular generates static HTML without generating a server file; Angular says this output can be served by a CDN or static file server. If all routes can use build-time content, static hosting may be sufficient. If any route needs request-time SSR, the deployment must support that route’s server handler.

Hydration: reuse the server-rendered page in the browser

Hydration restores the Angular application in the browser while reusing the DOM produced by SSR. Angular warns that without hydration the browser destroys and re-renders that DOM, which can cause visible flicker and negatively affect Core Web Vitals such as Largest Contentful Paint (LCP) and layout shift.

Angular CLI’s SSR setup enables hydration by default. In a custom setup, configure provideClientHydration(). Keep the server-rendered and browser-rendered content consistent: differences between them can cause hydration mismatches or layout shifts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Handling browser-only initialization

Do not make server and browser templates render different content by using an isPlatformBrowser condition in the template. Angular warns this can produce hydration mismatches and layout shifts. For browser-specific initialization, its current server-rendering guidance recommends platform-specific providers and afterNextRender instead.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Data transfer, caching, and per-request state

Angular documents HTTP transfer-cache behavior for HttpClient, configurable through HttpTransferCacheOptions. Eligible HEAD and GET requests may be cached during SSR and reused during hydration. The behavior has exclusions, including requests with authorization, proxy-authorization, or cookie headers; credentialed requests; cache-control directives such as no-store, no-cache, or private; and responses with Set-Cookie.

Because these eligibility rules matter for sensitive data and can be implementation-sensitive, verify the current Angular server guide before changing transfer-cache behavior. Do not assume a response is transferred or safe to reuse without checking the request and response conditions.

There is also a server-state distinction to account for: Angular warns that top-level server provider values are evaluated once and can remain shared across requests until the server restarts. If a value must be created separately for each request, use a factory provider rather than relying on a shared top-level value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Costs and constraints to plan for

  • Server compatibility: SSR and prerendered code must not unconditionally use browser APIs. Code that assumes objects such as browser globals exist can fail outside the browser.
  • Request-time work: SSR renders for each request, adding server work and runtime requirements.
  • Build-time work: Prerendering many route variants can lengthen builds and increase the size of deployed output.
  • Personalization: A static prerender cannot contain information that is specific to a visitor making a later request.
  • Security: Server request handling has SSRF and allowed-host considerations. Angular points to separate server-side security guidance for those controls; consult it when configuring request handling.

Choosing a deployment approach

Use static hosting when your selected routes can be served from prerendered output. Angular’s static output mode generates HTML without a server file, making a CDN or static file server a possible fit. Use a hosting environment with a compatible server request handler when routes require request-time SSR. A hybrid application may need both strategies, depending on how its routes are built and deployed.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.