Skip to content

Conversation

@erdemcaygor
Copy link
Contributor

Description

Resolves #23427

Testing

Run this commmand npx ng g @abp/ng.schematics:ssr-add

@erdemcaygor erdemcaygor added this to the 10.0-final milestone Oct 22, 2025
@erdemcaygor erdemcaygor changed the title Feat/#23427 Schematic to Enable SSR in Existing ABP Angular Projects Oct 22, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements server-side rendering (SSR) support for ABP Angular applications, enabling improved initial load performance and SEO capabilities. The implementation adds a new ssr-add schematic that configures SSR for both application builder and webpack builder setups, supporting both standalone and NgModule-based applications.

Key changes:

  • Added ssr-add schematic with support for both Angular builders (application and webpack)
  • Implemented OAuth/OIDC authentication flow for SSR environments
  • Created template files for SSR configuration including server entry points and application configs

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
npm/ng-packs/scripts/build-schematics.ts Added SSR-related files to the build copy configuration
npm/ng-packs/packages/schematics/src/utils/angular/workspace.ts Added backward compatibility export for readWorkspace
npm/ng-packs/packages/schematics/src/utils/angular/latest-versions/index.ts Added dependency versions for SSR packages
npm/ng-packs/packages/schematics/src/utils/angular/index.ts Exported new dependency utilities module
npm/ng-packs/packages/schematics/src/commands/ssr-add/server/schema.json Defined schema for server SSR configuration options
npm/ng-packs/packages/schematics/src/commands/ssr-add/server/index.ts Implemented server-side configuration logic for both builder types
npm/ng-packs/packages/schematics/src/commands/ssr-add/server/files/**/*.template Added template files for server configurations
npm/ng-packs/packages/schematics/src/commands/ssr-add/schema.json Defined schema for main SSR schematic options
npm/ng-packs/packages/schematics/src/commands/ssr-add/index.ts Implemented main SSR schematic orchestration logic
npm/ng-packs/packages/schematics/src/commands/ssr-add/files/**/*.template Added server application templates for both builders
npm/ng-packs/packages/schematics/src/collection.json Registered new SSR schematics in collection

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}
}

export { getWorkspace as readWorkspace } from './workspace'; // for backwards compatibility
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circular export detected: exporting getWorkspace from the same file ('./workspace') creates a circular reference. The export should reference the actual module path where getWorkspace is defined, or this line should be removed if getWorkspace is already defined in this file.

Suggested change
export { getWorkspace as readWorkspace } from './workspace'; // for backwards compatibility

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +18
if (environment.production === false) {
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
}
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabling TLS certificate validation (NODE_TLS_REJECT_UNAUTHORIZED = \"0\") in non-production environments creates a security vulnerability by allowing man-in-the-middle attacks. Consider using valid certificates even in development, or add a prominent warning comment about the security implications.

Suggested change
if (environment.production === false) {
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
}
// WARNING: Disabling TLS certificate validation is a serious security risk.
// Do NOT use the following line in production or commit it to version control.
// Instead, use valid certificates in all environments.
// If you must use self-signed certificates in development, consider configuring your environment to trust them.
// process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";

Copilot uses AI. Check for mistakes.
? [
updateApplicationBuilderWorkspaceConfigRule(sourceRoot, options, context),
updateApplicationBuilderTsConfigRule(options),
updateRootTsConfigRule(options)
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comma after updateRootTsConfigRule(options) will cause a syntax error. Add a comma to separate array elements.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@sumeyyeKurtulus sumeyyeKurtulus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @erdemcaygor thank you for creating such command to serve the ssr migration smoothly both for module and standalone structure.

Except the points I mention below, this PR is mergable 🚀

  • I think we could remove the loader in index.html
  <body>
    <app-root></app-root>
    <!-- <div id="lp-page-loader"></div> -->
  </body>

I have come across some of these problems for the previous versions that use module structure instead:

  • Some missing imports for module structure
// angular/src/app/app.module.server.ts
for APP_INITIALIZER and isPlatformServer()
  • We are getting such error Module '"@angular/platform-browser"' has no exported member 'withIncrementalHydration'.ts(2305)
// angular/src/app/app.module.ts
import {
	// ...
  withIncrementalHydration, [error]
} from '@angular/platform-browser';
  • We are also getting an import error on server file, probably related to the typescript version
// angular/src/server.ts
// import express from 'express';
import * as express from 'express';

@sumeyyeKurtulus sumeyyeKurtulus merged commit fca19fd into rel-10.0 Nov 4, 2025
2 of 3 checks passed
@sumeyyeKurtulus sumeyyeKurtulus deleted the feat/#23427 branch November 4, 2025 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants