# Vercel (/docs/starter/deploy/vercel)

`apps/web/vercel.json` deploys the app to [Vercel](https://vercel.com). Vercel only runs the app: the database, Redis, file storage, and email come from your providers (for example Neon or Supabase, Upstash, and Cloudflare R2).

A project with a [frontend and its API](../../cli/frontend-and-api.mdx) can't use this option yet: it deploys on [any container host](./container-host.mdx#a-frontend-and-its-api) or [Railway](./railway.mdx#a-frontend-and-its-api). Nor can a project [without a website](../../cli/without-a-website.mdx), whose API deploys on [any container host](./container-host.mdx#without-a-website) or [Railway](./railway.mdx#without-a-website): the CLI refuses this option for it.

<Callout>
  [`pnpm clubedge deploy`](../../cli/deploy/vercel.mdx) does these steps for you: the project, its Root Directory, the variables, and the deploy.
</Callout>

## What vercel.json sets [#what-verceljson-sets]

The build command: `pnpm run check:env && pnpm --dir ../.. db:migrate && pnpm run build`.

- **`check:env`** (Starter v0.18.0 or newer) stops the build when a variable the project's modules need is unset, points at `localhost`, or isn't an absolute URL, and lists each one. `SKIP_ENV_CHECK=1` builds anyway.
- **Migrations:** Vercel has no step that runs before a release, so the build applies them against the `DATABASE_URL` of the deployment's environment. Give Preview deployments their own database, or remove the migration step and run migrations yourself.
- **The build:** with Next.js, Vercel builds the app; with TanStack Start, the build detects Vercel and writes Vercel's Build Output, with server routes as functions.

## Deploy by hand [#deploy-by-hand]

Import the repository in Vercel, set the project's Root Directory to `apps/web`, and add the [production variables](./index.mdx#production-variables) for every environment you deploy (Production and Preview). Vercel installs the whole pnpm workspace and builds the app. Set `NEXT_PUBLIC_APP_URL` to the project's URL before the first build, since Next.js compiles it in.

Also set `CLIENT_IP_HEADER=x-real-ip` in the project's settings, where Vercel puts each [client's address](../before-deploying.mdx#client-addresses) (Starter v0.27.0 or newer). Vercel takes runtime variables only from the project's settings, not from `vercel.json`.

Serverless functions open a connection per instance: use your provider's pooled connection URL (Supabase's transaction pooler or Neon's pooled endpoint).

## Background jobs [#background-jobs]

Vercel runs no worker for [background jobs](../modules/jobs.mdx). Set `CRON_SECRET` and add a cron to `vercel.json`; Vercel Cron sends the secret itself:

```json title="apps/web/vercel.json"
{
  "crons": [{ "path": "/api/jobs/run", "schedule": "* * * * *" }]
}
```

Cron jobs more frequent than daily need a paid Vercel plan; otherwise call the endpoint from another scheduler.

## The deploy workflow [#the-deploy-workflow]

The Deploy job pulls the project's production settings, builds in GitHub Actions (including the migrations in the build command), and uploads the result with `vercel deploy --prebuilt --prod`. It needs the secrets `VERCEL_TOKEN`, from your account settings, and `VERCEL_ORG_ID` and `VERCEL_PROJECT_ID`, which `vercel link` writes to `.vercel/project.json`.
