LS·201
Phase 5 — Frontend
The fifth phase: HTML, CSS, JavaScript, the browser, HTTP, TypeScript, React, Angular awareness, testing, accessibility, performance and security, ending with a production dashboard connected to your backend; the order and why, an entry check, step-by-step exit checks mapped to Volume 2, the project with milestones and definitions of done, traps, a time budget, and a lab measuring how a dashboard should fetch its data.
Start here: Phase 5 in one page
A backend is only as useful as the interface people use it through. Phase 5 builds frontend skill from the platform up: the web's own languages first, then the browser that runs them, then TypeScript and React for building real applications, then the qualities that separate a demo from a product (tests, accessibility, performance, security). The project connects a production-quality dashboard to the backend you built in Phases 2–4.
The sequence
HTML → CSS → JS → Browser → HTTP → TypeScript → React → Angular awareness → Testing → Accessibility → Performance → Security
Platform before framework: frameworks change every few years, while HTML semantics, CSS layout, the JavaScript event loop and browser rendering don't. React is the main framework; Angular "awareness" (L2) is enough to work in an Angular codebase when you meet one.
A taste of the project
A dashboard showing four widgets (orders, skips, revenue, kitchens), each from an API taking 150 ms, loaded three ways in a real browser:
| Fetching | All widgets shown after |
|---|---|
one after another (await in a loop) |
~620 ms |
all at once (Promise.all) |
~160 ms |
| one aggregated endpoint (the server fetches in parallel) | ~156 ms |
And when the kitchens API failed, Promise.all made the whole dashboard fail; Promise.allSettled showed the three healthy widgets and an error in one. Two lines of code, a 4× speed difference and the difference between a broken page and a degraded one.
How deep to go in Phase 5
Volume 17 defines six mastery levels; Phase 5's exit targets are:
| Topic | Exit level | What that means here |
|---|---|---|
| HTML, CSS, JavaScript | L3 | semantics, layout algorithms, the event loop |
| browser and HTTP | L3 | rendering pipeline, caching, CORS, cookies |
| TypeScript | L2–L3 | type modelling, narrowing, generics |
| React | L3 | rendering model, state, effects, data fetching |
| Angular | L2 | read and change an Angular app |
| testing | L2–L3 | component, integration and end-to-end tests |
| accessibility, performance, security | L2–L3 | WCAG AA, Core Web Vitals budgets, XSS/CSP basics |
The sequence, step by step
| Step | Learn | Read | Exit check |
|---|---|---|---|
| 1 | how the web works; HTML semantics | Vol. 2, Start Here, ch. 12–13 | a semantic, accessible static page |
| 2 | CSS: cascade, box model, flexbox, grid | Vol. 2, ch. 14 | a responsive layout without a framework |
| 3 | JavaScript and the DOM | Vol. 2, ch. 15, 17 | an interactive widget in plain JS |
| 4 | browser internals and networking | Vol. 2, ch. 18–19 | explain a performance trace and a CORS error |
| 5 | TypeScript | Vol. 2, ch. 16 | convert the widget to TypeScript with strict mode |
| 6 | UI architecture, React, state | Vol. 2, ch. 21–22, 25 | a React app with data fetching and loading/error states |
| 7 | Angular awareness; full-stack frameworks | Vol. 2, ch. 23–24 | read an Angular component and explain its change detection |
| 8 | testing | Vol. 2, ch. 26 | component and end-to-end tests in CI |
| 9 | accessibility | Vol. 2, ch. 20 | axe-clean and keyboard-operable flows |
| 10 | performance, security, deployment, observability | Vol. 2, ch. 27–32 | budgets in CI, CSP, RUM |
Entry check
Phase 2's HTTP knowledge and an API to talk to (Phases 2–4's project). No prior frontend experience is needed.
The phase project: a production dashboard connected to your backend
Goal. A React and TypeScript dashboard for your Phase 3–4 application (e.g. TiffinBox operations: orders today, skips, revenue, kitchen status) that you'd be comfortable putting in front of real users.
Milestones. Information architecture and wireframes → typed API client (generated from OpenAPI if possible) → parallel or aggregated data fetching with per-widget loading and error states → authentication with your backend → filters and URL state → charts with accessible alternatives → tests (component, end-to-end with mocked and real API) → accessibility audit → performance budget (LCP, INP, CLS, JS size) in CI → CSP and secure cookies → deployment with real-user monitoring.
Done when. Lighthouse/axe checks pass in CI; one failing API shows one degraded widget, not a broken page; keyboard and screen-reader walkthroughs succeed; field LCP p75 < 2.5 s on a mid-range phone profile; a README documents the architecture.
Stretch. Server-side rendering or React Server Components for the first view, with measured LCP improvement.
Common traps
- Framework first, platform never: problems you can't diagnose later.
- Request waterfalls from sequential awaits and nested components fetching on mount.
- Divs for everything: inaccessible controls.
- No loading or error states.
- Storing tokens in localStorage and no CSP.
Exit criteria
- [ ] The dashboard meets its "done when" list.
- [ ] I can explain the event loop, the rendering pipeline and React's rendering model.
- [ ] I can find and fix a waterfall, a layout shift and an accessibility failure.
- [ ] I can explain CORS, cookies and XSS defences.
- [ ] I scored at least 80% on 40 questions from Volume 2's quizzes, twice.
Time budget
Volume 2 is about 166,000 words (about 12 hours of reading); with practice, about 48 hours, plus 3–4 weeks for the project: about 3.5 months at 8 hours a week. If you're backend-focused, Volume 17's breadth target (L3/L4) lets you shorten steps 7 and 10.
Lab: how a dashboard should fetch its data
Setup. A FastAPI backend on the lab machine with four endpoints (/api/orders, /api/skips, /api/revenue, /api/kitchens), each taking 150 ms, and an aggregated /api/dashboard that calls all four concurrently on the server; a switch makes /api/kitchens return 500. Chromium (Playwright) loads a dashboard page three times per strategy and records the time until every widget's data has arrived.
Experiment 1: waterfall vs parallel vs aggregate
| Strategy | Code | All widgets ready (3 runs) |
|---|---|---|
| waterfall | for (const n of names) await get(n) |
619 / 620 / 623 ms |
| parallel | await Promise.all(names.map(get)) |
166 / 157 / 160 ms |
| aggregate | await get('dashboard') |
156 / 156 / 156 ms |
The waterfall's time is the sum of the four latencies; the parallel version's is roughly the maximum. Waterfalls also hide in component trees: a parent that fetches, then renders children that each fetch on mount, creates the same chain with no await loop in sight. React Query/SWR prefetching, route-level loaders and server components exist largely to remove them.
On a real network the aggregate endpoint pulls further ahead: four requests from a phone on a 100 ms-RTT network pay connection and request overhead four times (less with HTTP/2 multiplexing), while one request pays it once, and the server's calls to its own services are cheap.
Experiment 2: one failing dependency
/api/kitchens returns 500:
| Strategy | Result |
|---|---|
Promise.all |
the whole dashboard failed (Error: kitchens 500) after 160 ms |
Promise.allSettled, rendering each widget from its own result |
1 widget failed, 3 shown after 159 ms |
Partial failure is the normal state of a dashboard that depends on several services. Design each widget with loading, empty, error and stale states; in React, wrap widgets in error boundaries and let each own its data request. The aggregate endpoint needs the same care on the server: return partial results with per-section errors rather than a single 500.
Try it yourself
- Throttle the network to "Slow 4G" in Chromium and rerun all three strategies.
- Rewrite the page in React with one component per widget fetching its own data, then find and remove the waterfall a parent fetch creates.
- Make the aggregate endpoint return partial results when one source fails.
- Add a 5 s timeout per widget with
AbortControllerand a retry button.
Revision sheet: Phase 5, frontend
Key ideas
- Sequence: HTML → CSS → JS → browser → HTTP → TypeScript → React → Angular awareness → testing → accessibility → performance → security.
- Platform first; frameworks second.
- Fetch in parallel or aggregate; avoid waterfalls; isolate failures per widget.
- Production quality: loading/error states, accessibility, budgets, security, RUM.
Numbers to remember
- Lab: four 150 ms requests: sequential ~620 ms, parallel ~160 ms, aggregated ~156 ms.
- Lab:
Promise.allfailed the whole page on one 500;allSettledkept 3 of 4 widgets. - Budget: ~48 study hours + 3–4 project weeks ≈ 3.5 months at 8 h/week.
Pitfalls
- Hidden waterfalls in component trees.
- All-or-nothing error handling.
- Inaccessible custom controls.
- Tokens in localStorage, no CSP.
Glossary
- Waterfall: requests that wait for each other unnecessarily.
- BFF: backend for frontend.
- Error boundary: a React component that catches rendering errors in its subtree.
- RUM: real-user monitoring.
- CSP: Content Security Policy.