> Discover all available pages from the documentation index: https://mastra.ai/llms.txt # VercelDeployer The `VercelDeployer` bundles your Mastra server and generates output conforming to Vercel's [Build Output API](https://vercel.com/docs/build-output-api/v3). Vercel deploys this output directly as serverless functions. ## Installation To use `VercelDeployer`, install the `@mastra/deployer-vercel` package: **npm**: ```bash npm install @mastra/deployer-vercel@latest ``` **pnpm**: ```bash pnpm add @mastra/deployer-vercel@latest ``` **Yarn**: ```bash yarn add @mastra/deployer-vercel@latest ``` **Bun**: ```bash bun add @mastra/deployer-vercel@latest ``` ## Usage example Import `VercelDeployer` and set it as the deployer in your Mastra configuration: ```typescript import { Mastra } from '@mastra/core' import { VercelDeployer } from '@mastra/deployer-vercel' export const mastra = new Mastra({ deployer: new VercelDeployer(), }) ``` ## Constructor options The deployer accepts the following options: - `studio?: boolean` — Deploy [Studio](https://mastra.ai/docs/studio/overview) alongside your API as static assets served from Vercel's Edge CDN. Defaults to `false`. - `maxDuration?: number` — Function execution timeout (in seconds) - `memory?: number` — Function memory (in MB) - `regions?: string[]` — Regions to deploy the function (e.g. `['sfo1','iad1']`) The `maxDuration`, `memory`, and `regions` options are merged into `.vercel/output/functions/index.func/.vc-config.json` while preserving default fields (`handler`, `launcherType`, `runtime`, `shouldAddHelpers`). ### Example with overrides ```typescript import { Mastra } from '@mastra/core' import { VercelDeployer } from '@mastra/deployer-vercel' export const mastra = new Mastra({ deployer: new VercelDeployer({ studio: true, maxDuration: 600, memory: 1536, regions: ['sfo1', 'iad1'], }), }) ``` ## Build output After running `mastra build`, the deployer generates a `.vercel/output` directory conforming to Vercel's [Build Output API (v3)](https://vercel.com/docs/build-output-api/v3). This directory contains routing configuration and serverless function bundles that Vercel deploys directly, bypassing framework detection. The output contains: - **config.json** — Routing configuration that directs requests to the appropriate handler - **functions/** — Your Mastra server bundled as a serverless function - **static/** — Studio SPA assets (only when `studio: true`) Without studio: ```bash .vercel/ └── output/ ├── config.json └── functions/ └── index.func/ ├── .vc-config.json ├── index.mjs └── node_modules/ ``` With `studio: true`: ```bash .vercel/ └── output/ ├── config.json ├── static/ │ ├── index.html │ └── assets/ │ ├── *.js │ └── *.css └── functions/ └── index.func/ ├── .vc-config.json ├── index.mjs └── node_modules/ ``` When studio is enabled, the routing is configured so that `/api/*` requests are handled by the serverless function, static assets (JS, CSS) are served from Vercel's Edge CDN with no function invocations, and all other paths fall back to `index.html` for client-side routing. This folder is generated during build and shouldn't be committed to version control.