STACK
Ch 05 · Frontend Stack
Chapter 05 · The user surface

Frontend Stack — web, mobile, desktop

Frameworks, rendering modes, state, styling, build tools, mobile, design systems, accessibility, performance budgets, testing. Everything that runs on the user's device.

5.1 · Web frameworks (2026)

FrameworkSweet spotWatch out
Next.js (React)Default for most product apps; App Router + RSC + Server Actions + Turbopack.Vercel pull; RSC mental model.
Remix / React Router 7Web-platform-first; great forms & nested routing.Smaller ecosystem than Next.
AstroContent sites; islands; ship ~0 KB JS by default.Not a SPA framework.
SvelteKitSmaller bundles, simpler model; great DX.Smaller hiring pool.
Nuxt (Vue)Vue ecosystems; strong in EU/Asia.Less momentum than Next.
SolidStartFine-grained reactivity; very fast.Tiny community.
QwikResumability — near-instant TTI on huge apps.Adoption slow.
HTMX + server templatesServer-rendered apps with surgical interactivity.Not for rich SPAs.
AngularEnterprise apps; opinionated; signals in v17+.Heavy footprint.
Phoenix LiveViewReal-time UI over WebSocket; no JS framework needed.Elixir-only.

5.2 · Rendering modes

SSG Build-time HTML ★ fastest TTFB ✗ rebuild on change ISR Re-gen on demand ★ fast + fresh ✗ cache complexity SSR Per-request HTML ★ personalised ✗ server cost RSC Streamed server components ★ small JS bundle ✗ paradigm shift SPA Client renders ★ rich UX ✗ slow first paint

5.3 · State management

LibFor
Built-in React state + ContextMost components; don't over-engineer.
Zustand / JotaiSmall global stores without Redux ceremony.
Redux ToolkitBig apps with complex flows.
TanStack Query / SWRServer state — caching, dedupe, mutations, polling.
XStateState machines for complex flows.
Signals (Solid / Preact / Vue ref)Fine-grained reactivity.

Default: server state via TanStack Query, client state via Zustand or built-ins.

5.4 · CSS & design systems

ApproachPicks
Utility-firstTailwind CSS (default 2026); UnoCSS.
CSS-in-JSVanilla-extract, Panda CSS, Emotion.
Headless component libsRadix UI, Headless UI, React Aria.
Full UI libsshadcn/ui (copy-paste, owns the code), MUI, Mantine, Ant Design.
Design tokensStyle Dictionary, Tokens Studio — sync Figma ↔ code.

5.5 · Data fetching

  • Default: server-component fetch + Server Actions in Next 15+.
  • Client-side: TanStack Query / SWR.
  • Typed end-to-end: tRPC (TS monorepo) or generated clients from OpenAPI / GraphQL.
  • Streaming + Suspense: skeletons fast, hydrate progressively.

5.6 · Build tools

ToolWhere
ViteSPA / library dev. Fast HMR. The default 2026 dev server.
TurbopackNext.js bundler (Rust). Production-grade.
esbuild / swcUnderneath everything fast.
BunJS runtime + bundler + package manager + test runner.
Rspack / RolldownRust-based Webpack/Rollup replacements.

5.7 · Monorepos

ToolNotes
pnpm workspacesCheap, fast, the default base.
TurborepoCached task runner for JS/TS monorepos.
NxPolyglot, opinionated. Strong for very large orgs.
Moon / LageNewer alternatives.
Bazel / PantsHermetic, cross-language; massive scale.

5.8 · Performance — Core Web Vitals

MetricWhat it measuresGood target
LCPLoading (largest content paint)< 2.5s
INPResponsiveness (interaction → next paint)< 200ms
CLSVisual stability (layout shift)< 0.1
TTFBServer response time< 800ms
Initial JSWhat ships first request< 150 KB gzipped

5.9 · Accessibility & i18n

  • WCAG 2.2 AA baseline. Test with axe + manual keyboard.
  • Semantic HTML first; ARIA second.
  • Keyboard focus visible; tab order matches reading order.
  • i18n via ICU MessageFormat (FormatJS, lingui, next-intl). Pluralisation, RTL, locale-aware dates.

5.10 · Testing

  • Unit — Vitest / Jest.
  • Component — Testing Library + Storybook stories-as-tests.
  • E2E — Playwright (default 2026).
  • Visual regression — Chromatic, Percy.
  • Synthetic — Checkly, Datadog Synthetics.

5.11 · Mobile & cross-platform

OptionOne-line
Native (Swift / Kotlin)Best perf + platform fidelity; double the team.
React Native + ExpoReact mental model; New Architecture is solid; OTA updates via EAS.
FlutterSingle rendering engine, pixel-perfect everywhere; Dart.
Kotlin Multiplatform / Compose MultiplatformShare logic, optionally UI.
PWACheapest; weak on hardware features & iOS install UX.

5.12 · Desktop apps

ToolNotes
ElectronChromium + Node; big but mature.
TauriRust + native webview; small binaries, fast.
WailsGo + native webview.
Flutter DesktopSingle codebase from mobile.
SwiftUI / WinUI / GTK / QtNative per-platform.

5.13 · Self-check

Q1 · The right tool for server state (caching, dedupe, refetch) in React is…
Redux
TanStack Query / SWR
Context only
localStorage