Introducing Render Sandboxes: a computer for every agent.

Learn more

Next.js Hosting: Vercel + Render vs a Single Platform

Your Next.js frontend runs well on Vercel, but your backend needs a persistent API, Postgres and background work. This guide compares three ways to host that app. It then walks through a hybrid sample, with Next.js on Vercel and the API, worker and Postgres on Render, and ends with a decision guide.

Another option is to take a hybrid approach that keeps a frontend workflow you trust but adds integration and operations work.

This guide focuses on the integration boundary. For a broad platform comparison, see Render vs Vercel and the companion Next.js hosting comparison. For workflow products, see Render Workflows vs Vercel Workflows.

Three architectures for the same app

The reference app needs a Next.js UI, a JSON API, a background task that processes queued jobs, and Postgres.

Each column meets these requirements differently. The services aren't identical.

Requirement
Vercel frontend + Render backend
Render-centered stack
Vercel-centered stack
Frontend hosting
Vercel
Next.js as a Render web service
Vercel
API runtime
Render web service, ideal for API servers
Render web service, ideal for API servers
Vercel Functions. On Pro, the default duration is 300s and the maximum is 1800s (in beta)
Background task
Render background worker
Render background worker
Vercel Queues for event-driven jobs with retries, plus Cron Jobs for schedules
Postgres
Render Postgres over its internal address
Render Postgres over its internal address
A database from a separate provider, connected from Functions
Dashboards and bills
2
1
2 (Vercel plus the database provider)
Frontend-to-API path
Public HTTPS URL of the Render web service
Private network between Render services
Vercel Services (Beta) call each other over internal bindings
Main tradeoff
Keeps the Vercel workflow, adds a second platform
One platform, gives up Vercel-specific frontend features
One application platform, backend bound by function limits plus a separate database

A Render-centered stack can run the Next.js frontend, API, background worker and managed Render Postgres together. Services and Postgres in the same workspace and region can communicate over Render's private network, using internal addresses instead of sending service-to-service traffic over the public internet, which can reduce public exposure and latency.

Keeping the stack on Render also puts service and database metrics and logs in one platform, supporting end-to-end observability with the option to stream logs to third-party providers. Render is designed for these backend workloads, offering persistent web and private services, background workers, and managed Postgres together.

Vercel's serverless Functions are a fit for request-driven, bursty workloads, but they have execution limits and typically connect to a separate database provider. Vercel also offers newer container-based Functions and Services in beta, plus Daemons in beta for continuous workers.

Free compute plans have usage limits and suit exploration, and free Render Postgres has a 30-day limit. Use paid instances for any API that your frontend depends on.

Sample application: Next.js on Vercel, backend on Render

This minimal sample illustrates the pattern.

For each request, a server component, server action, or route handler calls the Render API, which uses Render Postgres through its internal address.

For a job, a server action on the jobs page calls POST /jobs, which inserts a pending row. The worker claims the row and writes result, or marks it failed after repeated failures. The frontend reads results from GET /jobs or GET /jobs/:id.

To deploy:

  1. Run npm install in api/ and commit package-lock.json.
  2. In the Render Dashboard, click New > Blueprint and connect your repository.
    1. Set the sync: false values on each service's Environment page.
  3. Vercel supports monorepos, so import the same repository with web as the project root, add the variables below and deploy.

By default, a Blueprint lives in render.yaml at your repository root:

The 0.5c-512mb and 0.1c-256mb plan IDs come from Render's current compute and Postgres pricing tables. Blueprints don't support variable interpolation.

The following backend files define the Node.js dependencies, database setup, API and background worker for the sample.

With the dependencies defined, set up the shared database pool and jobs table:

The API uses that pool to accept and retrieve jobs, while checking the shared token on each jobs route:

The worker uses the same database setup to poll for pending jobs and process them:

Set these variables in your Vercel project. Each can apply to Production, Preview or both. Point Preview at a separate staging API with its own token so previews never touch production data. The below URLs are examples.

Variable
Type
Production
Preview
API_BASE_URL
Config, readable after saving
https://jobs-api.onrender.com
https://jobs-api-staging.onrender.com
API_SHARED_TOKEN
Secret, write-only after saving
Production token
Staging token

For client-side submissions, the following same-origin proxy checks a user session before calling the API. Implement verifySession with your authentication provider:

Authentication, secrets, and CORS

Authentication and CORS matter in a hybrid architecture because requests cross the boundary between your Vercel frontend and Render backend. The right setup depends on whether the request comes from server-side code or directly from a browser.

For server-to-API calls from server components, route handlers, and server actions, the shared token stays on the server, and requireToken protects every /jobs route. These calls don't need CORS; browsers enforce it, but servers don't.

For browser calls, never put a token in a NEXT_PUBLIC_ variable, because Next.js inlines those variables into browser code. A route handler proxy is a good choice here. Once you implement verifySession, it verifies the user's session on your Vercel origin and adds the shared token server-side.

For a direct browser-to-API call, send an auth-provider token in the Authorization header. The sample API only accepts the shared server token, so add verification for the auth-provider token before enabling direct calls. Every Render workspace plan includes custom domains with a per-plan allowance, so you can also serve the API from a subdomain of your domain. Add your production and preview origins to ALLOWED_ORIGINS and previewPattern.

Keep the API base URL and server token in Vercel. Keep the database URL, both token slots, and worker credentials on Render.

To rotate a token without downtime:

  1. On Render, move the old value to API_SHARED_TOKEN_PREVIOUS, set the new one in API_SHARED_TOKEN, and choose Save and deploy, which redeploys the existing build with the new values.
  2. Update the secret in Vercel and redeploy. Variable changes apply only to new deployments, and Vercel advises updating both the external service and your projects.
  3. Clear API_SHARED_TOKEN_PREVIOUS on Render.

