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
70

Frontend System Design · Lesson 70 of 86 · 5 min

Atomic Design for Component Libraries

This isn't just a folder structure; it's a mental model for composition that interviewers use to test your ability to build scalable UIs.

After this, you'll be able to break down any UI into a logical component hierarchy and explain the trade-offs of this approach in a system design interview. This is how you demonstrate you can think about frontend architecture, not just write components.

The Five Levels of Composition

Atomic Design gives you a five-level hierarchy for your components. The core idea is simple: start with the smallest possible pieces and compose them into larger, more complex structures.

  • Atoms: The indivisible building blocks. These are often just styled HTML elements. Think Button, Input, Label, Icon. They have no business logic and are globally reusable.

  • Molecules: Simple, functional groups of atoms. A SearchForm molecule might combine an Input atom and a Button atom. It has one, and only one, job. It encapsulates a small piece of functionality.

  • Organisms: More complex sections of an interface, composed of molecules and atoms. A Header organism could contain a Logo atom, a Navigation molecule, and a SearchForm molecule. Organisms start to have more context and complexity.

  • Templates: The layout or wireframe of a page. Templates arrange organisms into a specific structure. They are placeholders for content, defining the skeleton of a view but without any real data.

  • Pages: Specific instances of templates, filled with real content. This is where you see the final UI. It's the ProductListingPage with actual product data, not just placeholder grids.

How to Classify Components Without Overthinking It

The trap: Agonizing over whether a component is a "big molecule" or a "small organism." This is a common sign of inexperience. The labels are less important than the principle of composition and clear responsibility.

Use this heuristic: can it be broken down further and still be useful?

  • If no, it's an Atom. A Button is just a button.
  • If yes, and the combination performs a single, discrete function, it's a Molecule. A SearchForm combines an input and a button to perform a search.
  • If it's a major, distinct section of the page composed of multiple smaller components, it's an Organism. The SiteHeader is a good example.

The goal is a shared vocabulary for the team, not a perfect, dogmatic classification.

In an interview, when asked to break down a UI, start by identifying the smallest reusable pieces (atoms) and then show how you'd compose them. The process of demonstrating composition is more important than getting every label right. Explain why you're grouping certain elements—that's what the interviewer wants to hear.

Building a Composable Search Form

Let's build a SearchForm molecule from Input and Button atoms. This is a classic example that shows the power of composition. The atoms are "dumb" and only care about their own state and props. The molecule is "smart" and manages the state and logic that connect the atoms.

import React, { useState } from 'react';

// --- ATOMS ---

// A generic, reusable button atom
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
  variant?: 'primary' | 'secondary';
}
const Button: React.FC<ButtonProps> = ({ children, variant = 'primary', ...props }) => {
  const baseClasses = "px-4 py-2 rounded font-bold";
  const variantClasses = variant === 'primary' ? "bg-blue-500 text-white" : "bg-gray-300 text-black";
  return (
    <button className={`${baseClasses} ${variantClasses}`} {...props}>
      {children}
    </button>
  );
};

// A generic, reusable input atom
type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
const Input: React.FC<InputProps> = (props) => {
  return <input className="px-4 py-2 border border-gray-300 rounded" {...props} />;
};

// --- MOLECULE ---

// A functional unit combining the atoms
interface SearchFormProps {
  onSearch: (query: string) => void;
  initialQuery?: string;
  placeholder?: string;
}
export const SearchForm: React.FC<SearchFormProps> = ({ onSearch, initialQuery = '', placeholder = 'Search...' }) => {
  const [query, setQuery] = useState(initialQuery);

  const handleSubmit = (e: React.FormEvent) => {
    e.preventDefault();
    onSearch(query);
  };

  return (
    <form onSubmit={handleSubmit} className="flex items-center gap-2">
      <Input
        type="search"
        value={query}
        onChange={(e) => setQuery(e.target.value)}
        placeholder={placeholder}
        aria-label="Search query"
      />
      <Button type="submit" variant="primary">
        Search
      </Button>
    </form>
  );
};

Notice the clear separation of concerns. The Button doesn't know it's part of a search form. The Input doesn't know what will happen to its value. The SearchForm molecule orchestrates them to perform a specific task. This is the reusability you're aiming for.

Where the Model Gets Blurry

Atomic Design is a mental model, not a strict law. In practice, the lines blur, especially in modern frontend development.

The distinction between Templates and Pages is often less relevant in frameworks like React, Vue, or Svelte. A page component (e.g., in a Next.js app/ directory) often handles both the layout (template) and the data fetching (page content) in one file. It's more useful to think of page-level components as containers that fetch data and pass it down to organisms.

The line between Molecules and Organisms is also subjective. Is a ProductCard with an image, title, price, and button a molecule or an organism? It depends on its complexity and context. If it's a key, self-contained part of your business logic, you might call it an organism. If it's just a simple grouping, a molecule might fit. Don't waste time on this. Pick one and be consistent.

The trap: Presenting this hierarchy as the only way to build UIs. Acknowledge its limitations. This shows you're a pragmatic engineer who adapts models to reality, not the other way around.

This diagram shows the ideal flow. Your job is to know when reality requires a shortcut.

How to Answer "Design a Component Library"

When asked to design a component library or a design system, use Atomic Design as your framework.

  1. State the Goal: "My goal is to create a consistent, reusable, and maintainable set of components. I'd use a methodology like Atomic Design to structure them."

  2. Start with the Atoms: "First, I'd define the atoms. These are the design tokens and basic elements: colors, typography, spacing, and components like Button, Input, Icon. These would be highly configurable through props."

  3. Compose Molecules: "Next, I'd build molecules by combining atoms to handle simple, recurring patterns. For example, a FormField molecule would combine a Label, Input, and ErrorMessage atom. This encapsulates the logic for a single form field."

  4. Build Organisms for Context: "Then, I'd compose organisms for larger sections of the UI. A LoginForm organism would use several FormField molecules and a Button atom, and it would manage the form's overall state and submission logic."

  5. Connect to Tooling: "I'd structure this in a monorepo (as we discussed in Monorepo Tooling: Nx and Lerna), with each component in its own package to encourage independent versioning and reuse."

This answer shows you have a structured approach. It moves from the abstract to the concrete and connects to other parts of the system design.

Try it

Take the header of a site you use daily (e.g., GitHub, dev.to). Sketch out its component tree using the five atomic levels. Identify the atoms (icons, links, avatar), molecules (search bar, notification indicator), and the main header organism. Don't write code; just map the hierarchy. This takes 15 minutes and builds the right mental muscle.

Next: We'll see how to make these components adaptable across different products or brands with a system for Theming and Customization in Design Systems.

Lock it in — apply this lesson under interview conditions.

Try a free mock interviewPractice system design problems
Previous

Monorepo Tooling: Nx and Lerna

Next

Theming and Customization in Design Systems