Practice Hub /
E-Commerce & ScaleHard~40 min interview roundFlipkartAmazonMyntra

High-Scale E-Commerce Storefront & Cart (Flipkart / Amazon)

Architect a conversion-focused e-commerce storefront with SSR/Partial Hydration, Core Web Vitals optimization (LCP/INP/CLS), SWR caching, and optimistic cart sync.

1. Interactive System Architecture Diagram

Click any architecture component below to inspect its exact responsibilities and trace connected data flows.

SSR + Hero Img Cart Actions SWR + Multi-Tab BFF + Checkout Storefront Shell SSR + Islands Hydration Cart & Checkout Store Optimistic Reconciliation SWR Data Cache Catalog vs Live Stock BFF / Edge API Idempotent Cart & Checkout Edge SSR & CDN ISR + Product Media
Selected ComponentStorefront Shell — SSR + Islands Hydration
  • Streams static product description, price, and hero HTML immediately from SSR.
  • Hydrates only interactive islands (`Add to Cart`, `Size Picker`, `Filters`) -> tiny JS payload!
  • Locks product hero image dimensions + font `font-display: swap` fallback for zero CLS.

2. Interactive Trade-Off Simulator

Toggle between real architectural options to compare Pros, Cons, and exactly when to pick each choice in interviews.

Rendering Strategy

Which rendering model maximizes SEO rankings AND Core Web Vitals for product pages?

Pros

  • Search engines index complete HTML immediately while LCP hero paints before heavy JS downloads.
  • Partial / deferrable hydration keeps Interaction to Next Paint (INP) fast on budget phones.

Cons & Pitfalls

  • Requires careful browser-only guards (`isPlatformBrowser`) so SSR never crashes.
Interview Rule of Thumb: Pick SSR/ISR + Selective Hydration for public SEO-driven storefronts.
Inventory & Pricing Integrity

How should cart totals and sudden price/stock changes behave before checkout?

Pros

  • Tapping "+" feels instantaneous while backend PATCH validates stock and recalculates totals.
  • Shows clear inline alert if coupon expired or only 1 unit left in warehouse.

Cons & Pitfalls

  • Requires clean rollback UI state if server rejects with 409 Conflict.
Interview Rule of Thumb: Always compute authoritative money, tax & stock on backend with optimistic UI.

3. RADIO Framework Breakdown & Interview Checklist

Review each RADIO pillar cleanly and check off sections as you master them.

0 / 5 Sections Reviewed
R

Requirements & Scope

  • Functional: Faceted filter URLs, instant variant picker, persistent multi-tab cart, safe checkout.
  • Non-Functional: LCP < 2.0s, INP < 200ms, CLS < 0.05, zero double-payment submissions.
A

Architecture Components

  • Edge CDN/SSR streams above-the-fold product HTML; below-the-fold Reviews/FAQ use `@defer` / lazy hydration.
  • BFF aggregates catalog + delivery SLA in 1 call; URL query params hold filter state cleanly.
D

Client Data Model

  • `CartState: { items: CartItem[], subtotalPaise: number, couponCode?: string, version: number }`
  • Store money in integer smallest unit (`paise` / `cents`) to eliminate floating-point bugs (`0.1 + 0.2`).
I

Interface & API Contracts

  • `PATCH /api/v1/cart/items/:sku` -> `{ qty }` returns full server-computed cart totals.
  • `POST /api/v1/orders` with `Idempotency-Key: <uuid>` ensures retry network hiccups never charge twice.
O

Performance & Optimizations

  • Set `fetchpriority="high"` on LCP product hero image; lazy-load carousel images 2+ onward.
  • Keep review/recommendation lists out of critical render bundle via route/viewport splitting.
  • Reserve skeleton boxes (`min-height`) for dynamic price/ETA strips so CLS remains ~0.