By Sarthak Sharma — Full Stack Developer, Kathmandu, Nepal
If you are coming from backend engineering, you might think the frontend is just “HTML, CSS, and some JavaScript.” But modern frontend engineering has evolved into complex, distributed system design that runs directly inside the client's browser.
Interactive Assessment
Test your architectural knowledge across all 21 concepts with our 10-question quiz.
Just like your backend APIs need to be resilient, horizontally scalable, and observable, frontend systems must handle millions of concurrent client devices, load within hundreds of milliseconds, manage real-time data streams, and defend against client-side attack vectors.
In this architectural breakdown, we translate foundational distributed systems concepts — caching tiers, replication, protocol design, observability, and isolation — into their modern browser equivalents across 5 core engineering pillars.
Pillar 1: Rendering & Delivery Models
The way web content is rendered and delivered determines your initial page latency, search engine indexability, server compute overhead, and content freshness.
1. Static Site Generation (SSG)
Static Site Generation builds the complete HTML, CSS, and data payloads during the build/compilation step before deployment. The pre-rendered static artifacts are pushed directly to CDN edge servers worldwide.
- How it works: During CI/CD build, the build engine queries APIs and databases, renders the React/Vue component trees into flat HTML files, and uploads them to object storage or edge CDNs.
- Latency Profile: Sub-50ms TTFB (Time to First Byte) because requests hit edge cache nodes without executing server compute.
- Trade-off: Content updates require triggering a new deployment pipeline.
- Best For: Documentation hubs, marketing landing pages, and portfolio sites.
2. Incremental Static Regeneration (ISR)
Incremental Static Regeneration bridges static performance and real-time freshness by allowing individual pages to be regenerated in the background on edge servers without rebuilding the entire codebase.
- How it works: You configure a revalidation window (e.g.,
revalidate: 60). When a request arrives after 60 seconds, the CDN serves the cached version immediately (stale) while triggering an asynchronous background re-render. Once complete, the edge cache is swapped seamlessly. - Trade-off: Users might briefly see slightly stale data before the background revalidation completes.
- Best For: E-commerce product catalogs, job boards, and news hubs.
3. Server-Side Rendering (SSR)
In Server-Side Rendering, HTML is generated dynamically on the web server or serverless compute container on every incoming HTTP request.
- How it works: The server receives the request, inspects session cookies/headers, queries downstream databases or microservices, produces customized HTML, and streams it back.
- Trade-off: Higher server compute utilization and increased TTFB compared to static edges.
- Best For: Personalized user dashboards, authenticated account portals, and real-time feeds.
4. Client-Side Rendering (CSR)
In Client-Side Rendering (Single Page Applications), the web server sends a bare-bones HTML shell and a JavaScript bundle. The browser downloads the script, compiles the virtual DOM, and issues API requests for data.
- Trade-off: Slower Initial Page Load / FCP (First Contentful Paint) and heavier client CPU/memory usage, but instantaneous transitions once hydrated.
- Best For: Highly interactive canvas apps, design tools (e.g., Figma, Canva), and complex admin consoles.
5. Hybrid & Island Architecture
Modern full-stack architectures (such as Next.js App Router and Astro) allow mixing rendering strategies on a per-route and per-component basis.
- The layout shell and static article text are rendered as pure static HTML (zero client JS).
- Interactive widgets (like comments, live poll, or the quiz below) are rendered as isolated interactive client islands.
6. CDNs & Edge Compute
Content Delivery Networks (CDNs) cache static assets across hundreds of edge Points of Presence (PoPs) globally. Modern edge runtimes (e.g., Cloudflare Workers, Vercel Edge Middleware) allow running lightweight serverless code (geolocation routing, A/B testing, auth gatekeeping) in under 10ms close to the end user.
Pillar 2: Performance & Resource Optimization
7. Web Performance & Core Web Vitals
Measuring real-world user experience requires standardized metrics that correlate directly with user engagement and search rankings:
- TTFB (Time to First Byte): Measures backend and edge responsiveness. Target: < 200ms.
- FCP (First Contentful Paint): When the browser renders the first DOM element. Target: < 1.0s.
- LCP (Largest Contentful Paint): When the largest hero image or text block renders. Target: < 2.5s.
- CLS (Cumulative Layout Shift): Visual stability score measuring unexpected shifts. Target: < 0.1.
- INP (Interaction to Next Paint): Replaced FID; measures UI responsiveness to user clicks and taps. Target: < 200ms.
8. Lazy Loading, Code Splitting & Dynamic Imports
Instead of bundling the entire web application into a monolithic 5MB JavaScript file, code splitting breaks the bundle by routes and heavy components using import() syntax. Non-critical images and iframes use the browser's native loading="lazy" and IntersectionObserver to load only when scrolling into view.
9. Service Workers & Offline Caching
A Service Worker acts as a programmable client-side proxy between your browser and the network. It can intercept requests, cache responses in the Cache Storage API, and enable offline Progressive Web App (PWA) experiences.
- Cache-First Strategy: Serves static fonts and immutable assets instantly from cache; falls back to network.
- Network-First Strategy: Attempts fresh fetch for live data; falls back to cached snapshot if offline.
- Stale-While-Revalidate: Returns cached version instantly while updating cache in background.
Pillar 3: Data & State Management
10. State Hierarchy: Local vs Global vs Server State
One of the biggest architectural mistakes in frontend development is treating all state equally. Mature frontend systems separate state into three distinct layers:
1. Local UI State
Dropdown open/close, accordion toggles, form inputs. Kept inside component memory via useState.
2. Global Client State
Theme (dark/light), sidebar collapsed, user preferences. Managed via lightweight stores like Zustand or Redux.
3. Server State
Remote database records. Managed via specialized tools (TanStack Query, SWR) handling cache invalidation, deduplication, and retries.
11. Client API Caching with Time-to-Live (TTL)
Re-fetching data on every screen transition wastes bandwidth and degrades user experience. Using in-memory caches, localStorage, or IndexedDB with strict TTL policies keeps navigation instantaneous.
12. Data Fetching Protocols: REST vs. GraphQL vs. tRPC
- REST: Resource-oriented, highly cacheable with standard HTTP CDN proxies, but vulnerable to over-fetching and under-fetching (N+1 queries).
- GraphQL: Single endpoint allowing clients to request exact fields across complex graph relations.
- tRPC / gRPC-Web: End-to-end type safety between TypeScript full-stack applications with automatic client SDK generation.
13. Pagination Strategies: Cursor vs Offset
Choosing the wrong pagination strategy can introduce severe consistency bugs:
- Offset Pagination (
?page=2&limit=20): Easy for fixed tables, but if records are inserted while a user scrolls, items shift down causing duplicates or missed records. - Cursor Pagination (
?cursor=post_9482&limit=20): Anchors to a unique deterministic record ID or timestamp. Immune to insertions, ideal for infinite feeds.
14. Real-Time Data: WebSockets vs SSE vs Polling
- WebSockets: Full-duplex bidirectional TCP communication. Best for multiplayer canvases, interactive gaming, and real-time chat.
- Server-Sent Events (SSE): Lightweight unidirectional text stream from server to client over standard HTTP. Ideal for LLM token streaming and stock tickers.
- Polling: Simple periodic HTTP requests. Viable when updates happen infrequently and setup complexity must be minimal.
Pillar 4: Architecture & Scalability
15. Micro Frontends & Module Federation
As organizations scale to dozens of engineering teams, a single monolithic frontend repository can create deployment bottlenecks. Micro Frontends decouple applications into independent repositories and pipelines.
Using Webpack Module Federation or modern Vite federation plugins, the host container downloads child micro-apps dynamically at runtime while sharing vendor dependencies (like React and styling tokens).
16. Component Architecture & Design Systems
A Design System enforces design consistency and development velocity through atomic UI components (Buttons, Inputs, Modals) and standardized design tokens (colors, typography, spacing scales).
17. Frontend CI/CD, Bundle Budgets & Preview Deployments
A production-grade frontend pipeline enforces quality gates before code reaches users:
- Type checking via TypeScript compiler (
tsc --noEmit). - Automated unit and integration testing.
- Bundle analyzer checks to enforce maximum chunk size budgets.
- Ephemeral preview deployments per pull request.
Pillar 5: User Experience, Reliability & Security
18. Web Accessibility (a11y) & Mobile-First Design
Accessible interfaces use semantic HTML tags (<nav>, <main>, <article>), explicit ARIA attributes, keyboard navigation focus rings, and high-contrast color ratios ensuring everyone can use the web app.
19. Error Boundaries & Graceful Degradation
In React, an unhandled rendering error in a single component can unmount the entire application tree, leaving the user with a blank screen. Wrapping components in ErrorBoundary components displays localized fallbacks while the rest of the application remains functional.
20. Frontend Observability & Real User Monitoring (RUM)
Just like backend microservices emit APM metrics, frontend apps must capture runtime crashes, unhandled promise rejections, network request failures, and Core Web Vitals telemetry across diverse user browsers.
21. Browser Security: CSP, XSS, and CSRF Protection
Frontend applications must be secured against malicious client-side execution:
- Content-Security-Policy (CSP): Restricts allowed script sources and forbids inline
eval()scripts. - HttpOnly, Secure, SameSite Cookies: Protects authentication tokens from JavaScript theft via XSS.
- DOM Sanitization: Sanitizes any dynamic HTML injected into the page via libraries like DOMPurify.
Frontend System Design Quiz
10 Questions • Test your architectural knowledge across the 21 concepts
Ready to verify your system design knowledge?
Enter your name and email to unlock the 10-question assessment and view your score instantly.
No spam. Real-time evaluation with instant feedback.