Skip to content

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

Railway 9 min read How-to mediumAdept

How to Migrate from Cloudflare Pages to Railway

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.

Related posts

  • Moving Railway's Frontend Off Next.js

    Railway mediumAdept

    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.

  • Migrating From Heroku To Railway

    Railway mediumAdept

    Moving a Heroku app to Railway comes down to three steps: deploy from a GitHub repo, import Heroku config vars, and add Postgres and Redis as separate database services. Railway reads the repo's Procfile and turns each named process (e.g. web, worker) into its own service, which takes the place of Heroku's dyno process model. It injects DATABASE_URL and REDIS_URL automatically, so any imported Heroku copies of those variables must be deleted or they will override Railway's. The guide also covers `railway run` for running commands like migrations against cloud variables, `railway up` for CLI deploys, and having apps listen on 0.0.0.0:$PORT so Railway can expose them.

  • Build and Deploy a Global Serverless Nuxt SSR App with Cloudflare Hyperdrive and Postgres

    Neon mediumAdept

    A Nuxt SSR app on Cloudflare Pages can query Neon Postgres through Hyperdrive by routing Drizzle's pg-proxy driver to a separate Hono-based Cloudflare Worker that holds the Hyperdrive binding and runs queries with node-postgres. The detour through a Worker exists because Pages Functions don't fully support node-postgres yet, which breaks local Nuxt builds. The walkthrough covers the nitro cloudflare-pages preset, creating the Hyperdrive config from a pooled Neon connection string, wrangler.toml with node_compat, the Worker's /query endpoint, and the Drizzle proxy driver. Hyperdrive's default cache serves responses for 60 seconds with a 15-second stale-while-revalidate window. The example endpoints are unauthenticated and must be locked down before production use.

  • Railway vs Cloudflare: How Their Architectures Differ and When to Use Each

    Railway mediumAdept

    Railway and Cloudflare's Developer Platform feel similar on the surface but rest on opposite compute models. Railway runs long-lived regional containers with stable in-memory state, persistent volumes and up to 32 vCPU/32 GB per instance. Cloudflare Workers are edge-first, single-threaded V8 isolates capped at 128 MB memory and CPU-time limits, with no filesystem or reliable global state, so state needs Durable Objects, KV, D1, R2 or external databases via Hyperdrive. The recommended pattern is to combine them, with Cloudflare as the global front door (CDN, caching, routing, security) and Railway hosting stateful backends, databases and long-running work.

  • 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: