Frontend School
DashboardProblemsLearnPracticeMock InterviewReportsStatsBuy Credits
DashboardProblemsLearnPracticeMock Interview
Frontend System Design Roadmap
  1. 1.HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)
  2. 2.TCP and TLS Handshakes: Connection Setup Costs
  3. 3.Browser Network Stack and Connection Pooling
  4. 4.GET vs POST and Idempotency in HTTP
  5. 5.The Critical Rendering Path (CRP)
  6. 6.DOM, CSSOM and the Render Tree
  7. 7.Layout, Paint and Compositing
  8. 8.Reflows and Repaints Explained
  9. 9.Event Loop: Call Stack, Task and Microtask Queues
  10. 10.Async JavaScript: Promises and async/await
  11. 11.Web Workers: Multi-threading in the Browser
  12. 12.Browser Storage: Cookies, Web Storage, IndexedDB
  13. 13.Client-Side Storage: Limits and Security Risks
  14. 14.Choosing the Right Client-Side Storage
  15. 15.HTTP Caching: Cache-Control, ETag, Last-Modified
  16. 16.Browser-Level Caching Mechanisms
  17. 17.Cache Invalidation for Frontend Apps
  18. 18.Structuring a Large Single-Page App
  19. 19.Component-Based Architecture Principles
  20. 20.Props, State and Component Lifecycle
  21. 21.Module Bundling Basics
  22. 22.Core Web Vitals: LCP, INP and CLS
  23. 23.FCP and Time to Interactive (TTI) Explained
  24. 24.Measuring Performance: Lighthouse and WebPageTest
  25. 25.Asset Compression and Minification Basics
  26. 26.What Is a CDN and How Does It Work?
  27. 27.CDN Benefits: Latency, Availability, Offload
  28. 28.CDN Cache Behavior and Invalidation
  29. 29.Global State vs Local Component State
  30. 30.State Patterns: Redux, Zustand and Context
  31. 31.Data Fetching: React Query and SWR
  32. 32.Immutable Data in Frontend State
  33. 33.SSR vs CSR: Rendering Trade-offs
  34. 34.Hydration and Time to First Byte (TTFB)
  35. 35.Static Site Generation (SSG) for Speed and SEO
  36. 36.Incremental Static Regeneration (ISR)
  37. 37.Micro-Frontends: Core Principles
  38. 38.Micro-Frontend Integration Strategies
  39. 39.Communication Between Micro-Frontends
  40. 40.Micro-Frontends: Pros and Cons for Large Teams
  41. 41.Real-Time: Polling, SSE and WebSockets
  42. 42.Real-Time Use Cases: Chat, Alerts, Live Data
  43. 43.Designing a Real-Time Data Flow
  44. 44.Scaling WebSocket Connections
  45. 45.Responsive Images: srcset, sizes and picture
  46. 46.Modern Image Formats: WebP, AVIF, JPEG XL
  47. 47.Lazy Loading Images and Videos
  48. 48.Video Streaming: HLS, DASH, Adaptive Bitrate
  49. 49.REST and GraphQL for Frontend Engineers
  50. 50.Batching, Throttling and Debouncing API Calls
  51. 51.Handling API Errors in the Frontend
  52. 52.Authentication Flows: OAuth and JWT
  53. 53.Global Error Boundaries in React
  54. 54.Error Reporting: Sentry and LogRocket
  55. 55.Graceful Degradation and Fallback UIs
  56. 56.Real User Monitoring (RUM)
  57. 57.CORS: Cross-Origin Resource Sharing
  58. 58.Preventing XSS (Cross-Site Scripting)
  59. 59.CSRF Protection for Frontend Apps
  60. 60.Content Security Policy (CSP)
  61. 61.Storing Auth Tokens: Cookies vs localStorage
  62. 62.PWA Manifest and Installability
  63. 63.Service Workers: Lifecycle and Caching Strategies
  64. 64.Offline Support and Background Sync
  65. 65.Push Notifications for Web Apps
  66. 66.Webpack vs Vite vs Parcel
  67. 67.Code Splitting, Tree Shaking, Asset Optimization
  68. 68.Module Resolution and Hot Module Replacement
  69. 69.Monorepo Tooling: Nx and Lerna
  70. 70.Atomic Design for Component Libraries
  71. 71.Theming and Customization in Design Systems
  72. 72.Accessibility in Component Libraries
  73. 73.Component Library Docs, Testing and Versioning
  74. 74.Publishing and Consuming a Component Library
  75. 75.Full-Text Search: Levenshtein and Fuzzy Matching
  76. 76.Indexing Large Datasets in the Browser
  77. 77.Search Performance: Debouncing and Web Workers
  78. 78.Integrating Backend Search Services
  79. 79.Choosing a Chart Library: D3, Chart.js, Recharts
  80. 80.Rendering Large Datasets: Canvas vs SVG
  81. 81.Interactive, Responsive Data Visualizations
  82. 82.Data Fetching and Aggregation for Dashboards
  83. 83.A/B Test Design and Rollout Strategies
  84. 84.Client-Side vs Server-Side A/B Testing
  85. 85.Feature Flags and Remote Configuration
  86. 86.Experiment Data Collection and Analytics
