Back to Home

Migration from Next.js to Vite: build 5 times faster

Railway migrated frontend from Next.js to Vite + TanStack Start, reducing build 5 times. Case reveals Next.js scaling issues and client-first stack advantages for production apps.

How Railway sped up the frontend 5 times without Next.js
Advertisement 728x90

Railway Cut Frontend Build Time by 5x: Ditching Next.js for Vite + TanStack Start

Railway’s frontend—comprising dashboards, documentation, and marketing pages—grew to a point where each build took over 10 minutes. Key bottlenecks included:

  • Slow builds: Slowed down CI/CD pipelines and hindered developer productivity.
  • App Router incompatibility: Next.js is built around server-first architecture, but Railway’s product is client-first.
  • Complex configuration: Custom setups went beyond standard use cases like a Vercel-hosted blog.
  • Large bundle size and cold start times: Impacted server-side rendering performance.

These trade-offs become critical in production systems with frequent deployments.

Results of the Migration

Switching to Vite + TanStack Start delivered a 5x+ speedup—builds now complete in under 2 minutes. The team saves hours daily, directly boosting development velocity.

Google AdInline article slot

The announcement sparked a 206-point discussion on Hacker News with 188 comments. Critics argued that issues might stem from architecture rather than the framework, but Railway’s real-world results validate the migration’s value for their stack.

The Shift Away from Next.js

Railway joins a growing trend among large-scale projects:

  • Kent C. Dodds: Moved from Next.js to Remix (later integrated into React Router 7).
  • Massive shift: Projects are adopting Vite + React or SvelteKit for faster builds.

Next.js excels for Vercel deployments and standard patterns. But in large client-first apps with custom infrastructure, the downsides—complex config, bloated bundles—outweigh SSR/SSG benefits.

Google AdInline article slot

| Metric | Next.js | Vite + TanStack Start |

|--------|---------|------------------------|

| Build Time | 10+ min | <2 min |

Google AdInline article slot

| Architecture | Server-first | Client-first |

| Infrastructure Flexibility | Low | High |

When Migration Makes Sense

While Next.js remains the most popular React framework, scalability exposes its limitations:

  • If builds take minutes, stay put.
  • If builds exceed 10 minutes and you deploy frequently, test alternatives.
  • Evaluate DX: if you’re not using key features (e.g., App Router), your stack may be outdated.

Vite delivers instant HMR and lightning-fast builds without vendor lock-in. TanStack Start adds routing and state management with zero overhead.

Key Takeaways

  • 5x speed boost: Real time savings in CI/CD for high-velocity teams.
  • Client-first focus: Vite + TanStack Start fits dashboards and interactive products better.
  • Scaling trend: Next.js is losing ground in non-Vercel environments.
  • Trade-offs matter: Migration pays off when build time or infrastructure is a bottleneck.
  • Prove it first: Test metrics before switching—don’t chase hype.

For mid-to-senior devs, this is a signal: monitor build times and ensure your framework aligns with your project’s architecture. Railway shows how optimizing your tech stack directly boosts productivity.

— Editorial Team

Advertisement 728x90

Read Next