npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@anarchitects/nest-angular-ssr

v0.1.0

Published

Angular SSR integration for NestJS on Fastify, built on `@angular/ssr`.

Readme

@anarchitects/nest-angular-ssr

Angular SSR integration for NestJS on Fastify, built on @angular/ssr.

This package provides three usage levels:

  • easiest: NestAngularSsrModule.forRoot(...) in a normal Nest AppModule
  • explicit: bootstrapNestAngularSsr(...) during Nest bootstrap
  • advanced: direct renderer/integration composition

v1 Support

Runtime behavior:

| Request | Behavior | | --- | --- | | /api/... | Bypasses SSR and stays in Nest/Fastify | | Existing browser asset | Served directly | | Other GET / HEAD route | Rendered through Angular SSR | | SSR returns null | Falls back to Nest/Fastify not-found handling |

Validated consumer compatibility:

| Consumer shape | Status | Notes | | --- | --- | --- | | CommonJS-oriented Nest app | Supported | Direct module import works | | ESM Nest app | Supported | Direct module import works |

The compatibility result above is backed by the fixture validation note at docs/validation/nest-angular-ssr-consumers.md.

Requirements

  • NestJS 11+ with the Fastify adapter
  • Angular SSR built on @angular/ssr
  • An explicit browser assets directory

Peer dependencies:

  • @angular/ssr
  • @nestjs/common
  • @nestjs/core
  • @nestjs/platform-fastify
  • fastify

Recommended Usage

Nest Module

Use the module when you want a normal Nest AppModule-based setup.

import { Module } from '@nestjs/common';
import { NestAngularSsrModule } from '@anarchitects/nest-angular-ssr';

@Module({
  imports: [
    NestAngularSsrModule.forRoot({
      routing: {
        browserAssetsDir: 'dist/apps/web/browser',
      },
    }),
  ],
})
export class AppModule {}
import { NestFactory } from '@nestjs/core';
import {
  FastifyAdapter,
  type NestFastifyApplication,
} from '@nestjs/platform-fastify';

import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create<NestFastifyApplication>(
    AppModule,
    new FastifyAdapter(),
  );

  app.setGlobalPrefix('api');
  await app.listen(3000, '0.0.0.0');
}

void bootstrap();

Notes:

  • browserAssetsDir is required.
  • When your app uses app.setGlobalPrefix(...), SSR routing follows that prefix automatically.
  • Set routing.apiPrefix only when you need to override the detected Nest global prefix.
  • NestAngularSsrModule.forRootAsync(...) is available when the same option shape needs to come from Nest DI or async config.
NestAngularSsrModule.forRootAsync({
  inject: [ConfigService],
  useFactory: (config: ConfigService) => ({
    routing: {
      browserAssetsDir: config.getOrThrow<string>('WEB_BROWSER_ASSETS_DIR'),
    },
  }),
});

Explicit Bootstrap Helper

Use this when you want explicit bootstrap wiring in main.ts.

import { NestFactory } from '@nestjs/core';
import {
  FastifyAdapter,
  type NestFastifyApplication,
} from '@nestjs/platform-fastify';
import { bootstrapNestAngularSsr } from '@anarchitects/nest-angular-ssr';

import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create<NestFastifyApplication>(
    AppModule,
    new FastifyAdapter(),
  );

  app.setGlobalPrefix('api');

  await bootstrapNestAngularSsr(app, {
    routing: {
      browserAssetsDir: 'dist/apps/web/browser',
    },
  });

  await app.listen(3000, '0.0.0.0');
}

void bootstrap();

BootstrapNestAngularSsrOptions keeps two explicit groups:

  • integration: renderer injection or request-context customization
  • routing: browser assets directory and optional API-prefix override

Advanced Composition

Use the lower-level APIs only if the module or bootstrap helper is too opinionated for your app:

  • createAngularSsrRenderer(...)
  • AngularNodeSsrRenderer
  • createNestAngularSsrIntegration(...)
  • registerNestAngularSsrRoutes(...)

These APIs keep the public boundary small:

  • SSR core stays on Web Request / Response
  • Nest integration is Fastify-only in v1
  • routing and bootstrap remain explicit concerns

Existing Option Shapes

  • AngularNodeSsrRendererOptions
    • engine?: AngularNodeAppEngine
    • engineOptions?: AngularNodeAppEngineOptions
  • CreateNestAngularSsrIntegrationOptions<TContext>
    • renderer?: AngularSsrRenderer<TContext>
    • rendererOptions?: AngularNodeSsrRendererOptions
    • createRequestContext?: (request, reply) => TContext | Promise<TContext>
  • RegisterNestAngularSsrRoutesOptions
    • browserAssetsDir: string
    • apiPrefix?: string
  • BootstrapNestAngularSsrOptions<TContext>
    • integration?: CreateNestAngularSsrIntegrationOptions<TContext>
    • routing: RegisterNestAngularSsrRoutesOptions
  • NestAngularSsrModuleOptions<TContext>
    • alias of BootstrapNestAngularSsrOptions<TContext>

The mutually exclusive pairs are enforced in code:

  • renderer engine vs engineOptions
  • integration renderer vs rendererOptions

Constraints and Non-Goals

v1 intentionally does not do the following:

  • support Express or non-Fastify Nest adapters
  • use ServeStaticModule
  • add hidden auto-bootstrap outside the Nest module lifecycle or explicit helper call
  • claim support for every Nest/Angular deployment shape
  • recreate legacy Universal APIs exactly

This package is intentionally scoped to modern Angular SSR on Nest + Fastify.