Irbisa · Cheatsheet
Frontend System Design
Designing a feed, autocomplete or chat, rendering strategy, API and state design, caching, offline, real-time updates, micro-frontends, build tooling
How do you structure your answer in a frontend system design interview?
What is the difference between offset and cursor pagination, and which would you use for an infinite feed?
How do you choose between CSR, SSR, SSG and ISR for the pages of a product?
What is a performance budget, what would you put in it, and how do you enforce it?
Which caching layers sit between the user and the database in a web app, and what belongs in each?
How would you implement infinite scroll for a long list, and what do you have to solve beyond loading the next page?
import { useEffect, useRef } from 'react';import { useInfiniteQuery } from '@tanstack/react-query'; type Page = { items: Post[]; nextCursor: string | null }; export function Feed() {…How would you design an image carousel component?
How would you design an autocomplete (typeahead) search input?
import { useEffect, useState } from 'react'; type Suggestion = { id: string; label: string }; const cache = new Map<string, Suggestion[]>();…When would you use WebSocket, Server-Sent Events or long polling for real-time updates, and how does each one work?
// Long polling: the server holds each request until it has events or about 30 s passasync function longPoll(cursor = '') { for (;;) { try { const res = await fetch(`/api/events?after=${encodeURIComponent(cursor)}`); if (!res.ok) throw new Error(`HTTP ${res.status}`);…How would you design the frontend of a news feed like Facebook or X?
How would you design a marketplace product listing page: filters, sorting, pagination, SEO and a fast first load?
type Filters = Record<string, string[]>; // One filter set, one URL: one CDN cache entry and one canonicalexport function toSearch(filters: Filters, sort: string, page: number): string { const params = new URLSearchParams(); for (const key of Object.keys(filters).sort()) {…How would you design the client of a real-time chat application?
type Message = { clientId: string; // made on the device, doubles as the idempotency key id?: string; // assigned by the server seq?: number; // server order within the conversation text: string; status: 'sending' | 'sent' | 'failed';…How would you design the API contract between a frontend and its backends: REST, GraphQL or a BFF?
How would you design a real-time dashboard that receives hundreds of updates per second?
type Tick = { symbol: string; price: number }; // collect stream messages and hand the UI one batch per frame, not one update per messageexport function subscribeBatched(url: string, onBatch: (latest: Map<string, Tick>) => void) { const source = new EventSource(url); let pending = new Map<string, Tick>();…How would you make a web app offline-first?
How would you design a collaborative editor like Google Docs, where several people edit the same document at once?
type Insert = { pos: number; text: string; client: string }; // Shift `op` so it keeps its meaning after `applied`, a concurrent edit already appliedfunction transform(op: Insert, applied: Insert): Insert { const before = applied.pos < op.pos || (applied.pos === op.pos && applied.client < op.client); return before ? { ...op, pos: op.pos + applied.text.length } : op;…How would you design uploading large files from the browser: progress, cancel, retry and resume after a dropped connection?
const PART_SIZE = 8 * 1024 * 1024; // S3 parts: at least 5 MiB except the last // XMLHttpRequest, because fetch reports no upload progressfunction putPart(url: string, part: Blob, onProgress: (sent: number) => void, signal: AbortSignal) { return new Promise<string>((resolve, reject) => { const xhr = new XMLHttpRequest();…How would you design a design system and component library used by many product teams?
How would you handle internationalization at scale: dozens of locales, plurals, right-to-left languages and per-locale bundles?
How would you add feature flags and A/B experiments to a frontend without slowing the first render or flashing the wrong variant?
import { createContext, use, type ReactNode } from 'react'; // FNV-1a hash: the same id lands in the same bucket on the server, at the edge and in the browserexport function bucket(userId: string, experiment: string): number { let h = 0x811c9dc5; for (const ch of `${experiment}:${userId}`) h = Math.imul(h ^ ch.charCodeAt(0), 0x01000193);…When are micro-frontends worth it, and how would you split and integrate them?