HeadlinesBriefing favicon HeadlinesBriefing.com

Railway swaps Next.js for Vite, slashing build times

Hacker News •
×

Railway has replaced the Next.js stack that powered its dashboard, canvas and railway.com with a Vite‑based build and TanStack Router. The swap cut frontend build times from more than ten minutes—six of which Next.js spent finalizing page optimization—to under two minutes. Developers now see instant hot‑module replacement and near‑zero startup latency, a dramatic productivity boost.

The team found Next.js increasingly misaligned with Railway’s client‑first architecture. The product relies heavily on websockets and rich stateful UI, while the Pages Router forced hacky layout workarounds and unused server‑first primitives. TanStack Start offered type‑safe routing generated from the file system, composable pathless layouts, and an explicit model that let the codebase stay fully client‑side except for a few SSR pages.

Migration unfolded in two pull requests with zero downtime. The first stripped all Next.js‑specific APIs—next/image, next/head, next/router—and replaced them with native browser equivalents. The second introduced the new framework, moved 200 + routes into TanStack’s file‑based router, and swapped next.config.js for Nitro configuration, consolidating 500 + redirects and security headers. Fastly now serves edge‑cached assets, so only changed chunks are redeployed, keeping server load minimal.