Understanding the present, shaping the future.

Search
LA ERA · Tech
Technology

Railway Ditches Next.js, Fully Migrates to Vite and TanStack Router

Cloud platform Railway recently announced that it has fully migrated its production frontend from Next.js to Vite and TanStack Router, completing the overhaul with zero downtime.

Alex Chen

2 min read

Railway Ditches Next.js, Fully Migrates to Vite and TanStack Router
A computer screen displaying programming code.

Cloud platform Railway announced earlier this month that its entire production frontend—including its dashboard, canvas, and website—has officially moved away from the Next.js framework in favor of a Vite and TanStack Router tech stack. This massive migration was completed in just two pull requests, with zero service downtime throughout the process.

Railway developer Victor Ramirez noted in a blog post that while Next.js helped the platform reach millions of users in its early stages, its build efficiency became a bottleneck as the product scaled. According to the team, frontend build times once exceeded 10 minutes, with the "page optimization" phase alone taking 6 minutes—a significant time sink for a team that pushes code frequently.

A Shift Toward Client-Driven Needs

Railway’s core products—its dashboard and real-time canvas—rely heavily on client-side interaction and WebSocket communication, which diverged from the server-side rendering (SSR) focus of Next.js. Ramirez explained, "The server-first model of Next.js didn't suit us. We were constantly hacking together custom solutions for layout and routing, and the introduction of the App Router would have forced us to refactor into a server-side paradigm we didn't need."

To boost developer productivity, the team ultimately chose TanStack Start and Vite. Ramirez stated that the new setup offers type-safe route exports, near-instant Hot Module Replacement (HMR), and much greater control. For marketing pages that genuinely require SSR, the team selectively retained server-side rendering, while the rest of the application has fully transitioned to client-side rendering.

The migration was compressed into two phases. In the first, the team stripped all Next.js dependencies from the codebase, replacing them with native browser APIs or framework-agnostic alternatives. In the second, they systematically refactored over 200 routes and introduced Nitro as a unified server layer to handle redirects, security headers, and caching rules.

Despite losing the convenience of the Next.js ecosystem, the Railway team believes the trade-off is worth it. They replaced the `next/image` optimization feature with Fastly edge computing and built lightweight internal tools to replace SEO-related plugins. While TanStack Start is still maturing, its developer experience aligns perfectly with the team's desire for low-level control.

Ramirez emphasized that this migration was more than just a tech stack swap; it was a stress test of Railway’s own platform capabilities. The entire process was executed on Railway’s own infrastructure, leveraging the platform’s preview deployments and health checks to ensure a seamless transition during a complex architectural overhaul.