openaienmodel: gpt-5-mini-2025-08-07
Incrementally Adopting Next.js
Key Points
- Mount Next.js under a subpath using basePath
- Use rewrites to proxy legacy routes to your existing app
- Scale with micro-frontends and monorepos on Vercel
Summary
Incrementally adopt Next.js into an existing application to modernize without a full rewrite. The article outlines three practical strategies—subpath mounting, rewrites/proxying, and micro-frontends via monorepos/subdomains—that let you add React/Next.js pages gradually, improve Core Web Vitals, and increase developer productivity with minimal disruption.
Key Points
- Subpath: Host a Next.js app under a specific path (e.g.,
example.com/store) and setbasePathinnext.config.jsso assets and links resolve correctly. - Rewrites: Serve Next.js at the root and use
rewritesto proxy unknown routes to your legacy app; Next.js handles new pages while existing routes remain intact. - Micro-frontends & Monorepo: Split frontend work into smaller apps deployed on subdomains from a monorepo (Vercel supports branch previews and simplified CI/CD).
- Benefits: Enables incremental migration, preserves existing functionality, improves page load and Core Web Vitals, and speeds developer feedback with Fast Refresh and deploy previews.
Practical next steps
- Start small: pick a single section (marketing page, store) and implement it with
basePathorrewrites. - Configure
next.config.jsand test routing locally before switching proxies or DNS. - When scaling, adopt a monorepo + Vercel workflow to enable subdomain deployments, branch previews, and simpler CI/CD.