We moved Railway's frontend off Next.js. Builds went from 10+ mins to under two
6 hours ago
- #tanstack-router
- #vite
- #frontend-migration
- Railway migrated its entire production frontend from Next.js to Vite + TanStack Router in two PRs with zero downtime, eliminating 10+ minute build times.
- The decision was driven by Next.js's server-first approach not fitting Railway's client-side, real-time dashboard and canvas, and hacky layout workarounds in the Pages Router.
- TanStack Router offered type-safe routing, first-class layouts, fast dev loops, SSR only where needed, and an explicit model, improving iteration speed.
- The migration involved swapping Next.js-specific dependencies in PR1 and replacing the framework in PR2, using Nitro for the server layer and browser-native APIs.
- Trade-offs included building in-house replacements for Next.js ecosystem tools and accepting TanStack Start's newness, but gains included faster builds, edge caching with Fastly, and better asset management.
- Railway's infrastructure enabled seamless deployment with previews and zero-downtime rollouts, emphasizing that frontend frameworks should prioritize iteration speed and infrastructure invisibility.