Platform Engineering
React 18 migration
A seven-day sprint that cut platform Time to Interactive from 7.2 seconds to 2.
- Client
- Internal platform migration
- Role
- Migration lead
- Timeline
- 7 days
- Team
- 2 frontend engineers
Problem
28 modules running on React 17, a 4.1MB initial bundle, and a Time to Interactive of 7.2 seconds. Sales calls were ending before the demo finished loading.
I scoped the work to seven calendar days. The bet was that we could ship a feature-module structure with locked surfaces, a config-driven router, route-level React.lazy, and no actual feature changes. The hardest part was resisting the urge to refactor anything that did not directly enable the perf win.
Constraints
- 7 calendar days, fixed.
- Zero regressions.
- Material UI enforced.
- Lighthouse must verifiably improve.
Decisions
Chose
Feature modules with locked public surfaces
Considered
Flat src/ tree or a DDD rewrite
Why
Flat trees age badly. A DDD rewrite would have blown the deadline by months. Feature modules with locked imports gave us the cleanup wins without rewriting the platform.
Chose
Single navigationConfig drives sidebar and routing
Considered
Hardcoded sidebar plus a separate route table
Why
Two sources of truth always drift. One config kept the sidebar, routes, permissions, and code-splitting in sync forever.
Chose
React Router v6 with React.lazy and Suspense per route
Considered
Router v5 plus manual dynamic imports
Why
v6 made the lazy pattern declarative. Manual imports meant 28 hand-written code-splits, each one a chance to bundle the wrong module.
Chose
memo only where profiling showed a need
Considered
Aggressive memoization across every component
Why
Aggressive memo locks the wrong invariants and slows real renders. Profile-first kept us honest.
Code sample
import type { ComponentType } from 'react'
import { lazy } from 'react'
type ModuleId =
| 'audiences'
| 'campaigns'
| 'consent'
| 'analytics'
| 'chatcdp'
// ... 23 more
type ModuleConfig = {
id: ModuleId
label: string
section: 'identity' | 'engagement' | 'analytics' | 'ai' | 'admin'
icon: ComponentType
component: ComponentType
permissions: string[]
}
export const navigationConfig: ModuleConfig[] = [
{
id: 'audiences',
label: 'Audiences',
section: 'identity',
icon: lazy(() => import('@/icons/audiences')),
component: lazy(() => import('@/modules/audiences')),
permissions: ['audiences:read'],
},
{
id: 'chatcdp',
label: 'ChatCDP',
section: 'ai',
icon: lazy(() => import('@/icons/chatcdp')),
component: lazy(() => import('@/modules/chatcdp')),
permissions: ['chatcdp:read'],
},
// 26 more modules, each one lazy-loaded.
]
// Sidebar + router both derive from this list.
// Sidebar groups by `section`. Router uses `id` as path segment.
// Permissions are enforced at the boundary, not inside the module.Outcomes
- Shipped on day 7, zero regressions in the first month.
- Time to Interactive 7.2s to 2s, verified in Lighthouse.
- Initial bundle size reduced 62%.
- Sidebar reorganized from 3 sections to 6 hubs in the same release.
What I would do differently
- Add a Lighthouse budget to CI from day one. We caught regressions by hand for a month.
- Enforce the locked-import rule with ESLint, not the README.
Stack
Next case study
ModenX
A React Native retail app shipped to both stores in three months with no prior mobile experience.