MindForge
MindForge
DashboardHelp & Support
Dashboard
MindForge

Interview Preparation Bootcamp

Course progress

0%
0 of 177 modules complete
Start Here0/1
  • How to Use This Course
Data Structures & Algorithms0/27
  • Arrays and Hashing
  • Two Pointers
  • Sliding Window
  • Sliding Window: Harder Problems
  • Binary Search
  • Stacks
  • Practice Test: Arrays, Pointers, Windows, Search and Stacks
  • Trees: Traversals and Core Patterns
  • Binary Search Trees and Rebuilding a Tree
  • Tries (Prefix Trees)
  • Heaps and Priority Queues
  • Graphs: BFS and DFS
  • Topological Sort and Cycle Detection
  • Union-Find (Disjoint Set Union)
  • Practice Test: Trees, Heaps and Graphs
  • Dynamic Programming Basics
  • Dynamic Programming: Two Dimensions
  • Dynamic Programming: Hard String Matching
  • Backtracking
  • Backtracking: Constraint Satisfaction
  • Greedy Algorithms
  • Interval Problems
  • Bit Manipulation
  • Math and Geometry
  • String Manipulation
  • Pattern Recall and Mock Coding Rounds
  • Practice Test: DP, Backtracking, Greedy and More

System Design

Foundations0/16
  • The System Design Interview Framework
  • Back-of-the-Envelope Estimation
  • Networking and Protocols for Design
  • API Design and Idempotency
  • Load Balancing, Proxies, and Scaling Out
  • Caching and CDNs
  • Choosing a Database: Storage, Indexes and Transactions
  • Replication, Partitioning, and Sharding
  • CAP, PACELC, and Levels of Consistency
  • Messaging, Queues, and Event-Driven Architecture
  • Distributed Transactions and Data Integrity
  • Coordination, Consensus, and Distributed Locks
  • Reliability, Resilience, and Rate Limiting
  • Observability, Security, and Cost
  • System Design Cheat Sheet
  • Practice Test: System Design Foundations
Case Studies0/23
  • Design a URL Shortener
  • Design a Rate Limiter
  • Design a Notification Service
  • Design a Job Queue System
  • Design a Chat App (WhatsApp)
  • Design an Analytics Pipeline
  • Design a Multi-tenant SaaS Architecture
  • Design a Social Media Feed (Twitter/X)
  • Design a Search Autocomplete System
  • Design a File Storage Service (Dropbox)
  • Design Google Docs
  • Design a Code Review System
  • Design Netflix
  • Design YouTube
  • Design Spotify
  • Design Uber/Lyft
  • Design Airbnb
  • Design Ticketmaster (Eventbrite)
  • Design an E-commerce Cart, Checkout, and Catalog
  • Design a Payment System
  • Design a Logging and Monitoring System
  • Mock Design Rounds
  • Practice Test: System Design Case Studies
Low-Level Design0/19
  • The LLD Interview Framework and UML
  • OOP Foundations for Design
  • SOLID Principles
  • Creational Patterns
  • Structural Patterns
  • Behavioral Patterns I — Strategy, Observer, Command, State, Template Method
  • Behavioral Patterns II and Anti-Patterns
  • Concurrency in Low-Level Design
  • Design a Parking Lot
  • Design an Elevator System
  • Design a Movie Ticket Booking System
  • Design an Expense-Sharing App (Splitwise)
  • Design a Vending Machine and an ATM
  • Design a Rate Limiter and a Logging Framework
  • Design a Notification Service and an In-Memory Cache
  • Design Games — Tic-Tac-Toe, Snake and Ladder, Chess
  • Database Design for LLD
  • LLD Cheat Sheet and Recall Drill
  • Practice Test: Low-Level Design

Backend

Python0/5
  • How Python Runs Your Code
  • Functions Deep Dive: Closures, Generators, Context Managers, Scope
  • Classes Deep Dive: Method Types, MRO, Metaclasses
  • Standard Library and Serialization
  • Practice Test: Python
Django0/6
  • Django Request Lifecycle
  • Lab: Django Middleware — Request ID & Response Time
  • Django ORM and Querysets
  • Django's Cache Framework
  • Practice Test: Django
  • Django in Production: Debugging Labs
FastAPI0/5
  • FastAPI, ASGI, and Async
  • FastAPI Dependency Injection
  • FastAPI Background Tasks
  • Lab: FastAPI Async — Concurrent Aggregation
  • Practice Test: FastAPI