Logs, failures and latency

The sample's Next.js code generates an x-request-id, which the API echoes and logs. Search for that ID in both dashboards to connect both sides of a request.

Log feature
Vercel
Render
Grouping
Runtime logs grouped per request
HTTP request logs on Pro and above
Retention
1 hour on Hobby, 1 day on Pro
7 days on Hobby, 14 days on Pro
Export
Drains on Pro at $0.50 per GB, not available on Hobby
Log streams on all plans

Here’s how the sample application handles failure. When the API is down or slow, the 5-second timeout trips. Pages render a fallback and the proxy returns 503 with the request ID. When a worker goes down, jobs stay pending while the API keeps accepting them. When a job errors, the worker makes up to five attempts, then marks the job failed with last_error.

In this setup, only the Vercel-to-Render hop crosses the public internet. The API reaches Render Postgres over its internal address, so the only added latency comes from that public hop. Where possible, set each Vercel function region close to your Render service region.

Sample scope and limitations

The sample uses Node.js 20 or later, Express 5 and pg 8 for the API and worker, with Next.js App Router on Vercel. The API, worker and Postgres run in Render's oregon region, using 0.5c-512mb for the API and worker and 0.1c-256mb for Postgres.

The sample doesn't include:

  • user authentication (you implement verifySession)
  • user authentication on the jobs page, which calls the API with the shared token, so anyone who can open the page can submit jobs and read all job records
  • a GET proxy route for client-side reads (add one following the POST pattern)
  • verification of auth-provider tokens in the API, which accepts only the shared server token
  • a migration tool
  • dead-letter alerting for failed jobs

All of the above should be added before you take your Next.js application to production.

The worker has other limitations. If it crashes mid-job, attempts isn't incremented, so a job that crashes the worker can return to pending indefinitely. To avoid this, claim jobs in a separate transaction before processing them. The worker also records a failure after its rollback releases the job lock, so that update can race with another worker that picks up the same job.

If your previews call a separate staging API, remove previewPattern from the production API's CORS settings.

Before going live, verify in your deployment that:

  • p95 latency from a Vercel function to /healthz meets your page budget.
  • One request ID appears in both platforms' logs.
  • While the API redeploys or is suspended, pages show the intended fallback, not an error.
  • The browser doesn’t show CORS errors, and origins are covered in ALLOWED_ORIGINS or previewPattern
  • Server calls don’t hit 401 errors, and tokens are included in your Vercel environment
  • Page requests don't run significantly slower than the times recorded in API logs. If they do, check whether the Vercel frontend function is far from the API's Render region

Cost and operational tradeoffs

These illustrative estimates assume a Vercel Pro team receives a monthly usage credit before moving to on-demand pricing, and that one developer uses a Render Hobby workspace. They also assume 0.5c-512mb compute for the API and worker, the smallest paid Postgres plan (0.1c-256mb), and one continuously running background worker.

Prices are in USD, per Render's pricing page and Vercel's pricing page. Vercel prices some resources by region, so the table lists "starting at" rates. Prices change, so record the date you check them.

Line item (illustrative)
Hybrid
Render-centered
Vercel-centered
Vercel plan
$20/mo Pro
Not used
$20/mo Pro
Render workspace
$0 Hobby
$0 Hobby
Not used
Next.js compute
From $0.128/hour Active CPU and $0.60 per 1M invocations, against the Pro credit
$25/mo, 1 CPU, 2 GB
From $0.128/hour Active CPU and $0.60 per 1M invocations, against the Pro credit
API
$7/mo, 512 MB (0.5c-512mb)
$7/mo
$0.60 per 1M invocations, against the Pro credit
Background task
$7/mo worker
$7/mo worker
Vercel Queues usage
Postgres
$6/mo, 256 MB (0.1c-256mb), plus storage
$6/mo plus storage
External database provider's price
Outbound bandwidth
Render Hobby: 5 GB included, then $0.15/GB. Vercel Pro: 1 TB included
Render Hobby: 5 GB included, then $0.15/GB
Vercel Pro: 1 TB data transfer via the included Flat Rate CDN tier
Estimated total
$40/mo
$45/mo
$20/mo plan, plus database provider and Queues usage

The Vercel-centered total excludes database and Queues costs, so it isn't directly comparable. A Render Hobby workspace includes 1 seat. Teams need Pro at $25/month plus compute. Render Pro includes 25 GB of bandwidth per month.

The hybrid setup also adds two sets of access controls, two on-call surfaces, two deploy pipelines, and coordinated releases whenever the API contract changes.

Previews need a matching backend. Render's full-stack preview environments require Pro or higher, and single-service previews work on every plan, including Hobby. A $25/month service previewed for half a month costs $12.50.

Decision guide

Choose the hybrid when your team values its Vercel frontend workflow and Next.js optimizations, and your backend needs persistent services, long-running work, or managed Postgres.

Keep your stack together on Render when one bill for the entire stack, fewer integration points, and private networking between eligible services and Postgres in the same workspace and region outweigh Vercel-specific frontend features.

Stay entirely on Vercel when your backend is light, short-lived or bursty, and its tasks fit within function limits, such as the 1800s Pro maximum (beta).

Weigh the benefit of the hybrid frontend against the integration work this guide describes. For broader context, read Render vs Vercel and the Next.js hosting comparison.

Limits, integration behavior, and prices change. Confirm current details in the Render documentation and Vercel's documentation before you build on them.

Frequently asked questions