docs/en/Community-Articles/2025-11-15-Announcing-SSR-Support/article.md
We are pleased to announce that Server-Side Rendering (SSR) has become available for ABP Framework Angular applications! This highly requested feature brings major gains in performance, SEO, and user experience to your Angular applications based on ABP Framework.
Server-Side Rendering refers to an approach which renders your Angular application on the server as opposed to the browser. The server creates the complete HTML for a page and sends it to the client, which can then show the page to the user. This poses many advantages over traditional client-side rendering.
You can easily add SSR support to your existing ABP Angular application using the Angular CLI with ABP schematics:
Adds SSR configuration to your project
ng generate @abp/ng.schematics:ssr-add
Short form
ng g @abp/ng.schematics:ssr-add
If you have multiple projects in your workspace, you can specify which project to add SSR to:
ng g @abp/ng.schematics:ssr-add --project=my-project
If you want to skip the automatic installation of dependencies:
ng g @abp/ng.schematics:ssr-add --skip-install
When you add SSR to your ABP Angular project, the schematic automatically:
@angular/ssr and related packagesserver.ts and related filesmain.server.ts to bootstrap the serverapp.config.server.ts for standalone apps (or app.module.server.ts for NgModule apps)app.routes.server.tsangular.json to include:
serve-ssr target for local SSR developmentprerender target for static site generationThe ABP SSR schematic supports both modern and legacy Angular build configurations:
@angular-devkit/build-angular:application builder@angular-devkit/build-angular:server builderAfter adding SSR to your project, you can run your application in SSR mode:
# Development mode with SSR
ng serve
# Or specifically target SSR development server
npm run serve:ssr
# Build for production
npm run build:ssr
# Preview production build
npm run serve:ssr:production
Some browser APIs are not available on the server. Use platform checks to conditionally execute code:
import { isPlatformBrowser } from '@angular/common';
import { PLATFORM_ID, inject } from '@angular/core';
export class MyComponent {
private platformId = inject(PLATFORM_ID);
ngOnInit() {
if (isPlatformBrowser(this.platformId)) {
// Code that uses browser-only APIs
console.log('Running in browser');
localStorage.setItem('key', 'value');
}
}
}
localStorage and sessionStorage are not accessible on the server. Consider using:
Please ensure that any third-party libraries you use are compatible with SSR. These libraries can require:
The SSR implementation is natively integrated with all of the ABP Framework features:
Server-side rendering can be a very effective feature in improving your ABP Angular application's performance, SEO, and user experience. Our new SSR schematic will make it easier than ever to add SSR to your project.
Try it today and let us know what you think!