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
Code Splitting and Bundles
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

Code Splitting and Bundles

Reading30 min

Imagine handing someone a phone book to find one number. Most of it is dead weight for what they actually need. A JavaScript bundle can do the same thing to your users: ship code for ten features when the page in front of them only uses one. Bundle size shows up directly in Lighthouse scores, in Core Web Vitals, and in real complaints, which is exactly why it's a favorite interview topic.

What a kilobyte of JavaScript actually costs

Every kilobyte is paid for three times: it has to download, then get parsed and compiled, then run. On a throttled phone connection, a 500KB bundle can add whole seconds before the page responds to a tap, even if the download itself was fast, because the main thread stays busy parsing and running code the whole time. This is the difference between someone who's shipped to real users and someone who's only run a starter template on their own laptop.

Remember: a kilobyte of JS costs download, then parse, then execute. It isn't free just because the network is fast.

Sign in to try this knowledge check.

Tree shaking, and what quietly breaks it

Tree shaking is a bundler noticing which exported code is never actually used anywhere, and cutting it out. It works by reading import/export statements without running any code, which is exactly why it needs real ES modules, not the older require() style, to work reliably at all.

ts
// utils.ts
export function formatDate(d: Date) { /* ... */ }
export function heavyPdfGenerator() { /* ... */ } // never imported anywhere

// app.ts
import { formatDate } from "./utils";
// The bundler can see heavyPdfGenerator is unreachable from any entry point and drops it —
// as long as utils.ts has no side effects.

Two things break this in practice. require() calls can be conditional or built dynamically, so a bundler can't reliably prove what's used. And code that runs the instant a file is imported, like library.registerPlugin() sitting outside any function, means the bundler can't safely delete that file even if none of its exports are ever used. You can mark a package as side-effect-free by hand:

json
{ "sideEffects": false }

or list exactly which files genuinely do have side effects:

json
{ "sideEffects": ["*.css", "./src/polyfills.ts"] }

The classic mistake is importing a whole library for one small piece of it:

ts
// Bad: pulls in the entire lodash library unless deep tree shaking is specially configured
import _ from "lodash";
_.debounce(fn, 300);

// Good: only pulls in the debounce function
import debounce from "lodash/debounce";

import * as _ from "lodash" breaks tree shaking for the same reason require() does: every use of _.something becomes a lookup the bundler can't predict ahead of time, so it can't prove which of hundreds of exports actually got used. Named imports (import { debounce } from "lodash-es") work because the bundler sees the exact piece you want right there in the import line.

Remember: tree shaking needs to see the exact name you're using at the import line. A whole-module import (import * as _) hides that from it.

Sign in to try this knowledge check.

Dynamic imports and React.lazy

A dynamic import() returns a promise and tells the bundler: "this is its own separate chunk, load it only when asked." React wraps this pattern with React.lazy plus Suspense.

tsx
import { lazy, Suspense } from "react";
const SettingsPanel = lazy(() => import("./SettingsPanel")); // its own chunk, fetched only when it's actually rendered

export function App() {
  const [showSettings, setShowSettings] = useState(false);
  return (
    <div>
      <button onClick={() => setShowSettings(true)}>Open settings</button>
      {showSettings && <Suspense fallback={<Spinner />}><SettingsPanel /></Suspense>}
    </div>
  );
}

Three details worth knowing cold. React.lazy only works with default exports; for a named export, re-export it inline: lazy(() => import("./Chart").then(mod => ({ default: mod.Chart }))). Suspense must wrap the lazy component, or React throws, since there's nothing to suspend against otherwise. And a failed download, a network drop mid-fetch, needs an error boundary around the Suspense, since Suspense only knows how to handle "still loading," never "failed."

Splitting by route is the highest-value place to do this: someone on /dashboard shouldn't download the /settings code at all.

tsx
const Dashboard = lazy(() => import("./routes/Dashboard"));
const Settings = lazy(() => import("./routes/Settings"));

export function AppRoutes() {
  return (
    <Suspense fallback={<PageSkeleton />}>
      <Routes>
        <Route path="/dashboard" element={<Dashboard />} />
        <Route path="/settings" element={<Settings />} />
      </Routes>
    </Suspense>
  );
}

Next.js does this automatically through its file-based routing: every page under app/ is already its own chunk, no manual lazy() needed.

Remember: a rejected dynamic import needs an error boundary. Suspense alone only covers "still loading," never "failed to load."

Sign in to try this knowledge check.

Prefetching hides the cost of splitting

Splitting introduces its own small delay: click, fetch the chunk, parse it, then render. Prefetching on hover or focus hides that delay instead of making the user wait for it after the click.

tsx
function NavLink({ to, children }: { to: string; children: React.ReactNode }) {
  const prefetch = () => import(`./routes/${to}.tsx`);
  return <Link to={to} onMouseEnter={prefetch} onFocus={prefetch}>{children}</Link>;
}
ts
const Reports = lazy(() => import(/* webpackPrefetch: true */ "./routes/Reports"));

Remember: prefetch on hover turns "wait after the click" into "already loaded by the time you click."

Never optimize a bundle you haven't measured

bash
npm install --save-dev webpack-bundle-analyzer  # a visual map of what's inside each chunk
npm install --save-dev source-map-explorer      # traces bundle bytes back to the source files that produced them

Vite's version is rollup-plugin-visualizer:

ts
import { visualizer } from "rollup-plugin-visualizer";
export default { plugins: [visualizer({ open: true, gzipSize: true })] };

What to actually look for once that map is open: one dependency taking up most of a chunk (a full icon library imported for three icons, swap it for something smaller or import only what's used); the same library duplicated across several chunks (usually a version mismatch, check with npm ls <package>); and vendor code, which barely ever changes, bundled together with app code that changes on every deploy, split them apart so the vendor chunk stays cached across releases instead of getting invalidated by every unrelated change.

Bundle budgets: making a number a build failure

A bundle budget is a ceiling on chunk size, enforced in CI, that fails the build the moment it's crossed. That's what turns "we should keep an eye on this" into something that genuinely can't slip through unnoticed.

json
{
  "bundlesize": [
    { "path": "./build/static/js/main.*.js", "maxSize": "150 kB" }
  ]
}

Webpack has the same idea built in, no extra package needed:

js
// webpack.config.js
module.exports = {
  performance: { maxAssetSize: 250000, maxEntrypointSize: 250000, hints: "error" }, // fail the build, don't just warn
};

Remember: a budget that isn't enforced automatically in CI is a suggestion, not a budget. Someone eventually forgets to check it.

Sign in to try this knowledge check.
PreviousNetwork Performance and Web VitalsNextVirtualization

Course progress

0%
0 of 177 modules complete

On this page

  • What a kilobyte of JavaScript actually costs
  • Tree shaking, and what quietly breaks it
  • Dynamic imports and React.lazy
  • Prefetching hides the cost of splitting
  • Never optimize a bundle you haven't measured
  • Bundle budgets: making a number a build failure