angular-ssr

Implement server-side rendering, hydration, and prerendering in Angular v20+ applications.

Updated Apr 29, 2026
One-click install
npx skills add https://github.com/iJosueeh/itera-workspace --skill angular-ssr-ijosueeh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular-ssr
Source: https://github.com/iJosueeh/itera-workspace/tree/main/.agents/skills/angular-ssr
Command: npx skills add https://github.com/iJosueeh/itera-workspace --skill angular-ssr-ijosueeh

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @angular/ssr, @angular/platform-server, express, and includes references (resource) components.

What problem does it solve? Angular single-page applications render entirely in the browser, which hurts SEO, slows first contentful paint, and breaks social media link previews. This Skill guides the setup of server-side rendering, hydration, and prerendering so Angular apps deliver pre-rendered HTML while keeping client-side interactivity. ## Core Features & Use Cases - SSR Setup and Configuration: Add @angular/ssr to an existing project, configure server routes with RenderMode (Prerender, Server, Client), and merge server providers into the application config. - Hydration Strategies: Apply incremental hydration with @defer triggers (viewport, interaction, idle, timer), enable event replay, and fix hydration mismatches using afterNextRender and platform detection. - Prerendering and SEO: Generate static pages at build time with getPrerenderParams, manage meta tags and JSON-LD structured data, and handle cookie-based authentication across server and client. - Use Case: You have an e-commerce Angular app where product pages must be indexed by search engines. Use this Skill to prerender product routes, transfer HTTP responses via TransferState, and defer hydration of below-the-fold widgets. ## Quick Start Set up server-side rendering in my Angular project and configure the product detail route to be prerendered at build time.

Frequently Asked Questions about angular-ssr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add server-side rendering to an existing Angular project?

Run ng add @angular/ssr to add server-side rendering to an existing Angular project. This installs the @angular/ssr package and generates server.ts, main.server.ts, and app.config.server.ts with the required providers.

How to fix Angular hydration mismatch errors?

Hydration mismatches occur when server-rendered HTML differs from client rendering, often from Date or random values. Move browser-only logic into afterNextRender, use isPlatformBrowser checks, or add ngSkipHydration to dynamic subtrees.

What is the difference between RenderMode Prerender, Server, and Client in Angular?

RenderMode.Prerender generates static HTML at build time for pages like blogs, RenderMode.Server renders dynamically per request for user-specific content, and RenderMode.Client falls back to client-side SPA rendering for authenticated dashboards.

Can I use window or localStorage in an Angular SSR application?

Direct access to window or localStorage fails on the server since those APIs do not exist in Node.js. Guard usage with isPlatformBrowser checks, afterNextRender callbacks, or injection tokens that return null on the server.

How do I prerender dynamic routes with parameters in Angular?

Use getPrerenderParams on a server route to return parameter values, such as product IDs fetched from an API, for build-time prerendering. Set a PrerenderFallback option to handle non-prerendered paths via SSR, client rendering, or 404.

Does Angular SSR support cookie-based authentication?

Angular SSR supports cookie-based authentication by injecting the REQUEST token from @angular/ssr/tokens to read request headers on the server. A common pattern is to mark authenticated routes as RenderMode.Client so they render only in the browser.