# Deploy to Vercel

Goal: ship the app as a Vercel function with its static files on the CDN.

1. Build for the `vercel` preset. It is chosen on its own when `VERCEL` is set, and you can name it in the config. The build writes `.vercel/output/`:

````ts [recipes/deploy-vercel-config.ts]
import { defineConfig } from "hamur"

export default defineConfig({
  framework: "react",
  preset: "vercel",
  vercel: { functions: { maxDuration: 30 } },
})
````

2. Set the app key in the project's environment, then deploy. `hamur deploy` builds and runs `vercel deploy --prebuilt --prod`; `--preview` makes a draft:

````sh [recipes/deploy-vercel.sh]
vercel env add HAMUR_KEY production
hamur deploy
hamur deploy --preview
````

3. Give the app storage that survives. A Vercel function has no disk that keeps files, so `@hamur/db` and `@hamur/blob` fail the build until you set `db.connections.default` and `blob.driver`: a hosted database through a `client` file, and the `s3` blob driver. The messages say which key is missing.

`isr` route rules become Vercel ISR functions on this preset, and `vercel.functions` is merged into the function's config (`maxDuration`, `memory`, `regions`).

See also: [Vercel](/deploy/presets/vercel), [`hamur deploy`](/deploy/platforms/hamur-deploy), [Caching and ISR](/caching-and-isr#isr), [Database](/database).
