angular / angular/angular-cli

Angular 19 SSR/hybrid rendering engine: cross-request cache

Open
#30,305 4 comments 29 reactions 0 assignees View on GitHub
area: @angular/ssr feature feature: under consideration
Dominant language
TypeScript
Stars
27k
Forks
11.8k
Avg merge
14h 23m
Merged PRs (30d)
162

Description

### Command

run

### Description

It would be a useful optimization to cache some requests during SSR across requests to the SSR server. Some of the API requests have infrequently changing data. Pulling the response from cache would save a lot of network time, especially if the response is big.

Flow:
User 1 makes makes request to Angular SSR server -> SSR makes requests to API in order to gather data for rendering -> request gets cached -> user 1 receives an html response.
User 2 makes request to Angular SSR server -> SSR server would make API request in order to gather data, but instead pulls the response from the cache -> user 2 receives an html response.

One possible implementation would be to consider Cache-Control header and cache the response in the server for the time specified.

If this will not be considered - what would you say is the best approach in order to optimize these kind of API requests? Perhaps a wrapper around `global.fetch` in Node server (where Angular engine runs) which would monitor every API request and store in some local cache?

### Describe the solution you'd like

_No response_

### Describe alternatives you've considered

_No response_

Contributor guide

Open the contributing guide

Research direction

No files, tests, or concrete entry points are named. Start by tracing the Angular SSR/hybrid rendering request path in the Node server and reviewing how global.fetch is used; define cache scope, expiration, and Cache-Control behavior before implementation. Done would require an agreed design, implementation, and coverage for cross-request caching.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, node.js, typescript
Domain
backend, performance, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.