Where to run your app when Vercel's function limits, backend gaps or costs stop fitting, ranked, with a verdict for the frontend and the backend.

The best Vercel alternative when the backend is why you are leaving is Encore, which declares your APIs, Postgres databases, Pub/Sub topics and cron jobs in application code and provisions them in your own AWS or GCP account, while the Next.js frontend can stay on Vercel. If you only need another frontend host, Netlify and Cloudflare Workers are the closest matches. Railway, Render and Fly.io run full-stack apps as containers, AWS Amplify keeps a Vercel-like flow inside AWS, and Coolify or Dokku fit teams that run their own servers.
Vercel set the bar for deploying Next.js, with git push deploys and preview URLs per branch, and for a frontend with light API routes it still does that well.
It gets harder when the app grows a backend, as functions have a maximum duration and a 4.5 MB body limit, the database and queue come from separate Marketplace integrations, and long-running workers or a database in your own AWS account sit outside what the platform manages.
Verdict: keep or move the frontend based on framework fit (Vercel, Netlify or Cloudflare), and move the backend to Encore when it needs a database, queues, scheduled jobs or private networking in your own cloud.
Encore is a backend framework with built-in infrastructure, so the database, the scheduled job and the API that uses them are declared in one codebase instead of assembled from separate integrations. Encore runs the whole backend locally with encore run and provisions it in your own AWS or GCP account on deploy, as RDS or Cloud SQL, SNS and SQS or Pub/Sub, and Fargate, EKS, Cloud Run or GKE for compute.

Here is a signups service with a Postgres table, a public endpoint the frontend calls, and a nightly digest job:
// signups/signups.ts
import { api } from "encore.dev/api";
import { CronJob } from "encore.dev/cron";
import { SQLDatabase } from "encore.dev/storage/sqldb";
// RDS on AWS, Cloud SQL on GCP, a local Postgres under encore run.
const db = new SQLDatabase("signups", { migrations: "./migrations" });
export const subscribe = api(
{ expose: true, method: "POST", path: "/signups" },
async ({ email }: { email: string }): Promise<{ ok: boolean }> => {
await db.exec`
INSERT INTO signups (email) VALUES (${email})
ON CONFLICT (email) DO NOTHING`;
return { ok: true };
},
);
// Claim a row first, deliver with a stable idempotency key, then mark sent.
export const sendDigest = api({}, async (): Promise<{ sent: number }> => {
let sent = 0;
for await (const row of db.query<{ id: number; email: string; attempt: string }>`
WITH claimed AS (
SELECT id
FROM signups
WHERE digested_at IS NULL
AND (digest_claimed_at IS NULL OR digest_claimed_at < NOW() - INTERVAL '15 minutes')
ORDER BY id
FOR UPDATE SKIP LOCKED
)
UPDATE signups s
SET digest_claimed_at = NOW(),
digest_attempt_id = COALESCE(s.digest_attempt_id, gen_random_uuid()::text)
FROM claimed
WHERE s.id = claimed.id
RETURNING s.id, s.email, s.digest_attempt_id AS attempt`) {
await sendSignupDigest(row.email, row.attempt);
await db.exec`UPDATE signups SET digested_at = NOW() WHERE id = ${row.id}`;
sent++;
}
return { sent };
});
async function sendSignupDigest(email: string, attemptId: string): Promise<void> {
// Resend retains Idempotency-Key values for 24 hours and returns the
// original email id for the same key and payload, without sending twice.
const res = await fetch("https://api.resend.com/emails", {
method: "POST",
headers: {
"content-type": "application/json",
authorization: `Bearer ${process.env.RESEND_API_KEY}`,
"Idempotency-Key": attemptId,
},
body: JSON.stringify({
from: process.env.DIGEST_FROM,
to: [email],
subject: "Your nightly signup digest",
html: "<p>Today's signups are in.</p>",
}),
});
const body = (await res.json()) as { id?: string; name?: string };
if (!res.ok || !body.id) throw new Error(body.name ?? "digest delivery failed");
}
// Encore platform Managed; does not run locally or in preview environments.
const _ = new CronJob("nightly-digest", {
title: "Send the nightly signup digest",
schedule: "0 6 * * *",
endpoint: sendDigest,
});
A later run can reclaim a row whose send never completed, and it reuses the same digest_attempt_id as Resend's Idempotency-Key, which Resend retains for 24 hours. The 15-minute reclaim window sits inside that retention period, and the row is marked digested only after Resend returns an email id, so an already-accepted send is not delivered twice:
-- signups/migrations/1_create_signups.up.sql
CREATE TABLE signups (
id BIGSERIAL PRIMARY KEY,
email TEXT NOT NULL UNIQUE,
digested_at TIMESTAMPTZ,
digest_claimed_at TIMESTAMPTZ,
digest_attempt_id TEXT
);
The Next.js app keeps its Vercel deployment and calls the backend through a client generated with encore gen client, so a renamed field is a type error in the frontend build rather than a 400 in production:
// app/lib/backend.ts (Next.js on Vercel)
import Client, { Environment } from "./client";
const backend = new Client(Environment("production"));
export async function subscribe(email: string) {
return backend.signups.subscribe({ email });
}
Cron jobs do not run under encore run or in preview environments, so you test sendDigest by calling it from a test. Every pull request can get a preview environment hosted by Encore; pairing it with a Vercel preview means passing the backend URL to the frontend build, as the two are not linked automatically. On deploy, Encore provisions an IAM role for the service, or a service account on GCP, and instance sizes and networking are set per environment in the infrastructure configuration.
For a coding agent this layout is easier to change safely: the agent sees the API, the table and the job in one service, adds a column and the endpoint that uses it in one change, and runs it locally before the pull request exists.
Encore does not host frontends, so server actions and route handlers that are tied to rendering, cookies or framework caching are usually better left on Vercel. The Coming from Vercel guide covers which parts to move and how to run both side by side.
Best fit: teams whose Vercel functions have turned into a backend and who want Postgres, queues and scheduled jobs in their own AWS or GCP account, with the frontend staying where it is.
Run in your terminal to get started locally.
Netlify is the closest direct competitor to Vercel, with the same static-plus-functions model, Git-based deploys and deploy previews (netlify deploy --prod from the CLI). It works well for framework-agnostic sites, and its functions have similar limits to Vercel's, so a backend-heavy app hits the same walls.
Best fit: teams that want a Vercel-like workflow for a site that is not tied to Next.js-specific features.
Cloudflare runs static assets and code on its global network. New projects usually start on Workers with static assets, and Cloudflare publishes a guide for moving Pages projects to Workers:
// src/index.ts, a Worker that serves an API route next to static assets
export default {
async fetch(request: Request): Promise<Response> {
const url = new URL(request.url);
if (url.pathname === "/api/hello") {
return Response.json({ message: "Hello from the edge" });
}
return new Response("Not found", { status: 404 });
},
};
Workers have CPU time limits and are not a full Node.js environment, and D1 (SQLite) and KV are not drop-in replacements for Postgres, so apps with a relational backend usually pair them with a database elsewhere.
Best fit: edge-heavy apps and global static sites that benefit from running close to users.
Railway runs your app as a container with attached databases, closer to Heroku than to Vercel, with railway up as the deploy. It removes function timeouts and cold starts, but everything runs on Railway's infrastructure rather than in your cloud account, and Next.js frontend delivery is not its focus, as covered in Railway alternatives.
Best fit: full-stack apps where long-running processes matter more than CDN-heavy frontend delivery.
Render is a Heroku-style platform with static sites, web services, background workers, cron jobs and managed Postgres in one place. Long-running services are straightforward, and like Railway, it runs on Render's infrastructure rather than yours, as compared in Render alternatives.
Best fit: simple full-stack apps that need a worker or a cron job next to the web service.
Fly.io runs your container as machines in the regions you choose, with fly deploy as the entry point. You get full control of the runtime and compute close to users, and you manage machines, regions and volumes yourself, and Fly.io alternatives covers where teams go next.
Best fit: apps that need low latency in several regions and a team comfortable operating containers.
AWS Amplify Hosting gives you Git-based deploys and branch previews on AWS, and Amplify's backend tooling defines auth, data and functions in TypeScript on top of AWS CDK. Resources live in your AWS account, and the backend follows Amplify's own conventions, so moving off it later means working with the generated stacks.
Best fit: AWS-committed teams that want a Vercel-like frontend flow inside their own AWS account.
Open source self-hosted platforms such as Coolify, Dokku and Kamal give you Git-based deploys on servers you rent. You pay for the servers and keep full control, and you also own OS updates, backups, TLS renewal and uptime.
Best fit: side projects and teams with strong operations skills and a reason to run their own servers.
Moving the backend first is usually the smaller step, as the frontend keeps its Vercel deploys while APIs and jobs move one at a time. The quick start gets a first Encore service running locally.
That turns on which part of Vercel is the problem. If you need a backend with Postgres, queues and cron jobs, Encore declares them in application code and provisions them in your own AWS or GCP account, while the frontend can stay on Vercel. For frontend hosting, Netlify and Cloudflare Workers match Vercel's static-plus-functions model, Railway, Render and Fly.io run containers, and AWS Amplify keeps a Git-based deploy flow inside AWS.
Yes. It works for light backends, as Vercel runs backend logic in functions with a maximum duration and a 4.5 MB request and response body limit, and databases and queues usually come from Marketplace integrations. Long-running workers, private networking to your own databases, and queues that you control sit outside what it manages.
No. Neither is strictly better, as they are close competitors with a similar static-plus-functions model. Vercel has deeper Next.js-specific features, while Netlify is a strong match for framework-agnostic sites, so pick on framework fit and how your usage maps to each plan.
Yes. A common setup keeps rendering, middleware and preview deploys on Vercel and moves APIs, databases, queues and scheduled jobs to a backend in your own cloud.
Own your AWS or GCP cloud without giving up PaaS speed
Define databases, Pub/Sub, cron jobs, and object storage directly in TypeScript or Go. Encore provisions everything in your own cloud account with zero Terraform or lock-in.