An online store prerenders its catalogue and help pages but client-renders cart, checkout and order history; what seams does that mix create, and how would you design them?
answer
- where two render paths meet
- shared copies carry no shopper data
- crossing the boundary: document or client navigation
- who decides the status code
- old pages, new scripts after a deploy
basics
~10 sMixing modes creates seams: shopper data on shared pages, navigation between render paths, status codes from a client-rendered area, protection of account data, and builds of different ages. Each seam needs an explicit design.
solid answer
~50 sThe mix is right, but its seams need designing. The header on a prerendered page cannot carry the signed-in name or cart count, so it ships a neutral slot with reserved space that the browser fills after load. Links across the boundary are full document navigations, and the client router owns only the account and cart routes. The client-rendered area answers `200` with its shell for any path under its prefix, so a missing order is a screen, not a real `404`; unknown paths outside that prefix still get a server `404`, and account pages stay out of the index. Account data is protected by the API checking the session on every call, never by the page. Finally, prerendered pages built at different times load shared scripts and call the same API, so earlier builds' assets stay available and API changes stay backward-compatible across a deploy.
go deeper
Remember that a prerendered page is one copy shown to everyone, so it cannot contain anything that belongs to one shopper.
Explain how a shared page gets per-visitor details after load, and why a static client-rendered shell cannot report a real 404 for a missing record.
List the seams a mixed-mode store creates - shared pages, navigation, status codes, protection, build age, shared components - and give each a concrete design.
Decide which seams belong to a central owner when page types are split across teams, and how deploys keep pages of different ages working.
## Why mix at all An online store's page types want different things. Catalogue and help pages are shared and must be found by search, so prerendered HTML suits them. The cart, checkout and order history are personal, never indexed and interaction-heavy, so rendering them in the browser behind sign-in suits them. Published rendering guidance treats this hybrid as normal: you can render some pages on the server and not others. A **seam** is a place where the two render paths meet and an assumption that holds on one side breaks on the other. Seams do not go away by ignoring them; they go away by being designed. ## The seams at a glance | Seam | What goes wrong if ignored | Design | |---|---|---| | Shopper data in shared pages | one shopper's name or cart reaches others, or a guessed value flashes | neutral slot with reserved space, filled in the browser | | Navigation across the boundary | the client router tries to render a page it has no data path for | document navigation across the boundary | | Status codes | a missing order answers `200`; unknown URLs look valid | server `404` outside the client prefix; account area kept unindexed | | Protecting account data | hidden routes mistaken for security | the API checks the session on every call | | Builds of different ages | an old page calls a script or API shape that is gone | keep earlier assets; backward-compatible API changes | | Shared components | the header and product card render differently per path | components that render the same on server and in browser | ## Shared pages, personal data A prerendered page is one copy served to everyone, so it must contain nothing that belongs to one visitor. The header therefore ships an empty, fixed-size slot for the account link and cart count, and a small script fills it from the API after load. Reserving the size matters: a slot that grows when the count arrives shifts the layout, and layout shift has its own target (CLS of 0.1 or less). This is also why the cart and checkout must never be produced as shared copies. ## Navigation across the boundary - **Inside the account area**, client-side navigation is fine: the router owns those routes and fetches their data from the API. - **From the account area to a product page**, use a normal document navigation. The prerendered page is already built; asking the client router to render it would need a second data path for catalogue pages. - **From the catalogue into the cart**, a document navigation loads the client-rendered app shell, which can be cached because it holds no data. ## Status codes, protection and caching - The client-rendered shell is served like a static file, without looking the order up, so its status is decided before the browser has asked the API anything. A missing order therefore shows a not-found screen while the document says `200`; only a server that does the lookup itself could answer `404`. - Keep that weakness contained: the client router owns only a known prefix, and every other unknown URL gets a real server `404`. Crawler guidance recommends meaningful status codes, such as `404` for missing pages and `401` for pages behind a login. - Account pages are not for search, so keeping them out of the index costs nothing. - **Protection lives in the API.** Hiding routes or omitting them from menus protects nothing; each order request is authorised against the session. - The account shell may be cached like any static file; the data it fetches never enters a shared cache. ## Keeping two render paths in step 1. **Keep earlier builds' assets available after a deploy.** A product page regenerated an hour ago references the script files of the build that made it; if those files vanish, its buy box breaks. 2. **Change shared APIs additively.** Old prerendered pages and the new client app call the same cart API during the deploy window, so add fields before relying on them and remove them only after nothing reads them. 3. **Build shared components for both paths.** The header, product card and price format must render identically on the server and in the browser, or shoppers see the page change as they cross the boundary. 4. **Give the seams one owner.** When the catalogue and the account area belong to different teams, the header, session handling and status rules belong to neither unless someone is named. The mix is still the right call; it just turns one hidden assumption into a short list of explicit decisions.
- Would you rather render the account area per request on the server instead?It is defensible: real status codes for missing orders, content in the first response, one fewer client-only path. The costs are server work on every account view, a strict rule that none of those responses enter a shared cache, and the account area still needs script for its interactions. I would choose it if order pages had to be shareable or the status-code gap caused real problems; otherwise browser rendering behind sign-in is simpler.
- After a deploy, shoppers on product pages regenerated earlier get an error when they press add to cart. What happened?Those pages were built by the previous release: they load its script files and send the old request shape to the cart API. If the deploy deleted the old assets or changed the API incompatibly, the old pages break until they are regenerated. Keep previous builds' assets available, change the API additively across the deploy window, and regenerate pages that embed build-specific references.
- A prerendered page can safely include the signed-in shopper's name
- A static client-rendered shell can report a real 404 for a missing order
- Hiding account routes from menus keeps other shoppers' orders private
- Once each page has its own mode, mixing modes costs nothing more
- Delete the previous build's script files as soon as a deploy finishes