perf: reduce SSR HTML payload by serving page tree via cacheable API
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 1
- Avg merge
- 12h 29m
- Merged PRs (30d)
- 12
Description
Problem
Every SSR response embeds the full site config + page tree in a <script> tag via window.__PAGE_DATA__. On large doc sites this can be 30-100KB+ of JSON per page load, with no HTTP caching (no ETag/Last-Modified/304 support).
Current Behavior
entry-server.tsx serializes config, tree, slug, version, frontmatter, relativePath, originalPath, prev, next into every HTML response.
Suggested Approach
- Serve the page tree and config via a cacheable
/api/treeendpoint with ETag support - Only embed the minimal per-page data (slug, frontmatter, prev/next) in SSR HTML
- Add
Cache-Control/ETagheaders to SSR responses for unchanged pages
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in entry-server.tsx, where config, tree, and per-page fields are serialized into SSR HTML, and trace how this data reaches the client. Define the /api/tree response and caching behavior, then verify that SSR HTML retains only per-page data and unchanged responses expose Cache-Control and ETag behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, performance, web-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100