> Discover all available pages from the documentation index: https://mastra.ai/llms.txt # NetlifyDeployer The `NetlifyDeployer` class handles packaging, configuration, and deployment by adapting Mastra's output to create an optimized version of your server. It extends the base [`Deployer`](https://mastra.ai/reference/deployer) class with Netlify-specific functionality. It enables you to run Mastra within Netlify serverless functions or edge functions. ## Installation In order to use `NetlifyDeployer`, you need to install the `@mastra/deployer-netlify` package: **npm**: ```bash npm install @mastra/deployer-netlify@latest ``` **pnpm**: ```bash pnpm add @mastra/deployer-netlify@latest ``` **Yarn**: ```bash yarn add @mastra/deployer-netlify@latest ``` **Bun**: ```bash bun add @mastra/deployer-netlify@latest ``` ## Usage example Import `NetlifyDeployer` and set it as the deployer in your Mastra configuration: ```typescript import { Mastra } from '@mastra/core' import { NetlifyDeployer } from '@mastra/deployer-netlify' export const mastra = new Mastra({ deployer: new NetlifyDeployer(), }) ``` ## Constructor options - `target?: 'serverless' | 'edge'` — Deploy target for Netlify. Defaults to `'serverless'`. - `'serverless'` — Standard [Netlify Functions](https://docs.netlify.com/functions/overview/) (Node.js runtime, 60s default timeout). - `'edge'` — [Netlify Edge Functions](https://docs.netlify.com/build/edge-functions/overview/) (Deno-based runtime, runs at the edge closest to users, no hard timeout). ### Edge functions example ```typescript import { Mastra } from '@mastra/core' import { NetlifyDeployer } from '@mastra/deployer-netlify' export const mastra = new Mastra({ deployer: new NetlifyDeployer({ target: 'edge', }), }) ``` ## Output After running `mastra build`, the deployer generates a `.netlify` folder. The build output includes all agents, tools, and workflows of your project, alongside a `config.json` file that configures the [Netlify Frameworks API](https://docs.netlify.com/build/frameworks/frameworks-api/). ### Serverless output (default) ```bash your-project/ └── .netlify/ └── v1/ ├── config.json └── functions/ └── api/ ├── index.mjs ├── package.json └── node_modules/ ``` The `config.json` file contains: ```json { "functions": { "directory": ".netlify/v1/functions", "node_bundler": "none", "included_files": [".netlify/v1/functions/**"] }, "redirects": [ { "force": true, "from": "/*", "to": "/.netlify/functions/api/:splat", "status": 200 } ] } ``` ### Edge output ```bash your-project/ └── .netlify/ └── v1/ ├── config.json └── edge-functions/ ├── index.mjs ├── package.json └── node_modules/ ``` The `config.json` file contains: ```json { "edge_functions": [ { "function": "index", "path": "/*" } ] } ```