Frontend System Design Roadmap
36

Frontend System Design · Lesson 36 of 86 · 4 min

Incremental Static Regeneration (ISR)

This is how you explain getting the speed of a static site with the freshness of a server-rendered one. It shows you can make nuanced architectural trade-offs.

How to Explain the Stale-While-Revalidate Flow

ISR lets you update static pages after they've been built. It works by serving a cached (stale) page instantly, while regenerating a fresh one in the background.

This strategy is called "stale-while-revalidate". When a request comes in for a page:

  1. If a fresh, cached version exists, it's served immediately from the CDN.
  2. If the cached version is stale (older than the revalidate time), the stale version is still served immediately. The user gets a fast response.
  3. Simultaneously, a background process kicks off to re-fetch data and render a fresh page.
  4. Once complete, the cache is updated. The next visitor gets the new version.

This avoids a full site rebuild for content changes and keeps user-facing performance high by never making a user wait for a server-side render on a stale page.

When to Use ISR (and When Not To)

Use ISR for content that needs to be fresh, but not real-time. The goal is "eventual consistency."

Good candidates:

  • E-commerce product pages: Prices or stock levels change, but not every second. A 5-10 minute revalidate window is often acceptable.
  • Blog posts or news articles: Allows for fixing typos or adding updates without a full redeploy.
  • Marketing pages with CMS-driven content: A/B test copy can be updated without developer intervention.

Bad candidates:

  • Stock tickers or live sports scores: The data is useless if it's even a few seconds old. Use client-side fetching with WebSockets or streaming.
  • User-specific dashboards: This content is unique per user and cannot be statically cached. Use SSR or CSR.

In an interview, frame this as a business decision. A revalidate of 60 seconds for a blog post is fine. For e-commerce stock levels, 300 seconds might be too long and lead to overselling. The "right" number depends on the business impact of stale data.

How to Configure Revalidation and Fallbacks

In Next.js, you enable ISR by returning a revalidate key in getStaticProps.

// pages/posts/[id].tsx
import { GetStaticProps, GetStaticPaths } from 'next';

interface Post {
  id: string;
  title: string;
  content: string;
}

export const getStaticPaths: GetStaticPaths = async () => {
  // Pre-build the first 10 posts for speed.
  // const posts = await fetchTop10Posts();
  // const paths = posts.map(post => ({ params: { id: post.id } }));
  
  return {
    paths: [ { params: { id: '1' } }, { params: { id: '2' } } ],
    // Other post IDs will be generated on-demand.
    fallback: 'blocking',
  };
};

export const getStaticProps: GetStaticProps = async (context) => {
  const { id } = context.params;
  const res = await fetch(`https://api.example.com/posts/${id}`);
  const post: Post = await res.json();

  if (!post) {
    return {
      notFound: true,
    };
  }

  return {
    props: {
      post,
    },
    // Revalidate this page at most once every 60 seconds.
    revalidate: 60,
  };
};

export default function PostPage({ post }: { post: Post }) {
  // Render post...
  return <h1>{post.title}</h1>;
}

The other critical piece is the fallback property in getStaticPaths. It determines how to handle pages that weren't pre-built at build time.

  • fallback: false: Any path not pre-generated returns a 404. This is pure SSG; no new pages can be added without a rebuild.
  • fallback: true: Serves a fallback version of the page (e.g., a loading spinner) on the first request. The browser then fetches the JSON from a client-side call and renders the page. Good for UX if you have a nice loading state, but requires extra client-side work.
  • fallback: 'blocking': The user's browser "waits" for the initial page to be generated on the server (like SSR). Subsequent requests serve the cached static page. This is simpler to manage than fallback: true and better for SEO, as the crawler sees the full content on the first visit.

The trap: Candidates often forget about fallback. Without fallback: 'blocking' or fallback: true, your site can't generate new pages (like a newly published blog post) on the fly. You're just revalidating the pages that existed at build time.

The Trade-offs vs. SSG and SSR

Choosing ISR means you've considered the alternatives. Here's how to articulate the comparison.

  • vs. SSG: ISR offers better data freshness. The cost is slightly more infrastructure complexity (a running Node.js server environment is needed for revalidation) and the potential for serving stale data for a short period. Pure SSG is simpler and faster if content rarely changes.
  • vs. SSR: ISR is much more scalable. Pages are served from a CDN edge, which is cheaper and faster than hitting a server-side render function for every single request. The trade-off is that content is not real-time; there's always a revalidation delay. SSR is for when every request must have the absolute latest data.

You're trading real-time freshness for a massive performance and scalability gain.

Try it

Create a new Next.js page that uses getStaticProps to fetch and display the current time from an API (like worldtimeapi.org). Set revalidate: 10. Deploy it to Vercel. Refresh the page every couple of seconds and watch how the displayed time only updates after the 10-second window has passed and a new request comes in.

Next: In Micro-Frontends: Core Principles, we'll look at how to break up the frontend itself into independently deployable pieces.

Lock it in — apply this lesson under interview conditions.

Try a free mock interviewPractice system design problems
Previous

Static Site Generation (SSG) for Speed and SEO

Next

Micro-Frontends: Core Principles