Design patterns and architecture
Design patterns and frontend architecture for apps that grow.
19 lessons 77 practice questions about 1 hours of reading
Chapter 1, beginner
Foundations
What it is and how it works, the questions every round starts with.
- 01Composition vs inheritance in React: why does React favour composition?
Lesson, 4 min read, then 6 questions to practise
- Compose card components three ways: slots, a compound Card API and a tweet card
- Build a compound <Tabs> component with full ARIA and roving tabindex
- Refactor a withAuth HOC and a render-prop loader into hooks without changing behaviour
- Build a polymorphic Button with an as prop, ref forwarding and correct semantics for each element
- Build a headless useCombobox: state, keyboard, ARIA prop getters and a styled consumer
- Build theme and settings providers: helpful hook errors, scoped overrides, composeProviders and stable values
- 02What is the factory pattern in JavaScript?
Lesson, 4 min read, then 5 questions to practise
- Build a dependency injection container: singleton, scoped and transient lifetimes, cycle paths and async disposal
- Build a small Zod-style schema validator
- Implement cva() (class-variance-authority) for component variants
- Write small function utilities: myAt, myWith, square, argument counts, makeCounter, cycle and a singleton
- Model a school with classes: inheritance, private fields, validated setters, a static id counter and overrides
- 03What is the module pattern in JavaScript?
Lesson, 4 min read, then 4 questions to practise
- Implement a once() function using closures
- Simulate ES module evaluation order: cycles, TDZ errors and slow top-level await
- Build a mini module bundler: resolve imports, build the graph, handle cycles and emit one runnable bundle
- Simulate tree shaking: follow imports and re-exports, keep side-effectful modules and report what is removed
- 04What is the strategy pattern in JavaScript?
Lesson, 4 min read, then 5 questions to practise
Chapter 2, intermediate
In depth
How it behaves under the hood, and the follow-ups that come next.
- 07MVC vs MVVM vs Flux: what is the difference?
Lesson, 5 min read, then 6 questions to practise
- Implement a small Redux-style store using subscriptions and reducers
- Implement Redux createStore() with enhancers and applyMiddleware(): middleware order, thunk and logger
- Build createSlice() and createAsyncThunk() from scratch, wired to a store and React
- Implement a reactive dependency system with automatic dependency tracking
- Implement a fine-grained external state store using useSyncExternalStore without tearing
- Design the state architecture of a large app: server cache, URL, global and local state
- 08Observer pattern vs publish-subscribe: what is the difference?
Lesson, 4 min read, then 5 questions to practise
- Implement an EventEmitter with on, off, emit, and once
- Build a pub/sub bus with wildcard topics: one-word * and multi-word # matches
- Implement a memory-efficient event bus with lifecycle cleanup and leak detection
- Build an async event bus: per-listener timeouts, serial or parallel, and collected errors
- Type an event emitter so on and emit only accept known events and their payloads
- 09What are design patterns in JavaScript and which ones matter for frontend?
Lesson, 4 min read, then 3 questions to practise
- 10What are the SOLID principles, and how do they apply to frontend code?
Lesson, 4 min read, then 4 questions to practise
- Build a tapable-style plugin system: sync, bail, waterfall and async hooks with stages and interceptors
- Implement singleton, factory and strategy patterns idiomatically in JavaScript
- Implement decorator, adapter and proxy patterns in JavaScript
- Compose product filters with the Specification pattern: and, or, not and a readable summary
- 11What is a backend-for-frontend (BFF), and when does a frontend need one?
Lesson, 7 min read, then 6 questions to practise
- Design a backend-for-frontend (BFF) for a page that calls nine services
- Design an internal financial records dashboard: a summary, a searchable history table, partial API failures and accessible errors
- Design a personal finance dashboard like INDmoney: account aggregation, charts, privacy and stale data
- Design SPA authentication: OAuth PKCE, token storage, refresh rotation and multi-tab refresh
- Design authentication and authorization for an internal admin console
- Design an e-commerce product detail page: variants, image gallery and zoom, reviews, recommendations, fresh price and stock, SEO and Core Web Vitals
- 12What is a design system and how do you build one?
Lesson, 4 min read, then 5 questions to practise
- Build a design-token theme editor with live preview, token aliases and WCAG contrast warnings
- Add dark mode with design tokens and no flash on load
- Design a reusable data table component for a design system
- Design an accessible modal dialog component for a design system
- Design a toast notification system for a design system: queueing, priorities, accessibility and an imperative API
- 13What is fractional indexing and why do Kanban boards use it?
Lesson, 7 min read, then 5 questions to practise
- Design a Jira-style issue board for 10,000 issues: virtualised columns, rank keys, live updates and conflicts
- Design a collaborative music playlist: concurrent add, remove and reorder with real-time updates
- Build a drag-and-drop Kanban board
- Build a Trello-like Kanban app supporting nested cards, drag-and-drop, undo/redo, and persistence
- Design a Trello board: lists and cards with drag and drop, a card details modal, live teammate updates and offline edits
- 14What is the command pattern in JavaScript?
Lesson, 4 min read, then 5 questions to practise
- Add undo and redo with the Command and Memento patterns
- Build a HistoryManager class with undo, redo, a size limit and grouped changes
- Implement undo/redo history for a React state editor
- Build a command palette (⌘K) with fuzzy search, ranking and keyboard navigation
- Design a command palette platform for a large app: commands registered by many teams, ranking, permissions and shortcuts
- 16What is the singleton pattern and when is it a bad idea?
Lesson, 4 min read, then 1 question to practise
Chapter 3, advanced
Senior level
Trade-offs, edge cases and the questions senior rounds end on.
- 17How do you answer frontend architecture interview questions?
Lesson, 5 min read, then 1 question to practise
- 18OT vs CRDT: what is the difference for collaborative editing?
Lesson, 8 min read, then 6 questions to practise
- Build operational transformation for plain text: compose, transform, a server history and a client that buffers edits
- Implement a text CRDT (RGA) for collaborative editing
- Build state-based CRDTs: a PN-counter, an add-wins OR-Set without tombstones and a last-writer-wins map
- Design Google Docs: collaborative editing with CRDT or OT, cursors, and conflict resolution
- Build a collaborative rich-text editor with remote cursors and offline synchronization
- Design a collaborative whiteboard like Miro: infinite canvas, shapes, presence, conflict-free edits and performance