Part VI — The Blueprint · Lesson 11.3
HLD – E-commerce App (Amazon, Flipkart)
In one lineDifferent pages need different rendering strategies — that decision is the whole design.
Where you've seen itA product page indexed by Google in seconds, and a cart that's wrong the moment it's served from a cache.
Diagram
| Step 1–2 | Scope and scale |
|---|---|
| In scope | home · category · search · product · cart · checkout |
| Out of scope | seller portal · reviews moderation · logistics |
| Scale | 100M products · 10M DAU · huge SEO dependency · traffic spikes 20× on sale days |
Lessons in this diagram5.6 Rendering Patterns6.7 HTTP Caching
Lessons in this diagram6.2 Local Storage6.9 API Caching5.2 Performance Importance
6b · DEEP DIVE — PRICE AND STOCK FRESHNESS
problem the page is cached for SEO, but price must be current
solve render page shell + product copy from cache (fast LCP)
fetch /api/price-stock?ids=… on mount (always fresh)
re-validate ONCE MORE at checkout (authoritative)
Never trust a cached price at payment time — always re-check
server-side before charging (3.5).How it works
- Split by route — SEO pages static or ISR at the edge, per-user pages client-rendered.
- Islands for dynamic bits so a cacheable page can still show live price and stock.
- Cart starts local for guests, merges on login, and becomes server-owned after that.
- Checkout is
no-store, network-only, with idempotency keys on the order request (1.5). - Search is SSR with cursor pagination and faceted filters kept in the URL (6.10).
Trade-offs
| Choice | Cost |
|---|---|
| ISR for product pages | Stale copy text until revalidation |
| Client-fetched price | An extra request; brief price skeleton |
| Guest cart in localStorage | Merge complexity at login |
| Optimistic add-to-cart | Rollback UI when stock runs out |
Interview angle
"Why not just SSR the whole site?"
- Product and category pages are identical for everyone — rendering them per request wastes capacity that matters on sale days.
- ISR at the edge gives the same SEO and a better LCP, with a client island keeping price and stock accurate.
- Cart and checkout are per-user and must never be cached, so those stay client-rendered with
no-store.
Recap
- The design is the per-route rendering decision.
- Cache the page, fetch the price — islands keep SEO and accuracy together.
- Guest cart merges on login; the server owns it afterwards.