Frontend System Design Interview Prep

50+ Frontend System Design Interview Questions

Senior-level system design interview prep covering rendering strategies, microfrontend architecture, bundle optimization, caching, authentication, security, state management, and Core Web Vitals. Questions asked at Google, Meta, Stripe, Shopify, Atlassian, Razorpay, Flipkart and other top tech companies.

🚀 Practice Now — It's Free🏗️ Browse All Topics📖 Deep-Dive Blogs
59+
Questions
10
Categories
0+
Companies
0+
With Code

All Questions by Category

Authentication6

beginnerWhat are the security differences between storing a JWT in localStorage vs an HttpOnly cookie?coreWhat is refresh token rotation and why is it important?coreWhat is OAuth 2.0 PKCE and when should you use it?beginnerWhat is the difference between authentication and authorization?coreWhat is SSO (Single Sign-On) and how is it implemented on the frontend?advancedHow would you implement silent token refresh in a SPA?

Bundle Optimization6

beginnerWhat is tree shaking and what conditions must be met for it to work?beginnerWhat is code splitting and how does dynamic import() enable it?coreHow do you analyze and diagnose large bundle sizes?coreWhat is vendor chunk splitting and why is it important for caching?advancedWhat is the module/nomodule pattern for differential serving?beginnerWhat is lazy loading and how does it apply to images and components?

Caching Strategies6

beginnerWhat is the Cache-Control header and what are its key directives?coreWhat is stale-while-revalidate and why is it a good default for HTML pages?beginnerWhat is content-based cache busting and how does it work?coreWhat caching strategies can a service worker implement?coreWhat is ETags and conditional requests, and when does the browser use them?advancedWhat is cache invalidation and why is it considered hard?

Core Web Vitals6

beginnerWhat are the three Core Web Vitals and what does each measure?coreWhat are the most common causes of poor LCP and how do you fix them?beginnerWhat causes CLS (Cumulative Layout Shift) and how do you fix it?coreWhat is INP (Interaction to Next Paint) and how does it differ from FID?coreHow do you measure Core Web Vitals in a production React app?advancedWhat techniques reduce INP on a React app with expensive renders?

Frontend Security6

beginnerWhat is XSS (Cross-Site Scripting) and how do you prevent it?beginnerWhat is CSRF and how do SameSite cookies and CSRF tokens prevent it?coreWhat is a Content Security Policy (CSP) and how does it work?beginnerWhat is clickjacking and how do you prevent it?coreWhat security HTTP response headers should every production frontend set?advancedHow do you protect a frontend app against dependency supply chain attacks?

Microfrontends6

beginnerWhat is a microfrontend and what problem does it solve?coreHow does Webpack Module Federation work?coreWhat are the main challenges of microfrontends in production?advancedHow do you share state between microfrontends?beginnerWhen should you NOT use microfrontends?coreWhat is Single-SPA and how does it differ from Module Federation?

Monorepo5

beginnerWhat is a monorepo and what are its advantages over a polyrepo setup?coreHow does Turborepo's caching work and what makes it fast?coreHow does Nx differ from Turborepo?beginnerWhat are pnpm workspaces and why are they preferred in monorepos?coreWhat are module boundary rules in Nx and why do they matter?

Network Optimization6

beginnerWhat is the difference between preload, prefetch, and preconnect?coreHow does HTTP/2 multiplexing improve performance over HTTP/1.1?coreWhat is the difference between defer and async on script tags?coreWhat is image optimization and what techniques does Next.js Image component apply?advancedWhat is the critical rendering path and how do you optimize it?coreWhat is TTFB (Time to First Byte) and what factors affect it?

Rendering Strategies6

beginnerWhat is the difference between CSR, SSR, SSG, and ISR?beginnerWhen would you choose SSR over SSG for a page?coreWhat is Streaming SSR and how does it improve perceived performance?coreWhat is hydration and what causes hydration mismatches?advancedWhat is partial hydration / islands architecture and why does it matter?coreWhat are the SEO implications of CSR vs SSR?

State Management6

beginnerWhat is the difference between server state and client state?coreWhen would you choose Zustand over Redux Toolkit?coreWhat is React Query's staleTime vs gcTime (cacheTime) and how do they interact?coreWhat is optimistic updating and how do you implement it with React Query?beginnerWhen should you use URL state instead of React state?advancedWhat are the performance pitfalls of React Context and how do you avoid them?

Core System Design Topics

Rendering StrategiesMicrofrontendsMonorepo (Nx & Turborepo)Bundle OptimizationCaching StrategiesAuthentication ArchitectureFrontend SecurityState ManagementNetwork OptimizationCore Web VitalsBrowse All Topics →

Frequently Asked System Design Questions

What is frontend system design?

Frontend system design is the discipline of architecting large-scale client-side applications. It covers decisions like rendering strategy (SSR/SSG/CSR), microfrontend architecture, state management patterns, bundle optimization, caching strategies, authentication, and performance. Senior engineers are expected to reason about trade-offs, not just implementation details.

What is the difference between SSR, CSR, SSG, and ISR?

