Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Railway 5 min read Case study mediumAdept

Moving Railway's Frontend Off Next.js

Railway migrated its entire production frontend (dashboard, canvas, marketing site, 200+ routes) from the Next.js Pages Router to Vite + TanStack Router/Start in two PRs with zero downtime. The first PR removed all Next.js-specific dependencies such as next/image, next/head and next/router. The second swapped the framework, generating routes from the original page tree, moving 500+ redirects, headers and caching rules into Nitro config, and replacing Node polyfills with browser-native APIs. Builds dropped from over 10 minutes to under two. Railway gave up built-in image optimization (now handled by Fastly at the edge) and some ecosystem plugins, and accepted the immaturity of TanStack Start.

Related posts

  • How to Migrate from Cloudflare Pages to Railway

    Railway mediumAdept

    Moving a site from Cloudflare Pages to Railway follows one shared procedure: link the GitHub repo to a Railway service, set environment variables and build/start commands, deploy, then delete the Cloudflare project. Six cases are handled separately: direct-upload sites, SSG framework presets served by Nginx via a Nixpacks start command, and SSR frameworks that need Cloudflare adapters such as @cloudflare/next-on-pages and edge runtime declarations removed. Pages Functions are rewritten as an Express server, and _redirects and _headers files are replaced with an nginx.conf in an Nginx Dockerfile.

  • Why We Ripped Twin out of 400+ Components

    Railway mediumAdept

    Railway replaced twin.macro with vanilla Tailwind across 400+ React components, which removed the last dependency on Babel and let the monorepo move fully to SWC. Dev cold starts dropped from ~35s to ~1.5s, a full build from 220s to 42s, and CI from 4-6 to 2-4 minutes. The migration took ~30 PRs with a codemod and custom helpers. Nested selectors moved to Tailwind-processed CSS files, theme() calls became CSS variables, and Twin's inline-style precedence and automatic merging were handled by migrating pages first and core components last, using `!` overrides and tailwind-merge.

  • What We Learned Migrating From Webpack to Vite

    Neon mediumAdept

    Neon moved its console, a set of SPAs whose HTML is rendered by a Go backend, from webpack to Vite. Because the backend generates the HTML, they built a ~150-line custom proxy on Vite's JS API and http-proxy that swaps production asset tags (marked with HTML comments) for Vite dev imports to enable HMR, while E2E tests bypass the proxy and use production bundles. Build time did not improve (20s to 22s) and cold dev page loads got slower (~1500 files), but the migration removed 17 direct dependencies, added HMR and unified config with Vitest and Storybook. Gotchas included the SWC React plugin panicking on syntax errors, CSS preload errors in production, entry-point name clashes with API routes, CSP adjustments for Vite's WebSocket and undefined process.env.

  • Remixing Shopify's Admin: How We Made It 30% Faster and AI-Ready

    Shopify Engineering mediumAdept

    Shopify migrated its Admin (67 million daily page views, 101 teams, ~350 PRs merged daily, 3M+ lines of TypeScript) to Remix in SPA mode with Vite. The result is a 30% improvement in perceived load times. Statically globbed, typed route manifests replaced a runtime getRoutes function and give Search and Sidekick a single source of truth for all 1,017 routes. Remix loaders remove the code-then-data waterfall by fetching a 3.2kb loader in parallel with a 914kb component bundle, and idle-time prefetching of loaders warms an Apollo cache persisted in IndexedDB. Adding Remix actions and zod schemas lets the Sidekick AI fill and submit forms without loading UI JavaScript.

  • Server rendering benchmarks: Railway vs Cloudflare vs Vercel

    Railway mediumAdept

    Running Theo Browne's SSR benchmark suite (400 requests, 20 concurrent connections, from an EC2 client in us-west-1) against Railway with 10 replicas, Cloudflare Workers and Vercel Functions gave mixed results. Railway won SvelteKit and Vanilla JS by roughly 3-4×, React SSR was close, and Vercel and Cloudflare led on Next.js and the math workload. Bun beat Node on Railway for most tests but lost on math. Next.js is limited to a single CPU core, so it only scales horizontally. Node also builds V8 without a faster trig-function path that Workers enables, and container runtimes cost about 40% versus native, a gap Railway expects a new VM runtime to close.

The quest for software engineering knowledge.

Look:
Layout: