Vercel is a great platform — for frontends. It pioneered edge-first Next.js hosting, preview deploys, and zero-config static sites. But when your stack grows beyond a landing page and an API route, the cracks appear fast.
At Codmir, we run persistent WebSocket servers, AI agent loops, background workers, voice relay services, and managed databases. After months on Vercel, we moved our backend services to Railway. Here is why — and where each platform actually excels.
1. Persistent Servers vs. Serverless Functions
Vercel runs your backend code as serverless functions. Each request spins up, executes, and tears down. That model works for stateless CRUD, but it falls apart when you need:
- Long-running processes (AI agent loops, batch jobs, build pipelines)
- In-memory state (caches, connection pools, session stores)
- Background workers that run continuously
Railway gives you persistent containers. Your server boots once and stays running. Connection pools stay warm. Background jobs keep executing. In-memory caches actually persist between requests. No cold starts, no 300-second execution limits, no workarounds.
2. WebSockets and Real-Time — First-Class Citizens
Vercel does not support native WebSocket connections. If you need real-time features — presence indicators, live collaboration, voice streaming, agent status updates — you are pushed toward third-party services like Pusher or Ably, adding cost and complexity.
Railway runs standard containers. Socket.IO, raw WebSockets, SSE, gRPC streaming — they all work out of the box with zero configuration. At Codmir, our entire real-time layer (presence, chat, voice relay, agent events) runs on Railway without a single workaround.
3. Built-In Databases and Services
Need a database on Vercel? You are buying a separate service — Vercel Postgres (Neon under the hood), Vercel KV (Upstash Redis), Vercel Blob storage. Each has its own billing, its own dashboard, and its own limits. It adds up.
Railway provisions PostgreSQL, MySQL, Redis, and MongoDB directly inside your project with one click. Same dashboard, same billing, same network. Your database lives next to your server with sub-millisecond latency, not across the internet.
- PostgreSQL with automatic backups
- Redis for caching and pub/sub
- Private networking between services — no public endpoints needed
- Volume mounts for persistent file storage
4. Honest, Predictable Pricing
Vercel's pricing is opaque until you get the bill. Function invocations, edge middleware executions, image optimizations, bandwidth overages, ISR revalidations — each has a separate meter. Teams routinely report surprise bills after a traffic spike.
Railway charges for compute (vCPU-hours) and memory (GB-hours). That is it. You see exactly what you are spending in real time. Scale a service up, the cost goes up proportionally. Scale it down, the cost drops immediately. No hidden multipliers.
- Usage-based: pay for what you consume, nothing more
- Transparent dashboard: real-time cost visibility per service
- No surprise bandwidth fees
- Scale to zero for services you only run on-demand
5. No Execution Time Limits
Vercel serverless functions time out at 10 seconds on the free tier, 60 seconds on Pro, and 300 seconds max on Enterprise. For most API routes, that is fine. For AI workloads? It is a dealbreaker.
A single Claude API call with tool use can run 30+ seconds. A multi-step agent loop can run for minutes. Voice sessions last the entire conversation. Railway has no execution time limits — your process runs as long as it needs to.
6. Docker-Native — No Vendor Lock-In
Railway deploys standard Docker containers and Nixpacks (auto-detected buildpacks). Your Dockerfile works on Railway, on AWS, on any VPS. There is no proprietary runtime, no special adapter, no platform-specific middleware layer.
Vercel requires its own build system, its own edge runtime, its own middleware format. Moving a Vercel project to another platform means rewriting your infrastructure layer. Moving a Railway project means pointing your Docker image at a different host.
7. Multi-Service Projects
Modern backends are not a single server. At Codmir, we run separate services for the API, the WebSocket server, the voice relay, the AI agent runner, and the event processor. Railway treats multi-service projects as a first-class concept — each service has its own deploy, its own logs, its own scaling config, all visible in one project view.
Vercel is designed for a single app per project. Running multiple backend services means multiple Vercel projects, each billed separately, with no shared networking or unified view.
8. Cron Jobs and Scheduled Tasks
Vercel offers cron via vercel.json with a minimum interval of one minute on Pro and daily on the free tier. The cron triggers a serverless function, so you are still bound by execution time limits.
On Railway, you can run a persistent worker that uses any scheduling library — node-cron, BullMQ with delayed jobs, or a simple setInterval. No limits on frequency, no limits on execution time, no extra configuration.
Where Vercel Still Wins
This is not a one-sided story. Vercel remains the best platform for:
- Next.js frontends — Vercel built Next.js. Their integration (ISR, edge middleware, image optimization, preview deploys per PR) is unmatched.
- Static sites and marketing pages — global CDN, instant deploys, automatic HTTPS.
- Simple API routes — if your backend is stateless REST endpoints that finish in under a minute, Vercel's serverless model is perfectly adequate.
- Preview deployments — every PR gets a live URL. This is where Vercel genuinely shines for frontend collaboration.
Our Architecture: Both Platforms Working Together
At Codmir, we do not choose one or the other — we use both for what they are best at:
- Vercel — hosts our Next.js web app (frontend, auth, server components, static pages)
- Railway — hosts everything that needs to stay alive: the WebSocket server, the AI agent runner, the voice relay, the event bus, PostgreSQL, and Redis
The frontend on Vercel talks to backend services on Railway over HTTPS and WebSocket. Each platform does what it was designed for. No square pegs in round holes.
The Bottom Line
If you are shipping a backend that does more than handle HTTP request-response cycles — real-time features, AI agents, background processing, voice, persistent connections — Railway is the better foundation. Transparent pricing, persistent servers, built-in databases, and zero vendor lock-in.
Vercel is the best frontend hosting platform on the market. But trying to run a serious backend on it is like trying to run a database on a CDN — technically possible, practically painful.
Use the right tool for the job. For backends, that tool is Railway.
Try Railway
Get started with persistent servers, built-in databases, and transparent pricing.
Sign Up for RailwaySee Codmir in Action
Watch how we orchestrate agents, voice, and deploys across Railway and Vercel.
Explore Codmir