Push your Replit code to GitHub, import the repo on Railway, build with As configured in .replit / package.json, add your
environment variables before the first build, add the Caddyfile refresh fallback, allow the new
URL in your auth provider, then connect your domain. Railway: Free Trial: $5 one-time credit for 30 days; then Free plan with $1/month of usage; paid from $5/mo
(checked 17 Oct 2026).
- Replit Secrets and Replit DB don't move with the code — recreate env vars and migrate data first.
Step by step
-
Check your project type
- Static site: Build produces a folder of files (dist/ or build/).
- Web server: Runs a server process (Express, Flask, FastAPI…).
-
Get the code onto GitHub
- Connect GitHub in Account → Connected Services, then use the Git pane in the project to push to a repository.
-
Create the project on Railway
Go to railway.com/new → Deploy from GitHub repo, connect GitHub and choose the repository. Railway detects the build automatically.
-
Check the build settings
A Vite SPA is served as static files; a Node/Python server needs a start command and must listen on
$PORT.For Replit: build command
As configured in .replit / package.json, output For static deploys: the public directory (e.g. dist). -
Add environment variables before the first build
In Railway: Service → Variables tab (frontend
VITE_*values must be present at build time). Copy these from Replit:-
Replit Secrets don't travel with the code — re-create them at the new host.
Changed a value later? Rebuild. Vite bakes variables in at build time. Troubleshoot missing env vars
-
-
Make page refreshes work (Vite / React Router single-page apps)
Caddyfile (or serve -s dist) :{$PORT:3000} { root * dist encode gzip file_server try_files {path} /index.html }Server-rendered projects (TanStack Start, Next.js) don't need this. Railway docs (opens in a new tab)
-
Update login redirect URLs
Add your new Railway URL (and later your custom domain) to your auth provider's allowed URLs. Redirect troubleshooting
-
Add your domain
Service → Settings → Networking → + Custom Domain. Railway gives you a CNAME to add at your DNS provider and issues SSL automatically.
How much does Railway cost for a Replit app?
Limited free Free Trial: $5 one-time credit for 30 days; then Free plan with $1/month of usage. Paid from $5/mo: Hobby: $5/month including $5 of usage, 2 custom domains, 50 projects. Pro: $20/month per workspace. Checked 17 Oct 2026 on Railway's pricing page (opens in a new tab).
- The Free plan can't attach a custom domain — budget for Hobby ($5/mo) if you want your own domain.
Other options for Replit
Related guides
- Custom domain on Lovable, Bolt, Replit and v0: what it costs and how to set it up
- Replit deployment costs: Autoscale vs Reserved VM vs Static, and how to cap your spend
- Supabase vs Neon vs Firebase vs Turso: which database for an AI-built app?
- Cursor Live Apps (November 2026): which plans can host apps, who can open them, and when to still use Vercel or Railway
- Netlify Server (Early Access, November 2026): run an Express, Hono or Fastify backend and WebSockets on Netlify
- Cloudflare spending limits (November 2026): how to put a hard cap on your Workers bill, and what stops when you hit it
- Claude Sonnet 4.5 retires on 30 November 2026: find the calls in your vibe-coded app and switch without new 400 errors