Databases (PostgreSQL)0/6
  • Indexing
  • Query Optimization
  • Transactions and Isolation
  • Migrations and Schema Changes
  • Hierarchical Data and Safe Concurrent Updates
  • Practice Test: Databases
Caching, Queues & Distributed Systems0/8
  • Redis Caching
  • Redis Advanced Patterns
  • Celery and Background Workers
  • Kafka and Message Queues
  • Async Pipelines
  • Distributed Systems Basics
  • Distributed Locks
  • Practice Test: Caching, Queues and Distributed Systems
APIs, Security & Deployment0/9
  • REST API Design
  • API Versioning and Error Handling
  • API Security and Authentication
  • WebSockets and Real-Time Systems
  • Docker and Containers
  • File Storage with S3
  • Testing Strategies
  • Mock Backend Round
  • Practice Test: APIs, Security and Deployment
Frontend0/38
  • HTML Document Structure and Semantics
  • CSS Box Model, Flexbox and Grid
  • CSS Architecture and Theming
  • CSS and Rendering Performance
  • Variables, Scope, Hoisting, and Truthiness
  • Functions, this, and Binding
  • Objects and Prototypal Inheritance
  • JavaScript Utility Patterns: Cloning, Caching, and Memory
  • Promises From Scratch
  • The Event Loop and Browser Rendering Pipeline
  • The DOM: Nodes, Events, and Traversal
  • Practice Test: HTML, CSS and JavaScript
  • React Rendering Fundamentals
  • React Hooks Internals
  • React Performance
  • Lab: React — Stateful Counter Component
  • State Management
  • State Machines in React
  • React Custom Hooks and Composition Patterns
  • TypeScript for React
  • React Testing
  • Practice Test: React
  • HTTP and Caching
  • Network Performance and Web Vitals
  • Code Splitting and Bundles
  • Virtualization
  • GraphQL and Data Fetching
  • Web Security
  • WebSockets and Real-time
  • SSR and Next.js
  • Micro-frontends
  • Build Tools and Bundling
  • Accessibility
  • Error Handling
  • Internationalization
  • Animation
  • Rapid Recall and Mock Frontend Rounds
  • Practice Test: Performance, Architecture and Production
Behavioral & Interview Day0/14
  • Resume and Project Walkthroughs
  • The STAR Method and Refining Your Stories
  • Conflict and Difficult Coworkers
  • Failures, Incidents, and Obstacles
  • Leadership, Mentorship, and Ownership
  • Teamwork, Communication, and Feedback
  • Growth and Handling Ambiguity
  • Career Goals, Why This Company, and Negotiation
  • Situational Questions
  • Company Research
  • Mock Behavioral Rounds
  • Interview Day
  • After the Interview
  • Practice Test: Behavioral and Interview Day
CSS Architecture and Theming
Course contents

Interview Preparation Bootcamp

Course progress

0%
0 of 177 modules complete
Start Here0/1
  • How to Use This Course
Data Structures & Algorithms0/27
  • Arrays and Hashing
  • Two Pointers
  • Sliding Window
  • Sliding Window: Harder Problems
  • Binary Search
  • Stacks
  • Practice Test: Arrays, Pointers, Windows, Search and Stacks
  • Trees: Traversals and Core Patterns
  • Binary Search Trees and Rebuilding a Tree
  • Tries (Prefix Trees)
  • Heaps and Priority Queues
  • Graphs: BFS and DFS
  • Topological Sort and Cycle Detection
  • Union-Find (Disjoint Set Union)
  • Practice Test: Trees, Heaps and Graphs
  • Dynamic Programming Basics
  • Dynamic Programming: Two Dimensions
  • Dynamic Programming: Hard String Matching
  • Backtracking
  • Backtracking: Constraint Satisfaction
  • Greedy Algorithms
  • Interval Problems
  • Bit Manipulation
  • Math and Geometry
  • String Manipulation
  • Pattern Recall and Mock Coding Rounds
  • Practice Test: DP, Backtracking, Greedy and More

System Design

Foundations0/16
  • The System Design Interview Framework
  • Back-of-the-Envelope Estimation
  • Networking and Protocols for Design
  • API Design and Idempotency
  • Load Balancing, Proxies, and Scaling Out
  • Caching and CDNs
  • Choosing a Database: Storage, Indexes and Transactions
  • Replication, Partitioning, and Sharding
  • CAP, PACELC, and Levels of Consistency
  • Messaging, Queues, and Event-Driven Architecture
  • Distributed Transactions and Data Integrity
  • Coordination, Consensus, and Distributed Locks
  • Reliability, Resilience, and Rate Limiting
  • Observability, Security, and Cost
  • System Design Cheat Sheet
  • Practice Test: System Design Foundations
