Skip to content
Skills Library
Programming · Building & coding

angular-ssr

/angular-ssr

Angular SSR with @angular/ssr, hydration, and prerendering. Covers server-side rendering setup, transfer state, and deployment. USE WHEN: user mentions "Angular SSR", "server-side rendering", "Angular Universal", "@angular/ssr", "hydration", "prerendering", "Angular SEO" DO NOT USE FOR: Next.js SSR - use `nextjs`, Nuxt SSR - use `vue-composition`, SvelteKit SSR - use `svelte`

Licence
MIT
Last repository change
21.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 21.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Angular SSR with @angular/ssr, hydration, and prerendering. Covers server-side rendering setup, transfer state, and deployment. USE WHEN: user mentions "Angular SSR", "server-side rendering", "Angular Universal", "@angular/ssr", "hydration", "prerendering", "Angular SEO" DO NOT USE FOR: Next.js SSR - use `nextjs`, Nuxt SSR - use `vue-composition`, SvelteKit SSR - use `svelte`

Triggers from the description

Angular SSRserver-side renderingAngular Universal@angular/ssrhydrationprerenderingAngular SEO
Original author description

Angular SSR with @angular/ssr, hydration, and prerendering. Covers server-side rendering setup, transfer state, and deployment. USE WHEN: user mentions "Angular SSR", "server-side rendering", "Angular Universal", "@angular/ssr", "hydration", "prerendering", "Angular SEO" DO NOT USE FOR: Next.js SSR - use `nextjs`, Nuxt SSR - use `vue-composition`, SvelteKit SSR - use `svelte`

How it works

  1. Setup
  2. Server Configuration
  3. Route-Level Rendering Modes
  4. Hydration
  5. Platform Checks
  6. Anti-Patterns
  7. Quick Troubleshooting
Original SKILL.md headings · 111 lines, 409 words
SKILL.md preview
---
name: angular-ssr
description: |
  Angular SSR with @angular/ssr, hydration, and prerendering.
  Covers server-side rendering setup, transfer state, and deployment.

  USE WHEN: user mentions "Angular SSR", "server-side rendering", "Angular Universal",
  "@angular/ssr", "hydration", "prerendering", "Angular SEO"

  DO NOT USE FOR: Next.js SSR - use `nextjs`, Nuxt SSR - use `vue-composition`,
  SvelteKit SSR - use `svelte`
allowed-tools: Read, Grep, Glob, Write, Edit
---
# Angular SSR - Quick Reference

> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `angular`, topic: `ssr` for comprehensive documentation.

## Setup

```bash
# Add SSR to existing project
ng add @angular/ssr
```

This creates:
- `server.ts` - Express server entry point
- `src/app/app.config.server.ts` - Server-specific providers
- Updates `angular.json` with server builder

## Server Configuration

```typescript
// app.config.server.ts
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
import { provideServerRendering } from '@angular/platform-server';
import { provideServerRoutesConfig } from '@angular/ssr';
import { appConfig } from './app.config';
import { serverRoutes } from './app.routes.server';

const serverConfig: ApplicationConfig = {
  providers: [
    provideServerRendering(),
    provideServerRoutesConfig(serverRoutes),
  ]
};

export const config = mergeApplicationConfig(appConfig, serverConfig);
```

## Route-Level Rendering Modes

```typescript
// app.routes.server.ts
import { RenderMode, ServerRoute } from '@angular/ssr';

export const serverRoutes: ServerRoute[] = [
  { path: '', renderMode: RenderMode.Prerender },           // Static at build time
  { path: 'dashboard', renderMode: RenderMode.Server },      // SSR per request
  { path: 'profile/**', renderMode: RenderMode.Client },     // Client-only (SPA)
  { path: '**', renderMode: RenderMode.Server },              // Default: SSR
];
```

## Hydration

```typescript
// app.config.ts - Hydration is enabled by default with @angular/ssr
export const appConfig: ApplicationConfig = {
  providers: [
    provideClientHydration(),  // Included automatically
  ]
};
```

## Platform Checks

```typescript
import { isPlatformBrowser, isPlatformServer } from '@angular/common';
import { PLATFORM_ID, inject } from '@angular/core';

@Component({ ... })
export class MyComponent {
  private platformId = inject(PLATFORM_ID);

  ngOnInit() {
    if (isPlatformBrowser(this.platformId)) {
      // Browser-only code (localStorage, window, DOM manipulation)
      window.addEventListener('scroll', this.onScroll);
    }
  }
}

// Or use afterNextRender for one-time browser init
import { afterNextRender } from '@angular/core';

@Component({ ... })
export class ChartComponent {
  constructor() {
    afterNextRender(() => {
      // Runs only in browser after first render
      this.initChart();
    });
  }
}
```

## Anti-Patterns

| Anti-Pattern | Why It's Bad | Correct Approach |
|--------------|--------------|------------------|
| Direct `window`/`document` access | Breaks SSR | Use `isPlatformBrowser()` |
| No hydration | Full page re-render | Enable `provideClientHydration()` |
| SSR for auth-only pages | Wasted server resources | Use `RenderMode.Client` |
| Ignoring transfer state | Double data fetch | Hydration handles this automatically |

## Quick Troubleshooting

| Issue | Likely Cause | Solution |
|-------|--------------|----------|
| Hydration mismatch | DOM changed before hydration | Avoid DOM manipulation in `ngOnInit` |
| `window is not defined` | Server-side access | Guard with `isPlatformBrowser()` |
| Slow SSR | Heavy computation | Move to client with `@defer` |
| SEO not working | Client-only rendering | Use `RenderMode.Server` or `Prerender` |

Versions

RepositoryScoreLicence
This page · claude-dev-suite/claude-dev-suite100MIT
HoangNguyen0403/agent-skills-standard100MIT

Database snapshot: 13.11.2026 · package version dc239d7df8e0 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 80Angular v22 SSR Hydration Baseline
    Use this skill when the app renders on the server and Angular 22 hydration or server-engine changes need review.
  • 80Angular Hydration v17 Risk Gate
    Evaluate hydration and SSR behavior after Angular 17 upgrades when the app uses provideClientHydration, SSR, prerender, or DOM reuse-sensitive widgets. Use when hydration mismatches, server render errors, or third-party DOM manipulation may affect runtime behavior.
  • 90angular-developer
    Generates Angular code and provides architectural guidance. Trigger when creating projects, components, services, or HTTP communication, or for best practices on reactivity (signals, linkedSignal, resource, httpResource), queries and content projection, forms, dependency…
  • 90angular-developer
    Generates Angular code and provides architectural guidance. Trigger when creating projects, components, services, or HTTP communication, or for best practices on reactivity (signals, linkedSignal, resource, httpResource), queries and content projection, forms, dependency…
  • 100angular
    Expert Angular assistance covering Signals, Standalone Components, dependency injection, RxJS, and SSR. Use when building enterprise Single Page Applications with modern Angular.
  • 100ssr-migration
    Migrate client-side rendered (CSR) React/Vue applications to server-side rendering (SSR) or static site generation (SSG) using Next.js, Nuxt, or Astro. Use when you need to improve SEO, reduce time-to-first-byte, fix blank page issues for crawlers, or improve Core Web Vitals.…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.