Railway Completes Major Frontend Migration from Next.js to Vite + TanStack Router
Key Takeaways
- ▸Railway reduced frontend build times from 10+ minutes to near-instant with Vite's HMR and zero startup overhead, directly improving developer iteration speed
- ▸The migration of 200+ production routes was completed in two PRs with zero downtime by first eliminating Next.js dependencies, then performing a clean framework swap
- ▸TanStack Router's type-safe routing, first-class layouts, and client-first design philosophy aligned better with Railway's actual product architecture than Next.js's server-first paradigm
Summary
Railway has successfully migrated its entire production frontend from Next.js to Vite and TanStack Router, completing the transition in just two pull requests with zero downtime. The migration addressed significant performance bottlenecks, including frontend build times that had exceeded 10 minutes, with Next.js alone accounting for 6 of those minutes. Railway's dashboard, canvas, and railway.com now run on the new stack, serving millions of users monthly.
The engineering team chose TanStack Start + Vite because it better matched their development practices: client-first architecture, explicit control, and fast iteration cycles. Railway's application is predominantly client-side with real-time websocket communication, making Next.js's server-first primitives and the Pages Router's layout limitations increasingly problematic. The old framework offered features the team didn't need while forcing workarounds for functionality that should have been built-in.
The migration strategy proved remarkably efficient. The first PR systematically removed all Next.js-specific dependencies (next/image, next/head, next/router), replacing them with native browser APIs or framework-agnostic alternatives. The second PR performed the actual framework swap, migrating 200+ routes and consolidating configuration. The team dogfooded the changes immediately upon deployment with live monitoring in Discord, shipping critical fixes the same day without any user-facing downtime.
- The engineering team prioritized developer experience and explicit control over framework magic, resulting in cleaner code and more predictable behavior