Case Studies0/23
  • Design a URL Shortener
  • Design a Rate Limiter
  • Design a Notification Service
  • Design a Job Queue System
  • Design a Chat App (WhatsApp)
  • Design an Analytics Pipeline
  • Design a Multi-tenant SaaS Architecture
  • Design a Social Media Feed (Twitter/X)
  • Design a Search Autocomplete System
  • Design a File Storage Service (Dropbox)
  • Design Google Docs
  • Design a Code Review System
  • Design Netflix
  • Design YouTube
  • Design Spotify
  • Design Uber/Lyft
  • Design Airbnb
  • Design Ticketmaster (Eventbrite)
  • Design an E-commerce Cart, Checkout, and Catalog
  • Design a Payment System
  • Design a Logging and Monitoring System
  • Mock Design Rounds
  • Practice Test: System Design Case Studies
Low-Level Design0/19
  • The LLD Interview Framework and UML
  • OOP Foundations for Design
  • SOLID Principles
  • Creational Patterns
  • Structural Patterns
  • Behavioral Patterns I — Strategy, Observer, Command, State, Template Method
  • Behavioral Patterns II and Anti-Patterns
  • Concurrency in Low-Level Design
  • Design a Parking Lot
  • Design an Elevator System
  • Design a Movie Ticket Booking System
  • Design an Expense-Sharing App (Splitwise)
  • Design a Vending Machine and an ATM
  • Design a Rate Limiter and a Logging Framework
  • Design a Notification Service and an In-Memory Cache
  • Design Games — Tic-Tac-Toe, Snake and Ladder, Chess
  • Database Design for LLD
  • LLD Cheat Sheet and Recall Drill
  • Practice Test: Low-Level Design

Backend

Python0/5
  • How Python Runs Your Code
  • Functions Deep Dive: Closures, Generators, Context Managers, Scope
  • Classes Deep Dive: Method Types, MRO, Metaclasses
  • Standard Library and Serialization
  • Practice Test: Python
Django0/6
  • Django Request Lifecycle
  • Lab: Django Middleware — Request ID & Response Time
  • Django ORM and Querysets
  • Django's Cache Framework
  • Practice Test: Django
  • Django in Production: Debugging Labs
FastAPI0/5
  • FastAPI, ASGI, and Async
  • FastAPI Dependency Injection
  • FastAPI Background Tasks
  • Lab: FastAPI Async — Concurrent Aggregation
  • Practice Test: FastAPI
Databases (PostgreSQL)0/6
  • Indexing
  • Query Optimization
  • Transactions and Isolation
  • Migrations and Schema Changes
  • Hierarchical Data and Safe Concurrent Updates
  • Practice Test: Databases
Caching, Queues & Distributed Systems0/8
  • Redis Caching
  • Redis Advanced Patterns
  • Celery and Background Workers
  • Kafka and Message Queues
  • Async Pipelines
  • Distributed Systems Basics
  • Distributed Locks
  • Practice Test: Caching, Queues and Distributed Systems
APIs, Security & Deployment0/9
  • REST API Design
  • API Versioning and Error Handling
  • API Security and Authentication
  • WebSockets and Real-Time Systems
  • Docker and Containers
  • File Storage with S3
  • Testing Strategies
  • Mock Backend Round
  • Practice Test: APIs, Security and Deployment
Frontend0/38
  • HTML Document Structure and Semantics
  • CSS Box Model, Flexbox and Grid
  • CSS Architecture and Theming
  • CSS and Rendering Performance
  • Variables, Scope, Hoisting, and Truthiness
  • Functions, this, and Binding
  • Objects and Prototypal Inheritance
  • JavaScript Utility Patterns: Cloning, Caching, and Memory
  • Promises From Scratch
  • The Event Loop and Browser Rendering Pipeline
  • The DOM: Nodes, Events, and Traversal
  • Practice Test: HTML, CSS and JavaScript
  • React Rendering Fundamentals
  • React Hooks Internals
  • React Performance
  • Lab: React — Stateful Counter Component
  • State Management
  • State Machines in React
  • React Custom Hooks and Composition Patterns
  • TypeScript for React
  • React Testing
  • Practice Test: React
  • HTTP and Caching
  • Network Performance and Web Vitals
  • Code Splitting and Bundles
  • Virtualization
  • GraphQL and Data Fetching
  • Web Security
  • WebSockets and Real-time
  • SSR and Next.js
  • Micro-frontends
  • Build Tools and Bundling
  • Accessibility
  • Error Handling
  • Internationalization
  • Animation
  • Rapid Recall and Mock Frontend Rounds
  • Practice Test: Performance, Architecture and Production
