Best-practice Codex workflow for refactoring a 117k LOC Next.js app (JS → TS + design system)

Question

Hi r/codex , I’m looking for a serious Codex-first strategy for a large-scale refactor.

Context:

• Next.js + React app

• ~117k LOC

• Mostly JavaScript

• Heavy inline CSS

• Inconsistent component patterns

• Ongoing feature work (can’t freeze dev)

Goals:

  1. Incremental JS → TypeScript migration
  2. Introduce a proper component library / design system
  3. Remove inline styles + harmonize UI
  4. Keep PRs small and safe

What I’m Trying to Avoid:

• Big-bang refactors

• Codex touching unrelated files

• Massive diffs

• Subtle runtime changes

• Losing visual consistency

Any workflow tips are welcomed!

Posted Feb 20, 2026, 4:31 PM UTC

24
Loading comments…