On Vercel
Vercel runs the kit without a server of its own: each request starts a function, and nothing lives between them. Three things are therefore elsewhere than on a server: uploaded files go to Vercel Blob, the database is a hosted one, and Vercel Cron runs the background jobs. The kit is set up for all three; vercel.json in the repository holds the cron and the functions' time limit.
What it takes #
| A Vercel plan | Pro. Hobby is for non-commercial use only, runs a cron once a day, and gives functions at most 60 seconds. To try the kit on Hobby anyway, see On Hobby. |
| A database | PostgreSQL (Neon, from the Vercel Marketplace) or MongoDB (Atlas). See The database. |
| A Blob store | Created under the project's Storage tab. Connecting it sets BLOB_READ_WRITE_TOKEN. |
| A Node.js version | 22.x or 24.x. engines.node in package.json picks it, not the project's settings. See The Node.js version. |
Set it up #
- Import your copy of the repository into a new Vercel project. The framework is detected as Next.js; keep the defaults.
- Add the database.
- Postgres (Neon): add it from the Storage tab and use its pooled connection string as
DATABASE_URL. Set the project's Build Command topnpm payload migrate && pnpm build, so the migrations run once per deploy, before any function starts (see The database). - MongoDB (Atlas): use the cluster's
mongodb+srv://string asDATABASE_URL. Atlas must accept connections from Vercel's functions, whose addresses change: allow0.0.0.0/0, or use Atlas's Vercel integration.
- Postgres (Neon): add it from the Storage tab and use its pooled connection string as
- Add a Blob store under Storage and connect it to the project. That sets
BLOB_READ_WRITE_TOKEN, and with it every upload goes to Blob. - Set the environment under Settings → Environment Variables:
PAYLOAD_SECRET:openssl rand -hex 32CRON_SECRET:openssl rand -hex 32. Vercel Cron sends it to the run endpoint by itself.NEXT_PUBLIC_SERVER_URL: the site's address. Without it, the kit uses the production domain Vercel knows, and a preview its own address.- the optional services you use:
ANTHROPIC_API_KEY, SMTP and so on (Environment variables).
- Deploy, open
/adminand create the first admin.
How it differs from a server #
- Uploads are on Blob.
- The media library's files are public and served by Blob's CDN, video included.
- A media file keeps the name it was uploaded with, so Replace file overwrites it at its own address and links pasted elsewhere keep working. Blob's CDN serves the new file within a minute. Browsers keep a media file for an hour before they ask again (
cacheControlMaxAgeinsrc/plugins/storage.ts; the adapter's default is a year), so one that already has the old file may show it until then. The site's own pages ask for the new version at once. - The admin uploads straight from the browser to Blob, so a large picture or video never passes through a function. Each file it uploads goes in a folder of its own, with a random name.
- Files to translate and their translations stay behind Payload's access rules. Every address on Blob is public, so their names get a random part, and nobody can guess them.
- Media names hide nothing, on Blob or on a server: visitors can list the media library through the API (
/api/media), addresses included. Keep files that are not for the public out of it. - A site that already has files on disk does not move them by itself: upload them again, or copy them to the store with their names.
- The background jobs run from Vercel Cron.
vercel.jsoncalls/api/payload-jobs/run?allQueues=trueevery minute.- The kit turns off its own timer on Vercel (
JOBS_AUTORUNis not needed). - A job made of steps, such as translating a file into several languages or proofreading the site, moves one step a minute.
- See Background jobs.
- Functions have a time limit.
vercel.jsongives the API's function 300 seconds, which covers ✨ Translate on a long page, Distill and an evaluation.- Longer work already runs as jobs, one step per call.
- A request carries at most 4.5 MB. Admin uploads go straight to Blob, so they are not affected. These pass through a function, and their files must fit:
- Translate a file (the upload, and the download of the translation)
- replacing a media file's file
- importing translations
- The page cache is shared by every function, so a publish refreshes the site at once, everywhere.
- Each function keeps a small database pool. Every function instance has its own connections, and many instances run at once. On Vercel the kit keeps at most five per instance and closes idle ones after a minute (
poolLimitsinsrc/database/index.ts); with the drivers' defaults, a free Atlas cluster (500 connections) fills up and refuses new ones, and pages fail until old connections close. - Node runs without require(esm).
- Vercel starts its functions with
--no-experimental-require-module, on 22.x and 24.x alike. A CommonJS package may then notrequire()a package that is an ES module only. - Where one does, every page that loads it answers 500, while the build passes. The log reads
Error [ERR_REQUIRE_ESM]: require() of ES Module … not supported. Choosing another Node.js version does not help. - The kit's server works without it, and CI runs the e2e tests against a server started that way. Vercel documents
NODE_OPTIONS=--experimental-require-moduleto switch it on; the kit does not need it. - The HTML sanitiser's DOM (jsdom) is held at 26.1.0 (
pnpm.overridesinpackage.json). Later releases depend on packages that are ES modules only, and the sanitiser loads with the Payload config, so on every page.tests/unit/withoutRequireEsm.test.tsloads it the way Vercel does. - A package you add that the server loads from
node_modulesmust load without require(esm) too: one inserverExternalPackagesinnext.config.ts, or one Next.js keeps out of the bundle by itself, such assharp. The build lists them in.next/node_modules. To try it before you deploy, runpnpm build, thenNODE_OPTIONS=--no-experimental-require-module pnpm exec next start. Note thatpnpm startsetsNODE_OPTIONSitself.
- Vercel starts its functions with
The Node.js version #
Vercel offers Node.js 22.x and 24.x. The engines.node field in package.json decides which one a deploy runs, and it wins over the Node.js Version in the project's settings.
- The kit's
>=20.18.1gives the newest version Vercel offers, 24.x today. When Vercel adds a new version, the next deploy moves to it, and the build log warns that it will. - CI, the Docker image and
.nvmrcuse Node.js 22. To run the same on Vercel, set"node": "22.x"in your site'spackage.json."24.x"keeps 24. - To see which version a deploy runs, add
node -vto the Build Command, or logprocess.version.
On Hobby #
Change vercel.json before the first deploy, or the deploy is refused:
- the cron's
scheduleto once a day, e.g.0 3 * * * maxDurationto60
Scheduled publishing and file translations then wait for the next day, and ✨ Translate on a long page may run out of time. It is enough to look around, not to run a site. Hobby may not be used commercially.
A live demo on Vercel #
A live demo runs on Vercel as on a server, with one addition: set DEMO_MODE=true for the build as well as at runtime.
- The nightly reset writes the demo's photographs, films and recorded translations again. Their paths are read at runtime, so the build cannot follow them.
- With
DEMO_MODE=trueat build time,next.config.tsputs them (about 17 MB) into the API's function. - The reset then runs from Vercel Cron at
DEMO_RESET_AT, and writes its pictures to Blob.
In demo mode a visitor may upload files of at most 4 MB on Vercel, not 5 MB, so Translate a file stays under the request limit.