Behavioral & Interview Day0/14
  • Resume and Project Walkthroughs
  • The STAR Method and Refining Your Stories
  • Conflict and Difficult Coworkers
  • Failures, Incidents, and Obstacles
  • Leadership, Mentorship, and Ownership
  • Teamwork, Communication, and Feedback
  • Growth and Handling Ambiguity
  • Career Goals, Why This Company, and Negotiation
  • Situational Questions
  • Company Research
  • Mock Behavioral Rounds
  • Interview Day
  • After the Interview
  • Practice Test: Behavioral and Interview Day
Browsing without an account — progress is saved in this browser only.Sign in to save it

CSS Architecture and Theming

Reading30 min

A five-file prototype survives any CSS approach you throw at it. What separates the options in this lesson is what happens at file two hundred: whether class names collide, whether a theme change forces a re-render, whether the CSS bundle keeps growing forever or levels off. None of these approaches is "the best" one, and treating one as a favorite is usually the wrong answer in an interview. What matters is knowing the real trade-offs well enough to pick the right one for a given team and app.

BEM: discipline, not tooling

Block-Element-Modifier is a naming convention, nothing more. It needs no build step and works in a plain .css file, which is exactly why it predates every other option here.

css
.card { border-radius: 8px; padding: 16px; }               /* Block */
.card__title { font-size: 1.25rem; font-weight: 600; }     /* Element, connected with __ */
.card--featured { border: 2px solid gold; }                /* Modifier, connected with -- */
tsx
<div className="card card--featured">
  <h3 className="card__title">Featured Post</h3>
</div>

The strength is zero tooling, and a class name that documents its own relationships. The weakness is that nothing actually enforces the scoping: another file can define its own .card__title and silently collide with yours. BEM only works as well as everyone's discipline holds, and that discipline is the first thing to slip once more than one team touches the codebase.

Remember: BEM is a naming convention, not a guarantee. Nothing stops a second file from reusing the same class name by accident.

Sign in to try this knowledge check.

CSS Modules: scoping enforced by the build

CSS Modules solve exactly the problem BEM cannot: every class name gets scoped to its own file automatically, compiled to a hashed name at build time.

css
/* Card.module.css */
.card { border-radius: 8px; padding: 16px; }
.featured { border: 2px solid gold; }
tsx
import styles from "./Card.module.css";
import clsx from "clsx";

function Card({ featured }: { featured?: boolean }) {
  return <div className={clsx(styles.card, featured && styles.featured)}>...</div>;
}

.card compiles to something like .Card_card__a1b2c, so a class named card in a completely unrelated file can never collide with this one. No naming convention is needed to make that true; the build enforces it. It is the default in both Next.js and Vite with zero configuration, which is a big part of why it is such a common starting point.

Remember: CSS Modules turn scoping from a human habit into a build-time guarantee.

Sign in to try this knowledge check.

CSS-in-JS, and the runtime cost that changed the ecosystem

Libraries like styled-components and Emotion let you write CSS directly in TypeScript, next to the component, with full access to props and theme values.

tsx
const Card = styled.div<{ $featured?: boolean }>`
  border-radius: 8px;
  border: ${(props) => (props.$featured ? "2px solid gold" : "1px solid #ddd")};
`;

Here is the detail worth naming precisely, because it is what actually pushed the ecosystem to change: the classic version of this approach parses those template literals and injects <style> tags at runtime, in the browser, on every render where a dynamic style changes. That costs real JS parsing time on the client, makes server-side rendering harder (style extraction has to happen on the server and reconcile with what the client injects, which is why styled-components needed its own build plugin just to avoid a flash of unstyled content), and makes a bundler's job harder, since dynamically generated class names resist tree shaking and critical-CSS extraction.

That cost is exactly why the industry moved toward zero-runtime CSS-in-JS: vanilla-extract, Panda CSS, and styled-components' own newer compiler mode, among others. These extract styles to static CSS files at build time instead of runtime. You keep the convenience of writing CSS next to your component; you drop the browser-side parsing tax. Naming this shift, and why it happened, reads as someone who has tracked the ecosystem, not someone reciting whichever library happens to be popular this year.