CSR (Client-Side Rendering) delivers a blank HTML shell and renders everything in the browser — best for dashboards. SSR (Server-Side Rendering) generates HTML per request — best for SEO-critical, personalized pages. SSG (Static Site Generation) pre-builds HTML at deploy time — best for blogs and docs. ISR (Incremental Static Regeneration) is SSG with background revalidation — best for pages with infrequent data changes. Streaming SSR (React 18) streams HTML progressively, improving TTFB.

What are microfrontends and when should you use them?

Microfrontends split a monolithic frontend into independently deployable units owned by separate teams. Use them when your team is large (10+ frontend engineers), different parts of the app have different release cadences, or you need independent tech stack choices per domain. The main tools are Webpack Module Federation (runtime sharing), Single-SPA (framework-agnostic orchestration), and Nx/Turborepo (monorepo management). Avoid for small teams — the operational overhead outweighs the benefits.

What is Webpack Module Federation?

Module Federation is a Webpack 5 feature that lets one JavaScript application dynamically load code from another at runtime. A 'host' app consumes 'remotes' that expose modules. Dependencies like React can be marked singleton:true so they're shared rather than duplicated. This enables truly independent deployment — each microfrontend ships its own bundle and the host loads it at runtime without a build-time dependency.

How do you optimize bundle size in a frontend application?

Tree shaking eliminates dead code — requires ES module imports and sideEffects:false in package.json. Code splitting divides the bundle into chunks loaded on demand via dynamic import(). Route-based splitting is free in Next.js. Vendor chunks separate third-party libraries from app code for better cache reuse. Analyze with webpack-bundle-analyzer or Vite's rollup-plugin-visualizer. Also audit your dependencies — lodash-es vs lodash, date-fns vs moment, and replacing heavy polyfills with native APIs.

What is the difference between JWT and cookie-based authentication?

JWTs are self-contained tokens — the server validates them without a database lookup, making them stateless. Store JWTs in HttpOnly cookies (not localStorage) to prevent XSS. Cookie-based sessions store a session ID in a cookie and validate it against a server-side store. The key trade-off: JWTs can't be revoked without a blocklist, while server sessions are immediately revocable. For most web apps, HttpOnly cookies with short-lived JWTs + refresh token rotation is the recommended pattern.

What are the Core Web Vitals and how do you improve them?

Core Web Vitals are Google's UX quality signals: LCP (Largest Contentful Paint, <2.5s) — preload hero images, use SSR/SSG, optimize TTFB. INP (Interaction to Next Paint, <200ms) — avoid long tasks, defer non-critical JS, use web workers for heavy computation. CLS (Cumulative Layout Shift, <0.1) — set explicit width/height on images and embeds, avoid inserting content above existing content. TTFB (<800ms) — use edge rendering or CDN for static assets.

What is XSS and how do you prevent it in a frontend application?

Cross-Site Scripting (XSS) injects malicious scripts into a web page viewed by other users. Prevent it by: using textContent instead of innerHTML for dynamic content, sanitizing HTML with DOMPurify if you must use innerHTML, setting a Content Security Policy (CSP) that blocks inline scripts, never storing sensitive data in localStorage (use HttpOnly cookies instead), and using frameworks like React that escape JSX output by default. The most impactful single fix is a strict CSP header.

What is the difference between Turborepo and Nx?

Both are monorepo build orchestration tools. Turborepo (by Vercel) focuses on build pipeline caching — it hashes task inputs and skips tasks whose inputs haven't changed. Configuration is minimal (turbo.json). Nx (by Nrwl) provides a full developer platform: project graph, affected commands (run only what changed), module boundary enforcement, code generators, and first-class support for React/Angular/Node. Turborepo is easier to adopt; Nx provides more power for large teams with strict boundaries.

What is the difference between server state and client state?

Server state is data that originates on the server and needs to be fetched, cached, and synchronized — user profiles, API responses, lists of items. Manage it with React Query (TanStack Query) or SWR. Client state is ephemeral UI state that lives only in the browser — modal open/closed, form input values, sidebar collapsed. Manage it with useState, useReducer, or Zustand. The most common architecture mistake is putting server state into Redux/Zustand and manually managing loading/error/caching — React Query makes this unnecessary.

How to Prepare for System Design Interviews

🏗️

Think in trade-offs

System design interviews are about trade-off reasoning, not memorizing APIs. For every approach (SSR, microfrontends, JWT), know the cost alongside the benefit.

📊

Anchor answers in metrics

LCP, INP, CLS, TTFB — use real numbers. Say '<2.5s LCP' not 'fast load'. Interviewers at senior levels expect you to quantify performance goals.

🔒

Security is always in scope

Every system design answer should address XSS, CSRF, and token storage. Senior engineers are expected to proactively raise security concerns.

🧩

Know when NOT to scale

Microfrontends and monorepos add complexity. The best answer often starts: 'This depends on team size and release cadence.' Show you understand the org-level context.

Performance is a feature

Core Web Vitals directly impact Google ranking. Know which vitals matter for which page types and have a concrete optimization checklist ready.

Related Resources

Ready to practice?

Theory questions, architecture walkthroughs, and AI-graded answers. Prep for senior-level frontend system design interviews.

Start Practicing Free →⚡ Daily Sprint