@nx/angular:setup-ssr

Create the additional configuration required to enable SSR via Angular Universal for an Angular application.

Usage

1nx generate setup-ssr ... 2

By default, Nx will search for setup-ssr in the default collection provisioned in workspace.json.

You can specify the collection explicitly as follows:

1nx g @nx/angular:setup-ssr ... 2

Show what will be generated without writing to disk:

1nx g setup-ssr ... --dry-run 2

Options

project

Required
string

The name of the application to generate the Angular Universal configuration for.

hydration

boolean
Default: true

Set up Hydration for the SSR application.

main

string
Default: main.server.tsFormat: path

The name of the main entry-point file.

rootModuleFileName

string
Default: app.server.module.tsFormat: path

The name of the root module file

rootModuleClassName

string
Default: AppServerModule

The name of the root module class.

serverFileName

string
Default: server.ts

The name of the Express server file.

serverPort

number
Default: 4000

The port for the Express server.

standalone

boolean

Use Standalone Components to bootstrap SSR.

serverRouting

boolean

Creates a server application using the Server Routing and App Engine APIs for application using the application builder (Developer Preview). Note: this is only supported in Angular versions 19.x.x. From Angular 20 onwards, SSR will always enable server routing when using the application builder.

skipFormat

Internal
boolean

Skip formatting the workspace after the generator completes.

skipPackageJson

Internal
boolean
Default: false

Do not add dependencies to package.json.