Remember: the problem with classic CSS-in-JS was never the syntax, it was generating styles in the browser at runtime instead of once at build time.

Sign in to try this knowledge check.

Atomic CSS: composing utilities instead of writing new rules

Tailwind is the dominant example: small, single-purpose classes composed directly in markup, instead of authoring new CSS per component.

tsx
<div className={`rounded-lg p-4 ${featured ? "border-2 border-yellow-400" : "border border-gray-200"}`}>
  <h3 className="text-xl font-semibold">Title</h3>
</div>

The upside is real: the utility set is finite and shared across the whole app, so unlike a hand-written stylesheet, the CSS bundle levels off instead of growing with every new component, and Tailwind purges anything unused at build time on top of that. There is also no more debating what to name a wrapper <div>, and no specificity conflicts, since every utility class touches one property and carries roughly equal weight. The cost is markup that reads noisier, and a real learning curve for anyone used to styling in a separate stylesheet instead of inline in JSX.

Remember: a hand-written stylesheet grows with every component. A shared, finite utility set does not.

Sign in to try this knowledge check.

Design tokens and a theme that doesn't need a re-render

Design tokens are the named, central values, colors, spacing, radii, that both design and code point to, instead of scattering hardcoded values through the codebase. CSS custom properties are the natural way to build a theme that can change at runtime, because unlike a Sass variable, a --variable is resolved in the browser, not baked in at build time.

css
:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --space-3: 16px;
}
[data-theme="dark"] {
  --color-bg: #0f0f0f;
  --color-text: #f5f5f5;
}
css
.card {
  background: var(--color-bg);
  color: var(--color-text);
  padding: var(--space-3);
}
tsx
function ThemeToggle() {
  const [theme, setTheme] = useState<"light" | "dark">("light");
  useEffect(() => {
    document.documentElement.setAttribute("data-theme", theme);
  }, [theme]);
  return <button onClick={() => setTheme(t => t === "light" ? "dark" : "light")}>Toggle theme</button>;
}

Notice there is no React re-render anywhere in that theme switch. Flipping the data-theme attribute makes the browser recompute styles for every element referencing a changed custom property, on its own, with React never knowing or caring. Compare that to a JS-driven theme object passed through Context, where every consuming component genuinely re-renders on every theme change. For a value that changes as rarely as a light/dark toggle, CSS variables are the cheaper mechanism by a wide margin.

Remember: flipping one HTML attribute lets the browser update every themed element on its own. No React re-render involved.

Sign in to try this knowledge check.

A responsive card grid, using both ideas at once

css
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}

@container (min-width: 320px) {
  .card { flex-direction: row; align-items: center; }
}

Two distinct responsive mechanisms are stacked here, and it is worth being able to tell them apart. repeat(auto-fill, minmax(220px, 1fr)) gives you a reflowing grid with zero media queries: the number of columns is whatever fits, driven purely by available width. Container queries (@container) solve a different problem entirely: they let one component respond to its own box size, not the screen's, which a media query structurally cannot do. A card that needs to lay out differently depending on whether its parent gave it 300px or 900px, regardless of the overall screen size, is exactly the case container queries exist for.

Remember: a media query answers "how big is the screen?" A container query answers "how big is my own box?"

Sign in to try this knowledge check.

Actually picking one

If an interviewer asks which CSS approach is "correct," the strong answer names the actual constraints rather than a favorite: CSS Modules for a small team with no design-system ambitions on a Next.js or Vite setup that already supports it for free; Tailwind for a team that wants to move fast and skip naming debates entirely; a zero-runtime CSS-in-JS library for a design system that needs runtime theming without the classic styled-components performance tax. Scoping guarantees, runtime cost, markup verbosity, and theming story are the four axes the decision actually runs on. Naming those four is worth more than naming a winner.

PreviousCSS Box Model, Flexbox and GridNextCSS and Rendering Performance

Course progress

0%
0 of 177 modules complete

On this page

  • BEM: discipline, not tooling
  • CSS Modules: scoping enforced by the build
  • CSS-in-JS, and the runtime cost that changed the ecosystem
  • Atomic CSS: composing utilities instead of writing new rules
  • Design tokens and a theme that doesn't need a re-render
  • A responsive card grid, using both ideas at once
  • Actually picking one