Work at Siteimprove · MarketMuse
Breaking up a legacy React monolith
One large app, broken into small container-level features in Nx, layered so dependencies point one way.
- Context
- The product's frontend was one large Create React App application.
- Role
- Lead Frontend Developer. I moved it and kept it current through major Nx upgrades.
Decisions
- Chose a Next.js proof of concept over committing to the move up front, because it settled the question before we paid for it: we decided not to use Next.js.
- Chose one domain per sub-app, each with its own feature, state, data and UI packages over domain-agnostic components, following enterprise guidelines for multi-domain apps over letting any library import any other, because dependencies only ever point one way.
- Chose deploying based on what a change depends on, and caching packages between deploys over rebuilding everything on every deploy, because only the packages that changed had to be rebuilt.
- Made shared base packages isomorphic, working under both SSR and React Server Components.
- Code-split heavy features and the rich-text editor, lazy-loaded third-party scripts, and memoized expensive tables and heatmaps.
- Upgraded to React 18, and moved Jest to SWC for a faster test suite.
Links and tags
- Where it fits in my experience
- Internals are left out, and the figure is generic.
- React
- TypeScript
- Nx
- SSR
- React Server Components
- Jest