Skip to main content

Web framework

When Mastra is integrated with a web framework, it deploys alongside your application using the framework's standard deployment process. Follow the instructions below to ensure your Mastra integration deploys correctly.

warning

If you're deploying to a cloud provider, don't use LibSQLStore with a local file: or in-memory database. Local databases require filesystem access and aren't compatible with serverless platforms. Point LibSQLStore at a remote database such as Turso instead.

Integration guides:

With Next.js on Vercel
Direct link to With Next.js on Vercel

If you've integrated Mastra with Next.js by following our guide and plan to deploy to Vercel, add serverExternalPackages: ["@mastra/*"] to your next.config.ts:

next.config.ts
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
serverExternalPackages: ['@mastra/*'],
}

export default nextConfig

With Astro on Vercel
Direct link to With Astro on Vercel

If you've integrated Mastra with Astro by following our guide and plan to deploy to Vercel, add the Vercel adapter and server output to your astro.config.mjs:

astro.config.mjs
import { defineConfig } from 'astro/config'
import vercel from '@astrojs/vercel'

export default defineConfig({
adapter: vercel(),
output: 'server',
})

With Astro on Netlify
Direct link to With Astro on Netlify

If you've integrated Mastra with Astro by following our guide and plan to deploy to Netlify, add the Netlify adapter and server output to your astro.config.mjs:

astro.config.mjs
import { defineConfig } from 'astro/config'
import netlify from '@astrojs/netlify'

export default defineConfig({
adapter: netlify(),
output: 'server',
})