π€ Angular SSR for bots, prebuilt CSR shell for humans. Faster page loads for users, fully prerendered HTML for Googlebot, Bingbot, Yandex, ClaudeBot, GPTBot and link unfurlers.
Angular SSR for bots, prebuilt CSR shell for humans. Faster page loads for users, fully prerendered HTML for Googlebot, Bingbot, Yandex, ClaudeBot, GPTBot and link unfurlers.
Powered by isbot .
Why
Angular SSR is great for crawlers and great in the readme β but in production, every real user pays for it: SSR HTML arrives, hydrates, and re-renders. Users see a flash, click handlers don't fire until hydration completes, and Time to Interactive is worse than a CSR-only build for sites with any meaningful JS.
Meanwhile, the bots that actually need server-rendered HTML β Googlebot, Bingbot, Yandex, Facebook/Twitter unfurlers, ClaudeBot, GPTBot, PerplexityBot β execute little or no JavaScript. Shipping them the CSR shell means empty meta tags, empty link previews, and weak indexing.
ngx-bot-ssr switches the response based on the User-Agent:
- Real browsers β static
index.csr.htmlshell, Angular bootstraps client-side, no hydration flicker - Bots / crawlers / unfurlers / missing UA β Angular SSR via
AngularNodeAppEngine.handle(), fully prerendered HTML
Sets Vary: User-Agent so any upstream cache (CDN, Varnish, Cloudflare) keeps the two responses separate.
The Angular community has been asking for this for years:
- angular/angular#52360 β "skip Client App Initialization for Google/Bing Crawlers/Bots"
- angular/universal-starter#536 β "Is it possible to use SSR only for bots/crawlers?"
Install
yarn add ngx-bot-ssr
# or
npm install ngx-bot-ssrexpress is a peer dependency. You almost certainly already have it via @angular/ssr.
Usage β Angular SSR (the easy way)
In your Angular SSR project's src/server.ts, replace the catch-all app.use((req, res, next) => angularApp.handle(req)...) block with angularBotSsr(...). Three lines, no glue code:
import {
AngularNodeAppEngine,
createNodeRequestHandler,
isMainModule,
writeResponseToNodeResponse,
} from '@angular/ssr/node';
import express from 'express';
import { join } from 'node:path';
import { angularBotSsr } from 'ngx-bot-ssr';
const browserDistFolder = join(import.meta.dirname, '../browser');
const app = express();
const angularApp = new AngularNodeAppEngine();
// Static assets first (CSR JS, images, fonts)
app.use(express.static(browserDistFolder, {
maxAge: '1y',
index: false,
redirect: false,
}));
// Bots β SSR, humans β CSR shell. That's it.
app.use(angularBotSsr({
browserDistFolder,
angularApp,
writeResponseToNodeResponse,
}));
if (isMainModule(import.meta.url) || process.env['pm_id']) {
const port = process.env['PORT'] || 4000;
app.listen(port, () => console.log(`listening on http://localhost:${port}`));
}
export const reqHandler = createNodeRequestHandler(app);Build with ng build (which already produces index.csr.html), run the SSR server, and:
curl -H 'User-Agent: Googlebot/2.1' http://localhost:4000/β fully prerendered Angular HTMLcurl -H 'User-Agent: Mozilla/5.0 (...) Chrome/...' http://localhost:4000/β CSR shell, ~1 KB
Why pass
writeResponseToNodeResponseandangularAppin?@angular/ssr/nodeis ESM-only, so the package can'trequire()it from a CJS module. Passing them in keepsngx-bot-ssrframework-agnostic at the core (Hono, raw Web fetch handlers, etc. all work) while still giving the Angular case a one-call API.
API β angularBotSsr(options)
const { angularBotSsr } = require('ngx-bot-ssr');
// or: import { angularBotSsr } from 'ngx-bot-ssr';
app.use(angularBotSsr(options));| Option | Required | Description |
|---|---|---|
browserDistFolder | Absolute path to your Angular dist/.../browser/ folder. The CSR shell is read from ${browserDistFolder}/index.csr.html unless shell is set. | |
angularApp | An AngularNodeAppEngine instance from @angular/ssr/node. | |
writeResponseToNodeResponse | Imported from @angular/ssr/node. | |
shell | β | Override the shell path if your CSR file lives elsewhere. |
isBot | β | (userAgent: string | undefined) => boolean. Override the default detection. |
shellCacheControl | β | Cache-Control header for the CSR shell. Defaults to 'no-cache'. |
API β botSsr(options) (low-level, framework-agnostic)
Use this if you're not on Angular β Hono, plain fetch-style handlers, anything that returns a Web Response works.
const { botSsr } = require('ngx-bot-ssr');
app.use(botSsr({
shell: '/abs/path/to/index.csr.html',
ssr: (req) => myEngine.handle(req), // β Promise<Response | null | undefined>
writeResponse: (response, res) => { /* serialize Web Response β Node res */ },
// optional:
isBot, // (ua) => boolean
shellCacheControl, // string
}));| Option | Required | Description |
|---|---|---|
shell | Absolute path to the CSR shell HTML. Read once at construction (boot-time sync I/O is fine). | |
ssr | (req) => Promise<Response | null | undefined>. Returning null/undefined calls next(). | |
writeResponse | (response, res) => void. Serializes the Web Response into the Node res. | |
isBot | β | (userAgent) => boolean. Default uses isbot and treats missing UAs as bots. |
shellCacheControl | β | Default 'no-cache'. |
How it works
request
β
βΌ
ββββββββββββββββββββββββββ
β Vary: User-Agent β
ββββββββββββββββββββββββββ
β
isBot(req.UA)?
ββββββββ΄βββββββ
β β
true false
β β
βΌ βΌ
options.ssr send shell
β (read once
βΌ at boot)
Response | null
β
ββββββββ΄βββββββ
β β
Response null/undef
β β
βΌ βΌ
writeResponse next()Treats missing UAs as bots β safer to prerender than to ship the CSR shell to an unknown client.
Reference reading
- Adnan Ebrahimi β switch SSR/CSR by user agent
- baunov gist
- dsimmons on Medium β Frustrated with Angular Universal SSR
- Infinum handbook β robots and sitemap
Credits
isbotby Omri Lotan β the bot detection library this package wraps. Updated continuously, covers the long tail of crawlers, AI bots, and link unfurlers.- Pattern originally extracted from
corifeus-app-web-pages.
Meet Assistant SaaS β meeting.corifeus.com
Don't want to install anything? Try the hosted version at meeting.corifeus.com β full meeting workflow built for European businesses, no setup, no API key, no command line.
What the hosted version offers:
- 21-language live translation during the meeting
- AI summaries, action items, decisions, attendees, key quotes auto-generated after every meeting
- Custom vocabulary β your client / company / industry terms corrected automatically (Pro+ tier)
- Searchable meeting library β find any decision or promise across all your past meetings
- Shareable read-only links β send a clean meeting summary to a client or teammate, no signup needed on their end
- One-click email summary after each meeting
- Premium engine on every plan β no downgraded model, ever
- EU billing β Stripe Tax + VAT-compliant + EUR-priced (Solo β¬19.99 / Pro β¬39.99 / Business β¬99.99 per month, no lock-in)
- GDPR-compliant by default β browser-language auto-detection, no tracking cookies, your meetings stored encrypted
Try the live demo (1 minute free, no signup) or browse the public sample meeting at meeting.corifeus.com/sample .
Corifeus Network
AI-powered network & email toolkit β free, no signup.
Web Β· network.corifeus.com MCP Β· npm i -g p3x-network-mcp
- AI Network Assistant β ask in plain language, get a full domain health report
- Network Audit β DNS, SSL, security headers, DNSBL, BGP, IPv6, geolocation in one call
- Diagnostics β DNS lookup & global propagation, WHOIS, reverse DNS, HTTP check, my-IP
- Mail Tester β live SPF/DKIM/DMARC + spam score + AI fix suggestions, results emailed (localized)
- Monitoring β TCP / HTTP / Ping with alerts and public status pages
- MCP server β 17 tools exposed to Claude Code, Codex, Cursor, any MCP client
- Install β
claude mcp add p3x-network -- npx p3x-network-mcp - Try β "audit example.com", "why do my emails land in spam? test me@example.com "
- Source β patrikx3/network Β· patrikx3/network-mcp
- Contact β patrikx3.com Β· donate
Support Our Open-Source Project
If you appreciate our work, consider starring this repository or
making a donation to support server maintenance and ongoing development. Your support means the world to usβthank you!
About My Domains
All my domains, including patrikx3.com , corifeus.eu , and corifeus.com, are developed in my spare time. While you may encounter minor errors, the sites are generally stable and fully functional.
Versioning Policy
Version Structure: We follow a Major.Minor.Patch versioning scheme:
- Major:
Corresponds to the current year.
- Minor:
Set as 4 for releases from January to June, and 10 for July to December.
- Patch:
Incremental, updated with each build.
Important Changes: Any breaking changes are prominently noted in the readme to keep you informed.
NGX-BOT-SSR Build v2026.4.106