← all posts
project6 min·September 7, 2026

Six frontends, one app, (mostly) zero rewrites

consolidating heterogeneous React, Vite, and vanilla-JS projects into a single Next.js app

Six products, six stacks, six copies of node_modules on one server. The job was to make them one app without rewriting them all. Here is how the merge actually went.

why merge at all

Each product was hosted separately, and every one dragged its own copy of node_modules onto the server. Folding the frontends into one app was mostly a storage and deployment win, so the rule was clear: consolidate, do not rewrite.

the zoo

The six were not remotely alike. Next 14, Next 16, a Create React App project, a Vite plus React project, a vanilla Vite JS app, and a QA tool that was not a product UI at all. React 18 next to React 19, Tailwind v3 next to v4. Merging that by hand is mostly a negotiation between defaults.

the approach

One Next.js App Router app, each product a route section under its own folder, one central package.json, and backends left remote and reached over env-configured URLs so no server code lived in the repo.

  • React projects moved under app route groups; the vanilla JS app was mounted as a client island rather than rewritten.
  • Component name clashes were fixed by prefixing only genuine same-folder collisions, not blanket renames that would corrupt UI labels.
  • A react-router SPA kept its own router internally via a basename, so its links worked at its sub-path with zero route edits.

the sharp edges

  1. A react-router app read the window object during render, so Next server-rendering crashed until I loaded it with server-side rendering disabled.
  2. Two projects defined conflicting theme tokens at the root, so each project's CSS was scoped under its own section to stop the bleed.
  3. Tailwind v3 and v4 had to coexist, so route-scoped CSS kept each project's styles from leaking into the others.

outcome

One app, a green build across every route, each product still booting with its own design intact. Deployment turned into a single pull and build instead of six.

Merging is less about clever architecture and more about refusing to rewrite things that already work.