Vercel
Deploy the server to Vercel Functions with an S3-compatible bucket, and let Vercel Cron Jobs run the expiry task.
Create the project
- Import your copy of the repository into Vercel.
- Set Root Directory to
apps/api. Keep Include source files outside of the Root Directory in the Build Step on, because the server uses packages frompackages/. - Keep the default build command. Nitro detects Vercel and builds the
vercelpreset. To make the choice explicit, set theNITRO_PRESETenvironment variable tovercel. - Add the environment variables below, then deploy.
| Variable | Value |
|---|---|
TURBO_TOKEN |
Your token. |
S3_BUCKET, S3_ENDPOINT, S3_REGION, and the keys |
Your bucket. See S3-compatible storage. |
CRON_SECRET |
A random string. Vercel sends it with each cron request, and the server rejects cron requests without it. |
Point turbo at the production URL
Set TURBO_API to the project’s production URL, such as https://<project>.vercel.app. Vercel’s default Deployment Protection puts preview URLs behind a Vercel login, which turbo can’t pass.
The expiry task
The build turns the server’s schedule into a Vercel Cron Job at /_vercel/cron, set to 0 3 * * * (03:00 UTC). On the Hobby plan, Vercel runs it at some point between 03:00 and 03:59.
Without CRON_SECRET, anyone who finds the cron URL can run the expiry task. The task deletes only expired artifacts, but set the secret anyway.