We moved Railway's frontend off Next.js. Builds went from 10+ mins to under 2
TL;DR Highlight
Moving off Next.js to Vite + TanStack cut Railway's frontend builds from 10+ minutes to under 2
Who Should Read
A frontend developer running a client-heavy dashboard whose Next.js builds take over 10 minutes
Core Mechanics
- Next.js took 6 of 10 minutes
- Frontend builds passed 10 minutes, and 6 of them were Next.js alone.
- Half of that was stuck on "finalizing page optimization."
- The app is client-first, so it didn't fit
- The dashboard is stateful, the canvas is real-time, and websockets are everywhere.
- They didn't use server-first features and built their own layout abstractions on the Pages Router.
- App Router wasn't the answer either
- App Router leans heavily on server-first patterns.
- Adopting it meant rebuilding around a paradigm they don't need.
- 200+ routes moved in two PRs
- PR 1 replaced next/image, next/head, and next/router with browser APIs or framework-agnostic alternatives.
- PR 2 swapped the framework, migrating 200+ routes and adding Nitro as the server layer.
- Redirects (500+), security headers, and caching rules were consolidated into Nitro config.
- They gave things up
- next/image became <img> tags plus Fastly image optimization at the edge.
- next-seo and next-sitemap were replaced with small in-house tools.
- They admit TanStack Start is new and may have rough edges.
- Vite's asset model helps caching
- Each module gets a content-hashed chunk, so a billing change only invalidates that chunk.
- Returning users download kilobytes, not megabytes.
Community Reactions
- Commenters reproduced the build gains
- One said their CI build on Vite + TanStack Router dropped from 12 minutes to about 2.
- Another migrated a ~200-page Turbopack, Pages Router app and saw builds go from 2.5 minutes to 25 seconds, with near-instant dev compiles.
- Railway's own site still feels heavy, commenters said
- One reported the domains page loaded 10.8MB, with DOM ready in 2s and full render in 17s.
- Another said the blog loads many JS chunks and could be a static site.
- Commenters flagged missing context
- Several noted the post never mentions the Next.js version or whether Turbopack was used.
- One reminded readers that Next.js is made by Vercel, a Railway competitor.
- Commenters said AI agents make migrations easier
- One moved landing pages from Next.js to Astro with AI in a few days.
- Another used agents to plan, implement, and verify a move from Electrobun to Tauri in a couple of hours.
How to Apply
- Break down your build time by stage today
- Check your CI logs for what share of the build is the Next.js step.
- List per route whether you actually use server-first features like App Router or server components.
- Remove Next-specific API dependencies first
- Grep for next/image, next/head, and next/router, and replace them with browser APIs or neutral libraries in a separate PR.
- Merge it without changing the framework to keep the swap PR small.
- Consolidate redirects, headers, and caching in one place
- Extract the redirects, security headers, and cache rules from next.config.js into a list.
- Plan to move them into the target server layer's config (e.g., Nitro).
- List what you will lose in advance
- Write down what Next provided, such as image optimization, SEO, and sitemaps, and choose replacements.
- Check whether images can move to edge CDN optimization.
Try It
# Paste into Claude Code or ChatGPT (a lite version of the article's migration approach)
You are a frontend migration consultant. Here is our Next.js project info.
- Next version/router: {{Pages Router or App Router, version}}
- Number of routes: {{number}}
- Current build time and CI environment: {{details}}
- Places using server components, server actions, or SSR: {{list}}
Answer in order:
1. Assess whether our app is client-first or uses server-first features, with reasons
2. Grep commands to find Next-specific API usage such as next/image, next/head, next/router
3. A plan split into PR 1 (remove Next-specific dependencies) and PR 2 (swap the framework)
4. Features we would lose (image optimization, SEO, etc.) and replacements
Do not invent numbers or estimated build times.Terminology
Related Papers
A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth
Install Unsloth Desktop, load a quantized Qwen model, and share a private ChatGPT-like AI on your home LAN.
Muru – AI-assisted Rust server for Python apps by mod_WSGI's creator
mod_wsgi's creator is building Muru, an AI-assisted Rust ASGI/WSGI server, documenting it in public
87% of the Anthropic power will come from gas and 11% from coal in 2028
Analysis of Anthropic's contracted data centers: 87% gas, 11% coal power in 2028
Anthropic’s Nasdaq debut
Anthropic listed on Nasdaq and closed its first day below its opening price.
OpenAI still has a WebRTC Problem
WebRTC drops late audio, hurting voice AI; MoQ retransmits and buffers instead
Gemini 4 Neon
Gemini 4 Neon cuts cost per task 32% versus Carbon, at $3 input and $15 output per million tokens
AI is killing All About Berlin
After Google AI Overviews, a Berlin guide site lost 70-75% of its traffic.
Not Everything Needs an LLM
PostHog used small decision models to skip 98.7% of expensive LLM calls