@mastra/deployer 1.0.0-beta.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +805 -0
- package/dist/arktype-aI7TBD0R-CCZH3EYK.js +8 -0
- package/dist/{arktype-aI7TBD0R-JG4WETGU.js.map → arktype-aI7TBD0R-CCZH3EYK.js.map} +1 -1
- package/dist/{arktype-aI7TBD0R-RMRB5ZNY.cjs → arktype-aI7TBD0R-XHBHUL3T.cjs} +3 -3
- package/dist/{arktype-aI7TBD0R-RMRB5ZNY.cjs.map → arktype-aI7TBD0R-XHBHUL3T.cjs.map} +1 -1
- package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
- package/dist/build/analyze/bundleExternals.d.ts +4 -5
- package/dist/build/analyze/bundleExternals.d.ts.map +1 -1
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.d.ts +5 -5
- package/dist/build/analyze.d.ts.map +1 -1
- package/dist/build/analyze.js +1 -1
- package/dist/build/babel/remove-deployer.d.ts.map +1 -1
- package/dist/build/bundler.cjs +3 -3
- package/dist/build/bundler.d.ts +3 -1
- package/dist/build/bundler.d.ts.map +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/bundlerOptions.d.ts.map +1 -1
- package/dist/build/deployer.d.ts.map +1 -1
- package/dist/build/index.cjs +19 -10
- package/dist/build/index.d.ts +2 -0
- package/dist/build/index.d.ts.map +1 -1
- package/dist/build/index.js +4 -3
- package/dist/build/package-info.d.ts +9 -0
- package/dist/build/package-info.d.ts.map +1 -0
- package/dist/build/plugins/node-modules-extension-resolver.d.ts +7 -0
- package/dist/build/plugins/node-modules-extension-resolver.d.ts.map +1 -1
- package/dist/build/plugins/remove-all-except.d.ts +10 -0
- package/dist/build/plugins/remove-all-except.d.ts.map +1 -0
- package/dist/build/plugins/tsconfig-paths.d.ts +1 -1
- package/dist/build/plugins/tsconfig-paths.d.ts.map +1 -1
- package/dist/build/serverOptions.d.ts.map +1 -1
- package/dist/build/shared/extract-mastra-option.d.ts +4 -8
- package/dist/build/shared/extract-mastra-option.d.ts.map +1 -1
- package/dist/build/types.d.ts +5 -0
- package/dist/build/types.d.ts.map +1 -1
- package/dist/build/utils.d.ts +35 -4
- package/dist/build/utils.d.ts.map +1 -1
- package/dist/build/watcher.d.ts +2 -1
- package/dist/build/watcher.d.ts.map +1 -1
- package/dist/bundler/index.cjs +6 -2
- package/dist/bundler/index.d.ts +10 -7
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/chunk-2VG357HT.cjs +4 -0
- package/dist/{chunk-4YYZKC2P.cjs.map → chunk-2VG357HT.cjs.map} +1 -1
- package/dist/chunk-5FPJTHRK.js +88 -0
- package/dist/chunk-5FPJTHRK.js.map +1 -0
- package/dist/{chunk-2OTEFUER.cjs → chunk-5TYVF4KJ.cjs} +31 -24
- package/dist/chunk-5TYVF4KJ.cjs.map +1 -0
- package/dist/{chunk-3NVSKU27.cjs → chunk-7EPD2XJR.cjs} +76 -20
- package/dist/chunk-7EPD2XJR.cjs.map +1 -0
- package/dist/{chunk-46SXOVGO.js → chunk-DBXWQ2CA.js} +10 -10
- package/dist/chunk-DBXWQ2CA.js.map +1 -0
- package/dist/chunk-G6GFAPPU.js +6 -0
- package/dist/{chunk-PDVYEX76.js.map → chunk-G6GFAPPU.js.map} +1 -1
- package/dist/chunk-GU4OME5Q.cjs +112 -0
- package/dist/chunk-GU4OME5Q.cjs.map +1 -0
- package/dist/chunk-HPGDVJAZ.js +3 -0
- package/dist/{chunk-HXYLK6CH.js.map → chunk-HPGDVJAZ.js.map} +1 -1
- package/dist/{chunk-I47TD6VX.js → chunk-HWSYWSD7.js} +279 -191
- package/dist/chunk-HWSYWSD7.js.map +1 -0
- package/dist/{chunk-IR2ZJ7CP.cjs → chunk-JBE6KM7R.cjs} +3 -3
- package/dist/{chunk-IR2ZJ7CP.cjs.map → chunk-JBE6KM7R.cjs.map} +1 -1
- package/dist/{chunk-NZ47MQSD.cjs → chunk-JRUJ546M.cjs} +10 -10
- package/dist/chunk-JRUJ546M.cjs.map +1 -0
- package/dist/{chunk-IL36YSXF.cjs → chunk-KE4NVPI4.cjs} +3 -3
- package/dist/{chunk-IL36YSXF.cjs.map → chunk-KE4NVPI4.cjs.map} +1 -1
- package/dist/chunk-MCWU6IKS.js +14 -0
- package/dist/{chunk-L4SN27ZE.js.map → chunk-MCWU6IKS.js.map} +1 -1
- package/dist/{chunk-HGMQ75WR.js → chunk-NGQZZ54Y.js} +68 -13
- package/dist/chunk-NGQZZ54Y.js.map +1 -0
- package/dist/chunk-QAOUDKHK.js +67 -0
- package/dist/chunk-QAOUDKHK.js.map +1 -0
- package/dist/{chunk-IJ2JJVRX.js → chunk-SD6NHZ2H.js} +47 -28
- package/dist/chunk-SD6NHZ2H.js.map +1 -0
- package/dist/{chunk-SYGG6SXN.cjs → chunk-T7NCLSYN.cjs} +298 -210
- package/dist/chunk-T7NCLSYN.cjs.map +1 -0
- package/dist/{chunk-2NO5NO4J.js → chunk-V4HCIN6G.js} +3 -3
- package/dist/{chunk-2NO5NO4J.js.map → chunk-V4HCIN6G.js.map} +1 -1
- package/dist/{chunk-UEEYA5FR.cjs → chunk-VOI3B5MX.cjs} +54 -34
- package/dist/chunk-VOI3B5MX.cjs.map +1 -0
- package/dist/chunk-ZXQ7DOYU.cjs +16 -0
- package/dist/{chunk-BJURVMEW.cjs.map → chunk-ZXQ7DOYU.cjs.map} +1 -1
- package/dist/default-u_dwuiYb-JPNIZQKK.cjs +9 -0
- package/dist/{default-u_dwuiYb-WPBHZH2R.cjs.map → default-u_dwuiYb-JPNIZQKK.cjs.map} +1 -1
- package/dist/default-u_dwuiYb-RK5OD4MY.js +3 -0
- package/dist/{default-u_dwuiYb-MRYQILW4.js.map → default-u_dwuiYb-RK5OD4MY.js.map} +1 -1
- package/dist/docs/README.md +32 -0
- package/dist/docs/SKILL.md +36 -0
- package/dist/docs/SOURCE_MAP.json +27 -0
- package/dist/docs/deployer/01-reference.md +93 -0
- package/dist/docs/deployment/01-overview.md +64 -0
- package/dist/docs/deployment/02-mastra-server.md +129 -0
- package/dist/docs/deployment/03-monorepo.md +142 -0
- package/dist/docs/deployment/04-cloud-providers.md +17 -0
- package/dist/docs/deployment/05-web-framework.md +55 -0
- package/dist/docs/deployment/06-workflow-runners.md +11 -0
- package/dist/effect-QlVUlMFu-HN3LWZSQ.cjs +17 -0
- package/dist/{effect-QlVUlMFu-N7VAYT2B.cjs.map → effect-QlVUlMFu-HN3LWZSQ.cjs.map} +1 -1
- package/dist/{effect-QlVUlMFu-NH625H3V.js → effect-QlVUlMFu-XOJ2F4UA.js} +4 -4
- package/dist/{effect-QlVUlMFu-NH625H3V.js.map → effect-QlVUlMFu-XOJ2F4UA.js.map} +1 -1
- package/dist/{esm-T7FR74HN.js → esm-6TGK2CUM.js} +41 -41
- package/dist/esm-6TGK2CUM.js.map +1 -0
- package/dist/{esm-BZAOWJTI.cjs → esm-SQKX5ABS.cjs} +82 -82
- package/dist/esm-SQKX5ABS.cjs.map +1 -0
- package/dist/index.cjs +4 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -14
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +523 -87
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +521 -86
- package/dist/server/index.js.map +1 -1
- package/dist/server/types.d.ts +1 -1
- package/dist/server/types.d.ts.map +1 -1
- package/dist/sury-CWZTCd75-KEHKUXG7.cjs +17 -0
- package/dist/{sury-CWZTCd75-E5BDQIXB.cjs.map → sury-CWZTCd75-KEHKUXG7.cjs.map} +1 -1
- package/dist/{sury-CWZTCd75-HWBNYVQW.js → sury-CWZTCd75-L2D76L25.js} +4 -4
- package/dist/{sury-CWZTCd75-HWBNYVQW.js.map → sury-CWZTCd75-L2D76L25.js.map} +1 -1
- package/dist/typebox-Dei93FPO-LBLFC3RD.js +8 -0
- package/dist/{typebox-Dei93FPO-XXPZXWWK.js.map → typebox-Dei93FPO-LBLFC3RD.js.map} +1 -1
- package/dist/{typebox-Dei93FPO-42ICWLXF.cjs → typebox-Dei93FPO-RDSW6DFA.cjs} +3 -3
- package/dist/{typebox-Dei93FPO-42ICWLXF.cjs.map → typebox-Dei93FPO-RDSW6DFA.cjs.map} +1 -1
- package/dist/valibot--1zFm7rT-NVADAEQI.cjs +17 -0
- package/dist/{valibot--1zFm7rT-ALWQ34TP.cjs.map → valibot--1zFm7rT-NVADAEQI.cjs.map} +1 -1
- package/dist/{valibot--1zFm7rT-W6DSEVCL.js → valibot--1zFm7rT-R2UKWLZC.js} +4 -4
- package/dist/{valibot--1zFm7rT-W6DSEVCL.js.map → valibot--1zFm7rT-R2UKWLZC.js.map} +1 -1
- package/dist/{valibot-D_HTw1Gn-PN7GEV4F.cjs → valibot-D_HTw1Gn-DSFFOUBW.cjs} +7 -7
- package/dist/{valibot-D_HTw1Gn-PN7GEV4F.cjs.map → valibot-D_HTw1Gn-DSFFOUBW.cjs.map} +1 -1
- package/dist/{valibot-D_HTw1Gn-LVFT5X5F.js → valibot-D_HTw1Gn-KWXWP2TJ.js} +5 -5
- package/dist/{valibot-D_HTw1Gn-LVFT5X5F.js.map → valibot-D_HTw1Gn-KWXWP2TJ.js.map} +1 -1
- package/dist/validator/custom-resolver.cjs +2 -2
- package/dist/validator/custom-resolver.js +1 -1
- package/dist/{zod-Bwrt9trS-UDAV5VDV.js → zod-Bwrt9trS-GCUGPBJX.js} +5 -5
- package/dist/{zod-Bwrt9trS-UDAV5VDV.js.map → zod-Bwrt9trS-GCUGPBJX.js.map} +1 -1
- package/dist/{zod-Bwrt9trS-C5ATNTZG.cjs → zod-Bwrt9trS-ZZHFZ7YQ.cjs} +7 -7
- package/dist/{zod-Bwrt9trS-C5ATNTZG.cjs.map → zod-Bwrt9trS-ZZHFZ7YQ.cjs.map} +1 -1
- package/dist/{zod-DSgpEGAE-EH7N2QK7.cjs → zod-DSgpEGAE-3CMS4FSB.cjs} +7 -7
- package/dist/{zod-DSgpEGAE-EH7N2QK7.cjs.map → zod-DSgpEGAE-3CMS4FSB.cjs.map} +1 -1
- package/dist/{zod-DSgpEGAE-AVWGGTUD.js → zod-DSgpEGAE-IPE3O2NQ.js} +5 -5
- package/dist/{zod-DSgpEGAE-AVWGGTUD.js.map → zod-DSgpEGAE-IPE3O2NQ.js.map} +1 -1
- package/package.json +15 -15
- package/dist/arktype-aI7TBD0R-JG4WETGU.js +0 -8
- package/dist/build/babel/get-deployer.d.ts +0 -3
- package/dist/build/babel/get-deployer.d.ts.map +0 -1
- package/dist/build/babel/remove-all-options-bundler.d.ts +0 -5
- package/dist/build/babel/remove-all-options-bundler.d.ts.map +0 -1
- package/dist/build/babel/remove-all-options-deployer.d.ts +0 -5
- package/dist/build/babel/remove-all-options-deployer.d.ts.map +0 -1
- package/dist/build/babel/remove-all-options-server.d.ts +0 -5
- package/dist/build/babel/remove-all-options-server.d.ts.map +0 -1
- package/dist/chunk-2OTEFUER.cjs.map +0 -1
- package/dist/chunk-3NVSKU27.cjs.map +0 -1
- package/dist/chunk-46SXOVGO.js.map +0 -1
- package/dist/chunk-4YYZKC2P.cjs +0 -4
- package/dist/chunk-5CWPEG6R.js +0 -62
- package/dist/chunk-5CWPEG6R.js.map +0 -1
- package/dist/chunk-BJURVMEW.cjs +0 -16
- package/dist/chunk-HGMQ75WR.js.map +0 -1
- package/dist/chunk-HXYLK6CH.js +0 -3
- package/dist/chunk-I47TD6VX.js.map +0 -1
- package/dist/chunk-IJ2JJVRX.js.map +0 -1
- package/dist/chunk-KTLA3OLD.js +0 -169
- package/dist/chunk-KTLA3OLD.js.map +0 -1
- package/dist/chunk-L4SN27ZE.js +0 -14
- package/dist/chunk-NZ47MQSD.cjs.map +0 -1
- package/dist/chunk-PDVYEX76.js +0 -6
- package/dist/chunk-SYGG6SXN.cjs.map +0 -1
- package/dist/chunk-UEEYA5FR.cjs.map +0 -1
- package/dist/chunk-YQFLK7ZK.cjs +0 -196
- package/dist/chunk-YQFLK7ZK.cjs.map +0 -1
- package/dist/default-u_dwuiYb-MRYQILW4.js +0 -3
- package/dist/default-u_dwuiYb-WPBHZH2R.cjs +0 -9
- package/dist/effect-QlVUlMFu-N7VAYT2B.cjs +0 -17
- package/dist/esm-BZAOWJTI.cjs.map +0 -1
- package/dist/esm-T7FR74HN.js.map +0 -1
- package/dist/server/handlers/prompt.d.ts +0 -3
- package/dist/server/handlers/prompt.d.ts.map +0 -1
- package/dist/sury-CWZTCd75-E5BDQIXB.cjs +0 -17
- package/dist/typebox-Dei93FPO-XXPZXWWK.js +0 -8
- package/dist/valibot--1zFm7rT-ALWQ34TP.cjs +0 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bundler/index.ts"],"names":["MastraBundler","emptyDir","ensureDir","join","writeFile","createBundler","getBundlerOptions","analyzeBundle","DepsService","stat","copy","getWorkspaceInformation","pkg","dirname","getInputOptions","existsSync","virtual","slash","posix","glob","path","fsExtra","FileService","error","MastraError","ErrorDomain","ErrorCategory","getPackageRootPath","readJSON","getPackageName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,IAAM,UAAA,0BAAoB,YAAY;AAEtC,IAAe,OAAA,GAAf,cAA+BA,qBAAA,CAAc;AAAA,EACxC,gBAAA,GAAmB,QAAA;AAAA,EACnB,SAAA,GAAY,QAAA;AAAA,EACZ,QAAA,GAA4B,MAAA;AAAA,EAEtC,WAAA,CAAY,IAAA,EAAc,SAAA,GAAoC,SAAA,EAAW;AACvE,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,SAAA,EAAW,CAAA;AAAA,EAC3B;AAAA,EAEA,MAAM,QAAQ,eAAA,EAAwC;AAEpD,IAAA,MAAMC,iBAAS,eAAe,CAAA;AAE9B,IAAA,MAAMC,iBAAA,CAAUC,SAAA,CAAK,eAAA,EAAiB,IAAA,CAAK,gBAAgB,CAAC,CAAA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AAK,iBAAiB,CAAA,CAAE,MAAA;AACnD,IAAA,IAAI,cAAc,CAAA,EAAG;AACnB,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA,MAAA,EAAS,WAAW,IAAI,WAAA,KAAgB,CAAA,GAAI,MAAA,GAAS,OAAO,CAAA,CAAE,CAAA;AAAA,IACjF;AAAA,EACF;AACF","file":"chunk-VOI3B5MX.cjs","sourcesContent":["import { existsSync } from 'node:fs';\nimport { stat, writeFile } from 'node:fs/promises';\nimport { dirname, join, posix } from 'node:path';\nimport { MastraBundler } from '@mastra/core/bundler';\nimport { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\nimport type { Config } from '@mastra/core/mastra';\nimport virtual from '@rollup/plugin-virtual';\nimport * as pkg from 'empathic/package';\nimport fsExtra, { copy, ensureDir, readJSON, emptyDir } from 'fs-extra/esm';\nimport type { InputOptions, OutputOptions } from 'rollup';\nimport { glob } from 'tinyglobby';\nimport { analyzeBundle } from '../build/analyze';\nimport { createBundler as createBundlerUtil, getInputOptions } from '../build/bundler';\nimport { getBundlerOptions } from '../build/bundlerOptions';\nimport { getPackageRootPath } from '../build/package-info';\nimport type { BundlerOptions } from '../build/types';\nimport type { BundlerPlatform } from '../build/utils';\nimport { getPackageName, slash } from '../build/utils';\nimport { DepsService } from '../services/deps';\nimport { FileService } from '../services/fs';\nimport { getWorkspaceInformation } from './workspaceDependencies';\n\nexport type { BundlerOptions } from '../build/types';\nexport type { BundlerPlatform } from '../build/utils';\n\nexport const IS_DEFAULT = Symbol('IS_DEFAULT');\n\nexport abstract class Bundler extends MastraBundler {\n protected analyzeOutputDir = '.build';\n protected outputDir = 'output';\n protected platform: BundlerPlatform = 'node';\n\n constructor(name: string, component: 'BUNDLER' | 'DEPLOYER' = 'BUNDLER') {\n super({ name, component });\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n // Clean up the output directory first\n await emptyDir(outputDirectory);\n\n await ensureDir(join(outputDirectory, this.analyzeOutputDir));\n await ensureDir(join(outputDirectory, this.outputDir));\n }\n\n async writePackageJson(\n outputDirectory: string,\n dependencies: Map<string, string>,\n resolutions?: Record<string, string>,\n ) {\n this.logger.debug(`Writing project's package.json`);\n\n await ensureDir(outputDirectory);\n const pkgPath = join(outputDirectory, 'package.json');\n\n const dependenciesMap = new Map();\n for (const [key, value] of dependencies.entries()) {\n if (key.startsWith('@')) {\n // Handle scoped packages (e.g. @org/package)\n const pkgChunks = key.split('/');\n dependenciesMap.set(`${pkgChunks[0]}/${pkgChunks[1]}`, value);\n } else {\n // For non-scoped packages, take only the first part before any slash\n const pkgName = key.split('/')[0] || key;\n dependenciesMap.set(pkgName, value);\n }\n }\n\n await writeFile(\n pkgPath,\n JSON.stringify(\n {\n name: 'server',\n version: '1.0.0',\n description: '',\n type: 'module',\n main: 'index.mjs',\n scripts: {\n start: 'node ./index.mjs',\n },\n author: 'Mastra',\n license: 'ISC',\n dependencies: Object.fromEntries(dependenciesMap.entries()),\n ...(Object.keys(resolutions ?? {}).length > 0 && { resolutions }),\n pnpm: {\n neverBuiltDependencies: [],\n },\n },\n null,\n 2,\n ),\n );\n }\n\n protected createBundler(inputOptions: InputOptions, outputOptions: Partial<OutputOptions> & { dir: string }) {\n return createBundlerUtil(inputOptions, outputOptions);\n }\n\n protected async getUserBundlerOptions(\n mastraEntryFile: string,\n outputDirectory: string,\n ): Promise<NonNullable<Config['bundler']>> {\n const defaultBundlerOptions: Config['bundler'] = {\n externals: [],\n sourcemap: false,\n transpilePackages: [],\n [IS_DEFAULT]: true,\n } as const;\n\n try {\n const bundlerOptions = await getBundlerOptions(mastraEntryFile, outputDirectory);\n\n return bundlerOptions ?? defaultBundlerOptions;\n } catch (error) {\n this.logger.debug('Failed to get bundler options, sourcemap will be disabled', { error });\n }\n\n return defaultBundlerOptions;\n }\n\n protected async analyze(entry: string | string[], mastraFile: string, outputDirectory: string) {\n return await analyzeBundle(\n ([] as string[]).concat(entry),\n mastraFile,\n {\n outputDir: join(outputDirectory, this.analyzeOutputDir),\n projectRoot: outputDirectory,\n platform: this.platform,\n },\n this.logger,\n );\n }\n\n protected async installDependencies(outputDirectory: string, rootDir = process.cwd()) {\n const deps = new DepsService(rootDir);\n deps.__setLogger(this.logger);\n\n await deps.install({ dir: join(outputDirectory, this.outputDir) });\n }\n\n protected async copyPublic(mastraDir: string, outputDirectory: string) {\n const publicDir = join(mastraDir, 'public');\n\n try {\n await stat(publicDir);\n } catch {\n return;\n }\n\n await copy(publicDir, join(outputDirectory, this.outputDir));\n }\n\n protected async copyDOTNPMRC({\n rootDir = process.cwd(),\n outputDirectory,\n }: {\n rootDir?: string;\n outputDirectory: string;\n }) {\n const sourceDotNpmRcPath = join(rootDir, '.npmrc');\n const targetDotNpmRcPath = join(outputDirectory, this.outputDir, '.npmrc');\n\n try {\n await stat(sourceDotNpmRcPath);\n await copy(sourceDotNpmRcPath, targetDotNpmRcPath);\n } catch {\n return;\n }\n }\n\n protected async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n { enableSourcemap, enableEsmShim, externals }: BundlerOptions,\n ) {\n const { workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile });\n const closestPkgJson = pkg.up({ cwd: dirname(mastraEntryFile) });\n const projectRoot = closestPkgJson ? dirname(closestPkgJson) : process.cwd();\n\n const inputOptions: InputOptions = await getInputOptions(\n mastraEntryFile,\n analyzedBundleInfo,\n this.platform,\n {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n { sourcemap: enableSourcemap, workspaceRoot, projectRoot, enableEsmShim, externalsPreset: externals === true },\n );\n const isVirtual = serverFile.includes('\\n') || existsSync(serverFile);\n\n const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);\n\n if (isVirtual) {\n inputOptions.input = { index: '#entry', ...toolsInputOptions };\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins.unshift(virtual({ '#entry': serverFile }));\n } else {\n inputOptions.plugins = [virtual({ '#entry': serverFile })];\n }\n } else {\n inputOptions.input = { index: serverFile, ...toolsInputOptions };\n }\n\n return inputOptions;\n }\n\n getAllToolPaths(mastraDir: string, toolsPaths: (string | string[])[] = []): (string | string[])[] {\n // Normalize Windows paths to forward slashes for consistent handling\n const normalizedMastraDir = slash(mastraDir);\n\n // Prepare default tools paths with glob patterns\n const defaultToolsPath = posix.join(normalizedMastraDir, 'tools/**/*.{js,ts}');\n const defaultToolsIgnorePaths = [\n `!${posix.join(normalizedMastraDir, 'tools/**/*.{test,spec}.{js,ts}')}`,\n `!${posix.join(normalizedMastraDir, 'tools/**/__tests__/**')}`,\n ];\n\n // Combine default path with ignore patterns\n const defaultPaths = [defaultToolsPath, ...defaultToolsIgnorePaths];\n\n // If no tools paths provided, use only the default paths\n if (toolsPaths.length === 0) {\n return [defaultPaths];\n }\n\n // If tools paths are provided, add the default paths to ensure standard tools are always included\n return [...toolsPaths, defaultPaths];\n }\n\n async listToolsInputOptions(toolsPaths: (string | string[])[]) {\n const inputs: Record<string, string> = {};\n\n for (const toolPath of toolsPaths) {\n const expandedPaths = await glob(toolPath, {\n absolute: true,\n expandDirectories: false,\n });\n\n for (const path of expandedPaths) {\n if (await fsExtra.pathExists(path)) {\n const fileService = new FileService();\n const entryFile = fileService.getFirstExistingFile([\n join(path, 'index.ts'),\n join(path, 'index.js'),\n path, // if path itself is a file\n ]);\n\n // if it doesn't exist or is a dir skip it. using a dir as a tool will crash the process\n if (!entryFile || (await stat(entryFile)).isDirectory()) {\n this.logger.warn(`No entry file found in ${path}, skipping...`);\n continue;\n }\n\n const uniqueToolID = crypto.randomUUID();\n // Normalize Windows paths to forward slashes for consistent handling\n const normalizedEntryFile = entryFile.replaceAll('\\\\', '/');\n inputs[`tools/${uniqueToolID}`] = normalizedEntryFile;\n } else {\n this.logger.warn(`Tool path ${path} does not exist, skipping...`);\n }\n }\n }\n\n return inputs;\n }\n\n protected async _bundle(\n serverFile: string,\n mastraEntryFile: string,\n {\n projectRoot,\n outputDirectory,\n enableEsmShim = true,\n }: {\n projectRoot: string;\n outputDirectory: string;\n enableEsmShim?: boolean;\n },\n toolsPaths: (string | string[])[] = [],\n bundleLocation: string = join(outputDirectory, this.outputDir),\n ): Promise<void> {\n const analyzeDir = join(outputDirectory, this.analyzeOutputDir);\n\n const bundlerOptions = await this.getUserBundlerOptions(mastraEntryFile, outputDirectory);\n const internalBundlerOptions: BundlerOptions = {\n enableSourcemap: !!bundlerOptions.sourcemap,\n externals: bundlerOptions.externals ?? [],\n enableEsmShim,\n };\n\n let analyzedBundleInfo;\n try {\n const resolvedToolsPaths = await this.listToolsInputOptions(toolsPaths);\n analyzedBundleInfo = await analyzeBundle(\n [serverFile, ...Object.values(resolvedToolsPaths)],\n mastraEntryFile,\n {\n outputDir: analyzeDir,\n projectRoot,\n platform: this.platform,\n bundlerOptions: internalBundlerOptions,\n },\n this.logger,\n );\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n\n if (error instanceof MastraError) {\n throw error;\n }\n\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_ANALYZE_FAILED',\n text: `Failed to analyze Mastra application: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const dependenciesToInstall = new Map<string, string>();\n for (const dep of analyzedBundleInfo.externalDependencies) {\n try {\n if (analyzedBundleInfo.workspaceMap.has(dep)) {\n continue;\n }\n\n const rootPath = await getPackageRootPath(dep);\n const pkg = await readJSON(`${rootPath}/package.json`);\n const actualPackageName = pkg.name;\n const version = pkg.version || 'latest';\n\n // Check if this is an npm alias (import name differs from actual package name)\n // e.g., importing \"ai-v5\" which resolves to package \"ai\"\n // or importing \"@ai-sdk/openai-v5\" which resolves to \"@ai-sdk/openai\"\n // In this case, write npm alias syntax: \"ai-v5\": \"npm:ai@5.0.93\"\n // For scoped packages, compare the full package name (e.g., @scope/pkg)\n const importName = getPackageName(dep);\n const isAlias = actualPackageName && importName !== actualPackageName;\n\n if (isAlias) {\n dependenciesToInstall.set(dep, `npm:${actualPackageName}@${version}`);\n } else {\n dependenciesToInstall.set(dep, version);\n }\n } catch {\n dependenciesToInstall.set(dep, 'latest');\n }\n }\n\n try {\n await this.writePackageJson(join(outputDirectory, this.outputDir), dependenciesToInstall);\n\n this.logger.info('Bundling Mastra application');\n\n const inputOptions: InputOptions = await this.getBundlerOptions(\n serverFile,\n mastraEntryFile,\n analyzedBundleInfo,\n toolsPaths,\n internalBundlerOptions,\n );\n\n const bundler = await this.createBundler(\n {\n ...inputOptions,\n logLevel: inputOptions.logLevel === 'silent' ? 'warn' : inputOptions.logLevel,\n onwarn: warning => {\n if (warning.code === 'CIRCULAR_DEPENDENCY') {\n if (warning.ids?.[0]?.includes('node_modules')) {\n return;\n }\n\n this.logger.warn(`Circular dependency found:\n\\t${warning.message.replace('Circular dependency: ', '')}`);\n }\n },\n },\n {\n dir: bundleLocation,\n manualChunks: {\n mastra: ['#mastra'],\n },\n sourcemap: internalBundlerOptions.enableSourcemap,\n },\n );\n\n await bundler.write();\n const toolImports: string[] = [];\n const toolsExports: string[] = [];\n Array.from(Object.keys(inputOptions.input || {}))\n .filter(key => key.startsWith('tools/'))\n .forEach((key, index) => {\n const toolExport = `tool${index}`;\n toolImports.push(`import * as ${toolExport} from './${key}.mjs';`);\n toolsExports.push(toolExport);\n });\n\n await writeFile(\n join(bundleLocation, 'tools.mjs'),\n `${toolImports.join('\\n')}\n\nexport const tools = [${toolsExports.join(', ')}]`,\n );\n this.logger.info('Bundling Mastra done');\n\n this.logger.info('Copying public files');\n await this.copyPublic(dirname(mastraEntryFile), outputDirectory);\n this.logger.info('Done copying public files');\n\n this.logger.info('Copying .npmrc file');\n await this.copyDOTNPMRC({ outputDirectory, rootDir: projectRoot });\n\n this.logger.info('Done copying .npmrc file');\n\n this.logger.info('Installing dependencies');\n await this.installDependencies(outputDirectory, projectRoot);\n\n this.logger.info('Done installing dependencies');\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_BUNDLE_STAGE_FAILED',\n text: `Failed during bundler bundle stage: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n }\n\n async lint(_entryFile: string, _outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);\n const toolsLength = Object.keys(toolsInputOptions).length;\n if (toolsLength > 0) {\n this.logger.info(`Found ${toolsLength} ${toolsLength === 1 ? 'tool' : 'tools'}`);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkJBE6KM7R_cjs = require('./chunk-JBE6KM7R.cjs');
|
|
4
|
+
var chunkJRUJ546M_cjs = require('./chunk-JRUJ546M.cjs');
|
|
5
|
+
|
|
6
|
+
// ../../node_modules/.pnpm/@standard-community+standard-openapi@0.2.9_@standard-community+standard-json@0.3.5_@sta_54b5e515d9ef28e1ec1313d6d3effba2/node_modules/@standard-community/standard-openapi/dist/default-u_dwuiYb.js
|
|
7
|
+
function getToOpenAPISchemaFn() {
|
|
8
|
+
return async (schema, context) => chunkJBE6KM7R_cjs.convertToOpenAPISchema(
|
|
9
|
+
await chunkJRUJ546M_cjs.toJsonSchema(schema, context.options),
|
|
10
|
+
context
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.getToOpenAPISchemaFn = getToOpenAPISchemaFn;
|
|
15
|
+
//# sourceMappingURL=chunk-ZXQ7DOYU.cjs.map
|
|
16
|
+
//# sourceMappingURL=chunk-ZXQ7DOYU.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/@standard-community+standard-openapi@0.2.9_@standard-community+standard-json@0.3.5_@
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/@standard-community+standard-openapi@0.2.9_@standard-community+standard-json@0.3.5_@sta_54b5e515d9ef28e1ec1313d6d3effba2/node_modules/@standard-community/standard-openapi/dist/default-u_dwuiYb.js"],"names":["convertToOpenAPISchema","toJsonSchema"],"mappings":";;;;;;AAGA,SAAS,oBAAA,GAAuB;AAC9B,EAAA,OAAO,OAAO,QAAQ,OAAA,KAAYA,wCAAA;AAAA,IAChC,MAAMC,8BAAA,CAAa,MAAA,EAAQ,OAAA,CAAQ,OAAO,CAAA;AAAA,IAC1C;AAAA,GACF;AACF","file":"chunk-ZXQ7DOYU.cjs","sourcesContent":["import { toJsonSchema } from '@standard-community/standard-json';\nimport { convertToOpenAPISchema } from './vendors/convert.js';\n\nfunction getToOpenAPISchemaFn() {\n return async (schema, context) => convertToOpenAPISchema(\n await toJsonSchema(schema, context.options),\n context\n );\n}\n\nexport { getToOpenAPISchemaFn as default };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"default-u_dwuiYb-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"default-u_dwuiYb-JPNIZQKK.cjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"default-u_dwuiYb-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"default-u_dwuiYb-RK5OD4MY.js"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @mastra/deployer Documentation
|
|
2
|
+
|
|
3
|
+
> Embedded documentation for coding agents
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Read the skill overview
|
|
9
|
+
cat docs/SKILL.md
|
|
10
|
+
|
|
11
|
+
# Get the source map
|
|
12
|
+
cat docs/SOURCE_MAP.json
|
|
13
|
+
|
|
14
|
+
# Read topic documentation
|
|
15
|
+
cat docs/<topic>/01-overview.md
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Structure
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
docs/
|
|
22
|
+
├── SKILL.md # Entry point
|
|
23
|
+
├── README.md # This file
|
|
24
|
+
├── SOURCE_MAP.json # Export index
|
|
25
|
+
├── deployer/ (1 files)
|
|
26
|
+
├── deployment/ (6 files)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Version
|
|
30
|
+
|
|
31
|
+
Package: @mastra/deployer
|
|
32
|
+
Version: 1.0.0
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mastra-deployer-docs
|
|
3
|
+
description: Documentation for @mastra/deployer. Includes links to type definitions and readable implementation code in dist/.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @mastra/deployer Documentation
|
|
7
|
+
|
|
8
|
+
> **Version**: 1.0.0
|
|
9
|
+
> **Package**: @mastra/deployer
|
|
10
|
+
|
|
11
|
+
## Quick Navigation
|
|
12
|
+
|
|
13
|
+
Use SOURCE_MAP.json to find any export:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cat docs/SOURCE_MAP.json
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Each export maps to:
|
|
20
|
+
- **types**: `.d.ts` file with JSDoc and API signatures
|
|
21
|
+
- **implementation**: `.js` chunk file with readable source
|
|
22
|
+
- **docs**: Conceptual documentation in `docs/`
|
|
23
|
+
|
|
24
|
+
## Top Exports
|
|
25
|
+
|
|
26
|
+
- Deps: dist/index.d.ts
|
|
27
|
+
- FileService: dist/index.d.ts
|
|
28
|
+
- createChildProcessLogger: dist/index.d.ts
|
|
29
|
+
- createPinoStream: dist/index.d.ts
|
|
30
|
+
|
|
31
|
+
See SOURCE_MAP.json for the complete list.
|
|
32
|
+
|
|
33
|
+
## Available Topics
|
|
34
|
+
|
|
35
|
+
- [Deployer](deployer/) - 1 file(s)
|
|
36
|
+
- [Deployment](deployment/) - 6 file(s)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"package": "@mastra/deployer",
|
|
4
|
+
"exports": {
|
|
5
|
+
"Deps": {
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"implementation": "dist/chunk-DPDWM7HQ.js",
|
|
8
|
+
"line": 60
|
|
9
|
+
},
|
|
10
|
+
"FileService": {
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"implementation": "dist/chunk-DPDWM7HQ.js",
|
|
13
|
+
"line": 337
|
|
14
|
+
},
|
|
15
|
+
"createChildProcessLogger": {
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"implementation": "dist/chunk-DPDWM7HQ.js",
|
|
18
|
+
"line": 24
|
|
19
|
+
},
|
|
20
|
+
"createPinoStream": {
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"implementation": "dist/chunk-DPDWM7HQ.js",
|
|
23
|
+
"line": 12
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"modules": {}
|
|
27
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Deployer API Reference
|
|
2
|
+
|
|
3
|
+
> API reference for deployer - 1 entries
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Reference: Deployer
|
|
9
|
+
|
|
10
|
+
> Documentation for the Deployer abstract class, which handles packaging and deployment of Mastra applications.
|
|
11
|
+
|
|
12
|
+
The Deployer handles the deployment of standalone Mastra applications by packaging code, managing environment files, and serving applications using the Hono framework. Concrete implementations must define the deploy method for specific deployment targets.
|
|
13
|
+
|
|
14
|
+
## Usage Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { Deployer } from "@mastra/deployer";
|
|
18
|
+
|
|
19
|
+
// Create a custom deployer by extending the abstract Deployer class
|
|
20
|
+
class CustomDeployer extends Deployer {
|
|
21
|
+
constructor() {
|
|
22
|
+
super({ name: "custom-deployer" });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Implement the abstract deploy method
|
|
26
|
+
async deploy(outputDirectory: string): Promise<void> {
|
|
27
|
+
// Prepare the output directory
|
|
28
|
+
await this.prepare(outputDirectory);
|
|
29
|
+
|
|
30
|
+
// Bundle the application
|
|
31
|
+
await this._bundle("server.ts", "mastra.ts", outputDirectory);
|
|
32
|
+
|
|
33
|
+
// Custom deployment logic
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Parameters
|
|
39
|
+
|
|
40
|
+
### Constructor Parameters
|
|
41
|
+
|
|
42
|
+
### deploy Parameters
|
|
43
|
+
|
|
44
|
+
## Methods
|
|
45
|
+
|
|
46
|
+
## Inherited Methods from Bundler
|
|
47
|
+
|
|
48
|
+
The Deployer class inherits the following key methods from the Bundler class:
|
|
49
|
+
|
|
50
|
+
## Core Concepts
|
|
51
|
+
|
|
52
|
+
### Deployment Lifecycle
|
|
53
|
+
|
|
54
|
+
The Deployer abstract class implements a structured deployment lifecycle:
|
|
55
|
+
|
|
56
|
+
1. **Initialization**: The deployer is initialized with a name and creates a Deps instance for dependency management.
|
|
57
|
+
2. **Environment Setup**: The `getEnvFiles` method identifies environment files (.env.production, .env) to be used during deployment.
|
|
58
|
+
3. **Preparation**: The `prepare` method (inherited from Bundler) cleans the output directory and creates necessary subdirectories.
|
|
59
|
+
4. **Bundling**: The `_bundle` method (inherited from Bundler) packages the application code and its dependencies.
|
|
60
|
+
5. **Deployment**: The abstract `deploy` method is implemented by subclasses to handle the actual deployment process.
|
|
61
|
+
|
|
62
|
+
### Environment File Management
|
|
63
|
+
|
|
64
|
+
The Deployer class includes built-in support for environment file management through the `getEnvFiles` method. This method:
|
|
65
|
+
|
|
66
|
+
- Looks for environment files in a predefined order (.env.production, .env)
|
|
67
|
+
- Uses the FileService to find the first existing file
|
|
68
|
+
- Returns an array of found environment files
|
|
69
|
+
- Returns an empty array if no environment files are found
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
getEnvFiles(): Promise<string[]> {
|
|
73
|
+
const possibleFiles = ['.env.production', '.env.local', '.env'];
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
const fileService = new FileService();
|
|
77
|
+
const envFile = fileService.getFirstExistingFile(possibleFiles);
|
|
78
|
+
|
|
79
|
+
return Promise.resolve([envFile]);
|
|
80
|
+
} catch {}
|
|
81
|
+
|
|
82
|
+
return Promise.resolve([]);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Bundling and Deployment Relationship
|
|
87
|
+
|
|
88
|
+
The Deployer class extends the Bundler class, establishing a clear relationship between bundling and deployment:
|
|
89
|
+
|
|
90
|
+
1. **Bundling as a Prerequisite**: Bundling is a prerequisite step for deployment, where the application code is packaged into a deployable format.
|
|
91
|
+
2. **Shared Infrastructure**: Both bundling and deployment share common infrastructure like dependency management and file system operations.
|
|
92
|
+
3. **Specialized Deployment Logic**: While bundling focuses on code packaging, deployment adds environment-specific logic for deploying the bundled code.
|
|
93
|
+
4. **Extensibility**: The abstract `deploy` method allows for creating specialized deployers for different target environments.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
> Learn about different deployment options for your Mastra applications
|
|
2
|
+
|
|
3
|
+
# Deployment Overview
|
|
4
|
+
|
|
5
|
+
Mastra applications can be deployed to any Node.js-compatible environment. You can deploy a Mastra server, integrate with an existing web framework, deploy to cloud providers, or use Mastra Cloud for managed hosting.
|
|
6
|
+
|
|
7
|
+
## Runtime support
|
|
8
|
+
|
|
9
|
+
Mastra can run against any of these runtime environments:
|
|
10
|
+
|
|
11
|
+
- Node.js `v22.13.0` or later
|
|
12
|
+
- Bun
|
|
13
|
+
- Deno
|
|
14
|
+
- Cloudflare
|
|
15
|
+
|
|
16
|
+
## Deployment Options
|
|
17
|
+
|
|
18
|
+
### Mastra Server
|
|
19
|
+
|
|
20
|
+
Mastra provides a [server](https://mastra.ai/docs/v1/server/mastra-server) powered by Hono that can be deployed independently. Use the `mastra build` command to build your application and deploy the output to your preferred VM, container, or PaaS platform.
|
|
21
|
+
|
|
22
|
+
Use this option when you need full control over your infrastructure, long-running processes, or WebSocket connections. The [Mastra server deployment guide](https://mastra.ai/docs/v1/deployment/mastra-server) provides more details.
|
|
23
|
+
|
|
24
|
+
### Monorepo
|
|
25
|
+
|
|
26
|
+
Deploy a Mastra server as part of a monorepo setup, following the same approach as standalone deployment.
|
|
27
|
+
|
|
28
|
+
Read about [monorepo deployment](https://mastra.ai/docs/v1/deployment/monorepo).
|
|
29
|
+
|
|
30
|
+
### Cloud Providers
|
|
31
|
+
|
|
32
|
+
Mastra applications can be deployed to cloud providers and serverless platforms. Mastra includes optional built-in deployers for Vercel, Netlify, and Cloudflare to automate the build and deployment process.
|
|
33
|
+
|
|
34
|
+
Use this option for auto-scaling, minimal infrastructure management, or when you're already using one of these platforms.
|
|
35
|
+
|
|
36
|
+
- [Amazon EC2](https://mastra.ai/guides/v1/deployment/amazon-ec2)
|
|
37
|
+
- [AWS Lambda](https://mastra.ai/guides/v1/deployment/aws-lambda)
|
|
38
|
+
- [Azure App Services](https://mastra.ai/guides/v1/deployment/azure-app-services)
|
|
39
|
+
- [Cloudflare](https://mastra.ai/guides/v1/deployment/cloudflare-deployer)
|
|
40
|
+
- [Digital Ocean](https://mastra.ai/guides/v1/deployment/digital-ocean)
|
|
41
|
+
- [Netlify](https://mastra.ai/guides/v1/deployment/netlify-deployer)
|
|
42
|
+
- [Vercel](https://mastra.ai/guides/v1/deployment/vercel-deployer)
|
|
43
|
+
|
|
44
|
+
### Web Framework
|
|
45
|
+
|
|
46
|
+
When Mastra is integrated with a web framework, it deploys alongside your application using the framework's standard deployment process. The guides below cover framework-specific configuration requirements for deployment.
|
|
47
|
+
|
|
48
|
+
Use these guides when adding Mastra to an existing Next.js or Astro application.
|
|
49
|
+
|
|
50
|
+
- [With Next.js on Vercel](https://mastra.ai/docs/v1/deployment/web-framework#with-nextjs-on-vercel)
|
|
51
|
+
- [With Astro on Vercel](https://mastra.ai/docs/v1/deployment/web-framework#with-astro-on-vercel)
|
|
52
|
+
- [With Astro on Netlify](https://mastra.ai/docs/v1/deployment/web-framework#with-astro-on-netlify)
|
|
53
|
+
|
|
54
|
+
### Mastra Cloud
|
|
55
|
+
|
|
56
|
+
We're building Mastra Cloud to be the easiest place to deploy and observe your Mastra agents. It's currently in beta.
|
|
57
|
+
|
|
58
|
+
Learn more in the [Mastra Cloud docs](https://mastra.ai/docs/v1/mastra-cloud/overview).
|
|
59
|
+
|
|
60
|
+
## Workflow Runners
|
|
61
|
+
|
|
62
|
+
Mastra workflows run using the built-in execution engine by default. For production workloads requiring managed infrastructure, workflows can also be deployed to specialized platforms like [Inngest](https://www.inngest.com) that provide step memoization, automatic retries, and real-time monitoring.
|
|
63
|
+
|
|
64
|
+
Visit the [Workflow Runners guide](https://mastra.ai/docs/v1/deployment/workflow-runners) for execution options and the [Inngest deployment guide](https://mastra.ai/guides/v1/deployment/inngest) for setup instructions.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
> Learn how to build and deploy a Mastra server.
|
|
2
|
+
|
|
3
|
+
# Deploy a Mastra Server
|
|
4
|
+
|
|
5
|
+
Mastra compiles your application into a standalone Node.js server that can run on any platform supporting Node.js, Bun, or Deno.
|
|
6
|
+
|
|
7
|
+
> **Note:**
|
|
8
|
+
|
|
9
|
+
This guide covers deploying the standalone server generated by `mastra build`. If you need to integrate Mastra into an existing Express or Hono application, see [Server Adapters](https://mastra.ai/docs/v1/server/server-adapters) instead.
|
|
10
|
+
|
|
11
|
+
## Building your application
|
|
12
|
+
|
|
13
|
+
Run the build command from your project root:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
mastra build
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This creates a `.mastra` directory containing your production-ready server.
|
|
20
|
+
|
|
21
|
+
> **Note:**
|
|
22
|
+
|
|
23
|
+
Read the [`mastra build`](https://mastra.ai/reference/v1/cli/mastra#mastra-build) reference for all available flags.
|
|
24
|
+
|
|
25
|
+
## Build output
|
|
26
|
+
|
|
27
|
+
After building, Mastra creates the following structure:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
.mastra/
|
|
31
|
+
├── .build/ # Intermediate build artifacts (module maps, analysis)
|
|
32
|
+
└── output/
|
|
33
|
+
├── index.mjs # Server entry point
|
|
34
|
+
├── mastra.mjs # Your bundled Mastra configuration
|
|
35
|
+
├── tools.mjs # Aggregated tool exports
|
|
36
|
+
├── tools/ # Individual tool bundles
|
|
37
|
+
├── package.json # Production dependencies
|
|
38
|
+
├── node_modules/ # Installed dependencies
|
|
39
|
+
├── .npmrc # Copied from your project (if present)
|
|
40
|
+
├── public/ # Static assets (if src/mastra/public exists)
|
|
41
|
+
└── playground/ # Studio UI (if --studio flag used)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The `output` directory is self-contained. You can copy it to any server and run it directly.
|
|
45
|
+
|
|
46
|
+
## Running the server
|
|
47
|
+
|
|
48
|
+
Start the server using the Mastra CLI:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
mastra start
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Or run directly with Node.js:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
node .mastra/output/index.mjs
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The `mastra start` command provides additional features:
|
|
61
|
+
- Loads environment variables from `.env.production` and `.env`
|
|
62
|
+
- Provides helpful error messages for missing modules
|
|
63
|
+
- Handles process signals for graceful shutdown
|
|
64
|
+
|
|
65
|
+
> **Note:**
|
|
66
|
+
|
|
67
|
+
Read the [`mastra start`](https://mastra.ai/reference/v1/cli/mastra#mastra-start) reference for all available flags.
|
|
68
|
+
|
|
69
|
+
## Build configuration
|
|
70
|
+
|
|
71
|
+
### Public folder
|
|
72
|
+
|
|
73
|
+
If a `public` folder exists in your Mastra directory (`src/mastra/public`), its contents are copied to the output directory during build. These files are served as static assets by the server.
|
|
74
|
+
|
|
75
|
+
### Mastra configuration
|
|
76
|
+
|
|
77
|
+
The build process respects configuration in your Mastra instance. For server behavior like CORS, timeouts, and middleware, see [server overview](https://mastra.ai/docs/v1/server/mastra-server). For all available options, see the [configuration reference](https://mastra.ai/reference/v1/configuration).
|
|
78
|
+
|
|
79
|
+
## Build process
|
|
80
|
+
|
|
81
|
+
The build follows these steps:
|
|
82
|
+
|
|
83
|
+
1. **Locates entry file**: Finds `index.ts` or `index.js` in your Mastra directory.
|
|
84
|
+
2. **Discovers tools**: Scans for tool files matching `{mastraDir}/tools/**/*.{js,ts}`, excluding test files.
|
|
85
|
+
3. **Analyzes dependencies**: Determines which packages to bundle vs. install externally.
|
|
86
|
+
4. **Bundles code**: Uses Rollup with tree-shaking and optional source maps.
|
|
87
|
+
5. **Generates server**: Creates a Hono-based HTTP server as `index.mjs`.
|
|
88
|
+
6. **Installs dependencies**: Runs `npm install` in the output directory.
|
|
89
|
+
7. **Copies assets**: Copies `public` folder and `.npmrc` if present.
|
|
90
|
+
|
|
91
|
+
## Environment variables
|
|
92
|
+
|
|
93
|
+
| Variable | Description |
|
|
94
|
+
|----------|-------------|
|
|
95
|
+
| `PORT` | Server port (default: `4111`) |
|
|
96
|
+
| `MASTRA_STUDIO_PATH` | Path to Studio build directory (default: `./playground`) |
|
|
97
|
+
| `MASTRA_SKIP_DOTENV` | Skip loading `.env` files when set |
|
|
98
|
+
| `NODE_OPTIONS` | Node.js options (e.g., `--max-old-space-size=4096` for build memory issues) |
|
|
99
|
+
|
|
100
|
+
## Server endpoints
|
|
101
|
+
|
|
102
|
+
The built server exposes endpoints for health checks, agents, workflows, and more:
|
|
103
|
+
|
|
104
|
+
| Endpoint | Description |
|
|
105
|
+
|----------|-------------|
|
|
106
|
+
| `GET /health` | Health check endpoint, returns `200 OK` |
|
|
107
|
+
| `GET /openapi.json` | OpenAPI specification (if `server.build.openAPIDocs` is enabled) |
|
|
108
|
+
| `GET /swagger-ui` | Interactive API documentation (if `server.build.swaggerUI` is enabled) |
|
|
109
|
+
|
|
110
|
+
This list is not exhaustive. To view all endpoints, run `mastra dev` and visit `http://localhost:4111/swagger-ui`.
|
|
111
|
+
|
|
112
|
+
To add your own endpoints, see [Custom API Routes](https://mastra.ai/docs/v1/server/custom-api-routes).
|
|
113
|
+
|
|
114
|
+
## Troubleshooting
|
|
115
|
+
|
|
116
|
+
### Memory errors during build
|
|
117
|
+
|
|
118
|
+
If you encounter `JavaScript heap out of memory` errors:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
NODE_OPTIONS="--max-old-space-size=4096" mastra build
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Related
|
|
125
|
+
|
|
126
|
+
- [Server Overview](https://mastra.ai/docs/v1/server/mastra-server) - Configure server behavior, middleware, and authentication
|
|
127
|
+
- [Server Adapters](https://mastra.ai/docs/v1/server/server-adapters) - Use Express or Hono instead of `mastra build`
|
|
128
|
+
- [Custom API Routes](https://mastra.ai/docs/v1/server/custom-api-routes) - Add custom HTTP endpoints
|
|
129
|
+
- [Configuration Reference](https://mastra.ai/reference/v1/configuration) - Full configuration options
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
> Learn how to deploy Mastra applications that are part of a monorepo setup
|
|
2
|
+
|
|
3
|
+
# Deploy in a Monorepo
|
|
4
|
+
|
|
5
|
+
Deploying Mastra in a monorepo follows the same process as a standalone application. This guide covers monorepo-specific considerations. For the core build and deployment steps, see [Deploy a Mastra Server](https://mastra.ai/docs/v1/deployment/mastra-server).
|
|
6
|
+
|
|
7
|
+
## Supported monorepos
|
|
8
|
+
|
|
9
|
+
Mastra works with:
|
|
10
|
+
|
|
11
|
+
- npm workspaces
|
|
12
|
+
- pnpm workspaces
|
|
13
|
+
- Yarn workspaces
|
|
14
|
+
- Turborepo
|
|
15
|
+
|
|
16
|
+
Known limitations:
|
|
17
|
+
|
|
18
|
+
- Bun workspaces - partial support; known issues
|
|
19
|
+
- Nx - You can use Nx's [supported dependency strategies](https://nx.dev/concepts/decisions/dependency-management) but you need to have `package.json` files inside your workspace packages
|
|
20
|
+
|
|
21
|
+
## Example structure
|
|
22
|
+
|
|
23
|
+
In this example, the Mastra application is located at `apps/api`:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
apps/
|
|
27
|
+
├── api/
|
|
28
|
+
│ ├── src/
|
|
29
|
+
│ │ └── mastra/
|
|
30
|
+
│ │ ├── agents/
|
|
31
|
+
│ │ ├── tools/
|
|
32
|
+
│ │ ├── workflows/
|
|
33
|
+
│ │ └── index.ts
|
|
34
|
+
│ ├── package.json
|
|
35
|
+
│ └── tsconfig.json
|
|
36
|
+
└── web/
|
|
37
|
+
packages/
|
|
38
|
+
├── ui/
|
|
39
|
+
└── utils/
|
|
40
|
+
package.json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Building from a monorepo
|
|
44
|
+
|
|
45
|
+
Use your monorepo tool to run the build command from the correct package. There's no need for special flags.
|
|
46
|
+
|
|
47
|
+
Examples:
|
|
48
|
+
|
|
49
|
+
**npm:**
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm run build --workspace=apps/api
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**pnpm:**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pnpm --filter api run build
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**yarn:**
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
yarn workspace api build
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**turborepo:**
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
turbo run build --filter=api
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Your package's `build` script should run `mastra build`:
|
|
74
|
+
|
|
75
|
+
```json title="apps/api/package.json"
|
|
76
|
+
{
|
|
77
|
+
"scripts": {
|
|
78
|
+
"build": "mastra build"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Workspace packages
|
|
84
|
+
|
|
85
|
+
When your Mastra application imports from other workspace packages, Mastra handles this automatically:
|
|
86
|
+
|
|
87
|
+
- If the package is pre-compiled (e.g., built with `tsc` or `tsdown`), Mastra imports the compiled JavaScript
|
|
88
|
+
- If the package contains uncompiled TypeScript, Mastra transpiles it during the build
|
|
89
|
+
|
|
90
|
+
For most setups, this works without configuration. If you encounter issues with workspace package imports, add the package to [`transpilePackages`](https://mastra.ai/reference/v1/configuration#bundlertranspilepackages):
|
|
91
|
+
|
|
92
|
+
```typescript title="src/mastra/index.ts"
|
|
93
|
+
export const mastra = new Mastra({
|
|
94
|
+
bundler: {
|
|
95
|
+
transpilePackages: ["@my-org/utils"],
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Environment variables
|
|
101
|
+
|
|
102
|
+
Store `.env` files in the Mastra application directory (e.g., `apps/api/.env`), not the monorepo root.
|
|
103
|
+
|
|
104
|
+
## Deployment configuration
|
|
105
|
+
|
|
106
|
+
When deploying to cloud providers, ensure the correct package is selected as the deploy target. Selecting the monorepo root instead of the application directory (e.g., `apps/api`) is a common mistake.
|
|
107
|
+
|
|
108
|
+
Most providers let you specify the root directory in their dashboard or configuration file.
|
|
109
|
+
|
|
110
|
+
### Mastra Cloud
|
|
111
|
+
|
|
112
|
+
The image below shows how to select `apps/api` as the project root when deploying to [Mastra Cloud](https://mastra.ai/docs/v1/mastra-cloud/overview). While the interface may differ between providers, the configuration remains the same.
|
|
113
|
+
|
|
114
|
+

|
|
115
|
+
|
|
116
|
+
## Dependency management
|
|
117
|
+
|
|
118
|
+
Keep dependencies consistent to avoid version conflicts and build errors:
|
|
119
|
+
|
|
120
|
+
- Use a **single lockfile** at the monorepo root so all packages resolve the same versions
|
|
121
|
+
- Align versions of **shared libraries** (like Mastra or frameworks) to prevent duplicates
|
|
122
|
+
|
|
123
|
+
## Troubleshooting
|
|
124
|
+
|
|
125
|
+
### Workspace package not found
|
|
126
|
+
|
|
127
|
+
If Mastra can't resolve a workspace package, ensure:
|
|
128
|
+
- The package is listed in your `package.json` dependencies
|
|
129
|
+
- Your lockfile is up to date (`pnpm install`, `npm install`, etc.)
|
|
130
|
+
- The package has a valid `main` or `exports` field in its `package.json`
|
|
131
|
+
|
|
132
|
+
### TypeScript errors from workspace packages
|
|
133
|
+
|
|
134
|
+
If you see type errors from uncompiled workspace packages, either:
|
|
135
|
+
- Build the package first (recommended for faster Mastra builds)
|
|
136
|
+
- Add the package to [`transpilePackages`](https://mastra.ai/reference/v1/configuration#bundlertranspilepackages) in your Mastra config
|
|
137
|
+
|
|
138
|
+
## Related
|
|
139
|
+
|
|
140
|
+
- [Deploy a Mastra Server](https://mastra.ai/docs/v1/deployment/mastra-server) - Core build and deployment guide
|
|
141
|
+
- [Configuration Reference](https://mastra.ai/reference/v1/configuration) - `bundler.transpilePackages` and other options
|
|
142
|
+
- [CLI Reference](https://mastra.ai/reference/v1/cli/mastra) - Build command flags
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
> Deploy your Mastra applications to cloud providers
|
|
2
|
+
|
|
3
|
+
# Deploy to Cloud Providers
|
|
4
|
+
|
|
5
|
+
Mastra applications can be deployed to cloud providers and serverless platforms. Mastra includes optional built-in deployers for Vercel, Netlify, and Cloudflare to automate the deployment process.
|
|
6
|
+
|
|
7
|
+
## Supported Cloud Providers
|
|
8
|
+
|
|
9
|
+
The following guides show how to deploy Mastra to specific cloud providers:
|
|
10
|
+
|
|
11
|
+
- [Amazon EC2](https://mastra.ai/guides/v1/deployment/amazon-ec2)
|
|
12
|
+
- [AWS Lambda](https://mastra.ai/guides/v1/deployment/aws-lambda)
|
|
13
|
+
- [Azure App Services](https://mastra.ai/guides/v1/deployment/azure-app-services)
|
|
14
|
+
- [Cloudflare](https://mastra.ai/guides/v1/deployment/cloudflare-deployer)
|
|
15
|
+
- [Digital Ocean](https://mastra.ai/guides/v1/deployment/digital-ocean)
|
|
16
|
+
- [Netlify](https://mastra.ai/guides/v1/deployment/netlify-deployer)
|
|
17
|
+
- [Vercel](https://mastra.ai/guides/v1/deployment/vercel-deployer)
|