Skip to content

Where to Host Your Backend When Your Frontend Is on Vercel

Vercel has no always-on servers and Vercel Postgres is gone. Where to run your API, workers, WebSockets and database, and how to wire them to a Vercel frontend.

Published
Updated
Reading time
4 min
On this page

Key takeaways

  • Vercel runs functions per request: it has no always-on server, so long-running workers, WebSockets and bots need another home.
  • Vercel Postgres is no longer available; Vercel points new projects to Marketplace providers instead.
  • A common setup: frontend on Vercel, API + workers + database on a PaaS, connected over HTTPS with CORS.

Vercel is one of the best places to deploy a Next.js frontend. But most real apps also have parts that don't fit the serverless model: a queue worker, a WebSocket server, a scheduled job that runs for ten minutes, a Discord bot, a database. Here's how to split the app sensibly.

What Vercel does (and doesn't do)

  • Does: static assets on a global CDN, Server Components and SSR, Route Handlers and serverless functions billed per invocation and CPU.
  • Doesn't: run an always-on server. Functions exist while a request is being handled.
  • Database: Vercel Postgres is no longer available. New projects pick a Marketplace provider (Neon, Prisma Postgres, Supabase, AWS Aurora), each priced separately.
  • Plans: Hobby is free for personal, non-commercial use, with hard usage caps. Pro is $20/month with $20 of usage credit included.

What needs a long-running host

WorkloadWhy serverless strugglesWhere it fits
Queue workers (BullMQ, Celery, Sidekiq)Must run continuously to pull jobsAlways-on service
WebSockets / realtimeConnections outlive a requestAlways-on service
Discord botsHold a gateway connection 24/7Always-on service
Long jobs (video, imports, reports)Function time limitsWorker service
A databaseNeeds persistent storageManaged database

A clean split: frontend on Vercel, backend on a PaaS

text
Browser ──▶ Vercel (Next.js frontend)
               │  fetch("https://api.myapp.com/…")
               ▼
          API service ──┬── PostgreSQL (DATABASE_URL)
          Worker service ┴── Redis queue (REDIS_URL)

On DockHosting, each box is a project:

  1. API: Express, FastAPI, Django, Go or anything with a Dockerfile, deployed with dock deploy.
  2. Worker: the same repository deployed as a second project with a different start command, for example node worker.js.
  3. PostgreSQL + Redis: managed databases attached to both projects. DATABASE_URL and REDIS_URL are injected over a private network, so the database has no public port.

Wiring it to the frontend

1. Point the frontend at the API with an environment variable in Vercel:

bash
NEXT_PUBLIC_API_URL=https://api.myapp.com

2. Allow the frontend's origin in the API (Express example):

js
import cors from "cors";
app.use(cors({ origin: ["https://myapp.com", "https://myapp.vercel.app"] }));

3. Give the API its own domain. Add api.myapp.com as a custom domain on Hobby and up. HTTPS certificates are issued automatically.

Or keep it all in one place

If you'd rather not split, a Next.js app also runs as a normal Node.js server, with no Vercel-specific features required. Deploy it with npm run build and npm start, or as a Docker image: see deploying Next.js with Docker. Then the frontend, API, worker and database all live next to each other.

Cost sketch

For a small commercial app on DockHosting Hobby ($4/month): 1 GB memory shared across 3 projects (frontend or API, worker) and 2 managed databases (PostgreSQL + Redis), with daily backups and your own domain. Pro ($9) raises that to 10 projects, 6 databases and 3 GB. See pricing and the Heroku alternatives comparison for other options.

Related: Free backend hosting compared · Railway app alternatives

Frequently asked questions

Can Vercel run a backend?

It runs serverless functions and Route Handlers, which are fine for request/response APIs. It doesn't offer an always-on server, so queue workers, cron-heavy jobs, WebSocket servers and bots that hold a connection need a long-running host.

What happened to Vercel Postgres?

Vercel's docs say Vercel Postgres is no longer available. Existing databases were moved to Neon in December 2024, and new projects use Marketplace providers such as Neon, Prisma Postgres, Supabase or AWS Aurora.

Is Vercel's free Hobby plan OK for a business?

Vercel's Hobby plan is for personal, non-commercial use. Commercial projects need Pro, which is $20/month per seat with usage on top.

  • Vercel
  • Backend
  • Next.js
  • Serverless
  • Architecture

Written by Doughmi ILYAS

Doughmi builds DockHosting, the developer-first platform behind dock deploy: the build system, the managed databases and the dashboard. On this blog: guides to shipping apps without running servers, written with the commands the platform actually ships.

Summarize with

Share

All posts

Create an account, run dock deploy, and get a live HTTPS URL in minutes.