@mastra/deployer-vercel
v1.2.14
Published
Keywords
Readme
@mastra/deployer-vercel
A Vercel deployer for Mastra applications.
Features
- Deploy Mastra applications to Vercel
- Zero-configuration serverless deployments
- Automatic environment variable synchronization
- Support for production, preview, and development environments
- Instant global deployments with Edge Functions
Installation
pnpm add @mastra/deployer-vercelUsage
The Vercel deployer is used as part of the Mastra framework:
import { Mastra } from '@mastra/core/mastra';
import { VercelDeployer } from '@mastra/deployer-vercel';
const deployer = new VercelDeployer({
// Optional per-function overrides (written to .vc-config.json)
maxDuration: 600,
memory: 1536,
regions: ['sfo1', 'iad1'],
});
const mastra = new Mastra({
deployer,
// ... other Mastra configuration options
});Configuration
Constructor Options
High‑value overrides written to .vercel/output/functions/index.func/.vc-config.json:
maxDuration?: number— Function execution timeout (seconds)memory?: number— Function memory (MB)regions?: string[]— Regions (e.g.['sfo1','iad1'])
Project Structure
The deployer creates:
your-project/
├── vercel.json # Deployment configuration
└── index.mjs # Application entry pointvercel.json Configuration
Default configuration:
{
"version": 2,
"installCommand": "npm install --omit=dev",
"builds": [
{
"src": "index.mjs",
"use": "@vercel/node",
"config": {
"includeFiles": ["**"]
}
}
],
"routes": [
{
"src": "/(.*)",
"dest": "index.mjs"
}
]
}Environment Variables
Environment variables are handled automatically through:
.envfiles in your project- Environment variables passed through the Mastra configuration
- Vercel's environment variable UI
Deployment Process
The deployer:
- Configures your project with the necessary files
- Deploys to Vercel using the CLI
- Synchronizes environment variables for future deployments
