Railway migrated its entire production frontend from Next.js to Vite + TanStack Router, completing the switch in just two PRs with zero downtime. The motivation was slow builds (10+ minutes, 6 of which were Next.js), heavy reliance on client-side patterns that didn't fit Next.js's server-first model, and hacky layout workarounds on the Pages Router. The migration was split into two phases: first removing all Next.js-specific APIs, then swapping the framework and generating 200+ routes from the original page tree. Nitro was added as the server layer, consolidating redirects, headers, and caching. Results include builds under 2 minutes, instant dev server startup, type-safe routing, and first-class layouts. Trade-offs include losing built-in image optimization (replaced with Fastly) and ecosystem tools like next-seo (replaced with in-house equivalents). TanStack Start's relative immaturity is acknowledged but accepted.
Table of contents
Table of ContentsNext.js served us well. Then it didn't.Why TanStack Start + ViteTwo PRs, zero downtimeWhat we gave upRailway's frontend runs on RailwayWhy now7 Comments
Sort: