---
title: "How to Migrate from Cloudflare Pages to Railway"
description: "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."
url: "https://swe.quest/articles/how-to-migrate-from-cloudflare-pages-to-railway-c434bad6d6a93d97"
canonical: "https://blog.railway.com/p/migrate-from-cloudflare-pages-to-railway"
source: "Railway"
published: "2024-12-13"
difficulty: "medium"
kind: "How-to"
reading_minutes: 9
tags: ["deployment","serverless","containers","javascript"]
---

# How to Migrate from Cloudflare Pages to Railway

A post on [Railway](https://swe.quest/sources/railway.md), published 2024-12-13, 9 min read, How-to. Original: [https://blog.railway.com/p/migrate-from-cloudflare-pages-to-railway](https://blog.railway.com/p/migrate-from-cloudflare-pages-to-railway)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)

## Prerequisites

- Git and GitHub CLI ([easy posts on Developer tools](https://swe.quest/tags/developer-tools.md?difficulty=easy))
- Node.js and npm ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))
- Nginx configuration basics ([easy posts on Configuration management](https://swe.quest/tags/configuration.md?difficulty=easy))
- Dockerfiles

## Keywords

Railway, Cloudflare Pages, Nixpacks, Nginx, Express, Next.js, Docker

## Related posts

- [Moving Railway's Frontend Off Next.js](https://swe.quest/articles/moving-railway-s-frontend-off-next-js-a0f8a20e0dc7a7ef.md): Railway · 2026-04-03 · Medium · 5 min read · Frontend, React, Refactoring & migrations, Build systems, CDN & edge
  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.
- [Migrating From Heroku To Railway](https://swe.quest/articles/migrating-from-heroku-to-railway-dbd89b10c75a9d07.md): Railway · 2022-08-19 · Medium · 7 min read · Deployment, Cloud platforms, Ruby
  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.
- [Build and Deploy a Global Serverless Nuxt SSR App with Cloudflare Hyperdrive and Postgres](https://swe.quest/articles/build-and-deploy-a-global-serverless-nuxt-ssr-app-with-cloudflare-hyperdrive-32566cf4580232ef.md): Neon · 2024-04-05 · Medium · 12 min read · Serverless, PostgreSQL, CDN & edge, JavaScript, Caching
  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.
- [Railway vs Cloudflare: How Their Architectures Differ and When to Use Each](https://swe.quest/articles/railway-vs-cloudflare-how-their-architectures-differ-and-when-to-use-each-da6a8e4c1e4636fe.md): Railway · 2025-11-28 · Medium · 15 min read · Serverless, CDN & edge, Cloud platforms, System design, Containers
  Railway and Cloudflare's Developer Platform feel similar on the surface but rest on opposite compute models.
- [Server rendering benchmarks: Railway vs Cloudflare vs Vercel](https://swe.quest/articles/server-rendering-benchmarks-railway-vs-cloudflare-vs-vercel-d854a3e98b5ee41e.md): Railway · 2025-10-20 · Medium · 10 min read · Performance engineering, Serverless, JavaScript, Cloud platforms
  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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
