Menu

1 / 2

From an Express SPA to Next.js 16: A Test-First Strangler Fig Migration of a Shared Auth System

DEV Community: nextjs·Henry Lee·1 day ago
#OWu0djLN
#devtonextjs#devto#dev#next#code
Reading 0:00
15s threshold

I worked on a frontend team that owned the unified account system for a group of creative-industry products. One login, several services — so if auth breaks, everything breaks.

This post walks through how we moved that system from an Express-served React SPA to Next.js 16 (App Router) without a big-bang rewrite, and why the very first thing we wrote wasn't application code, but E2E tests.

The starting point

The account system was a React SPA served by an Express server. It had run reliably for years, but the Express server had slowly absorbed too many responsibilities, all hard-coded in one place:

API routing

Session management

Injecting meta tags for SEO

Two problems followed:

Poor separation of concerns. One server doing everything meant every change touched the same tangled code.

Rising maintenance cost. With every new feature it was unclear where code should live. Components were mixed together, and business logic was tightly coupled to UI.

Big bang vs.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.