wealth/docs/decisions/0070-render-every-page-exce...

27 lines
2.0 KiB
Markdown

# 0070 Render every page except the landing in the browser
Status: Accepted · Area: architecture · Date: 2026-10-21 · Decided by: user · Supersedes: 0021, 0045, 0055
## Context
A creator can announce a post for a set time, and tens of thousands of visitors may open the same channel or post at once. Each server render of a channel cost five back-end reads, a post four. The user wants the Next.js servers free of that pressure, and accepts losing search results and rich link previews for channels and posts.
## Decision
- The landing (`/`) is the only page whose content the server renders, all of it in the first flush, with no `loading.tsx`.
- Every other page renders its content in the browser, for guests and members alike. The server reads no back-end data: it sends the frame, a same-size skeleton, and the metadata. This now includes `/channels/[username]`, `/channels/[username]/posts/[id]`, `/checkout/[username]` and `/analysts`.
- Channel and post pages are `noindex` and keep a `loading.tsx`. Their `generateMetadata` reads only the URL's params; every other page exports static `metadata`.
- The server still checks a URL's shape without reading data: a username in another spelling answers 308, a malformed one 404.
## Alternatives
- Server-render the channel header and post text from one back-end-cached read (hybrid): keeps link previews and SEO for one cache hit per request. The user chose to keep the server free of reads.
- Server metadata only (one read per request) so link previews name the channel: rejected for the same reason.
## Consequences
- The back-end load stays: the same reads now come from browsers, with the session's cookies. The back end needs its own cache for public reads before a spike.
- Shared channel and post links show the generic site card, and search engines index no channel or post content.
- Channel and post content paints later on a first visit: after the JavaScript, then the read.
- A missing channel or post answers 200, and its not-found state renders in the browser.