@mastra/deployer 1.6.0 → 1.7.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`24284ff`](https://github.com/mastra-ai/mastra/commit/24284ffae306ddf0ab83273e13f033520839ef40), [`f5097cc`](https://github.com/mastra-ai/mastra/commit/f5097cc8a813c82c3378882c31178320cadeb655), [`71e237f`](https://github.com/mastra-ai/mastra/commit/71e237fa852a3ad9a50a3ddb3b5f3b20b9a8181c), [`13a291e`](https://github.com/mastra-ai/mastra/commit/13a291ebb9f9bca80befa0d9166b916bb348e8e9), [`397af5a`](https://github.com/mastra-ai/mastra/commit/397af5a69f34d4157f51a7c8da3f1ded1e1d611c), [`d4701f7`](https://github.com/mastra-ai/mastra/commit/d4701f7e24822b081b70f9c806c39411b1a712e7), [`2b40831`](https://github.com/mastra-ai/mastra/commit/2b40831dcca2275c9570ddf09b7f25ba3e8dc7fc), [`6184727`](https://github.com/mastra-ai/mastra/commit/6184727e812bf7a65cee209bacec3a2f5a16e923), [`0c338b8`](https://github.com/mastra-ai/mastra/commit/0c338b87362dcd95ff8191ca00df645b6953f534), [`6f6385b`](https://github.com/mastra-ai/mastra/commit/6f6385be5b33687cd21e71fc27e972e6928bb34c), [`14aba61`](https://github.com/mastra-ai/mastra/commit/14aba61b9cff76d72bc7ef6f3a83ae2c5d059193), [`dd9dd1c`](https://github.com/mastra-ai/mastra/commit/dd9dd1c9ae32ae79093f8c4adde1732ac6357233)]:
8
+ - @mastra/core@1.7.0
9
+ - @mastra/server@1.7.0
10
+
11
+ ## 1.7.0-alpha.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`24284ff`](https://github.com/mastra-ai/mastra/commit/24284ffae306ddf0ab83273e13f033520839ef40), [`f5097cc`](https://github.com/mastra-ai/mastra/commit/f5097cc8a813c82c3378882c31178320cadeb655), [`71e237f`](https://github.com/mastra-ai/mastra/commit/71e237fa852a3ad9a50a3ddb3b5f3b20b9a8181c), [`13a291e`](https://github.com/mastra-ai/mastra/commit/13a291ebb9f9bca80befa0d9166b916bb348e8e9), [`397af5a`](https://github.com/mastra-ai/mastra/commit/397af5a69f34d4157f51a7c8da3f1ded1e1d611c), [`d4701f7`](https://github.com/mastra-ai/mastra/commit/d4701f7e24822b081b70f9c806c39411b1a712e7), [`2b40831`](https://github.com/mastra-ai/mastra/commit/2b40831dcca2275c9570ddf09b7f25ba3e8dc7fc), [`6184727`](https://github.com/mastra-ai/mastra/commit/6184727e812bf7a65cee209bacec3a2f5a16e923), [`6f6385b`](https://github.com/mastra-ai/mastra/commit/6f6385be5b33687cd21e71fc27e972e6928bb34c), [`14aba61`](https://github.com/mastra-ai/mastra/commit/14aba61b9cff76d72bc7ef6f3a83ae2c5d059193), [`dd9dd1c`](https://github.com/mastra-ai/mastra/commit/dd9dd1c9ae32ae79093f8c4adde1732ac6357233)]:
16
+ - @mastra/core@1.7.0-alpha.0
17
+ - @mastra/server@1.7.0-alpha.0
18
+
3
19
  ## 1.6.0
4
20
 
5
21
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -109,7 +109,7 @@
109
109
  "strip-json-comments": "^5.0.3",
110
110
  "tinyglobby": "^0.2.15",
111
111
  "typescript-paths": "^1.5.1",
112
- "@mastra/server": "1.6.0"
112
+ "@mastra/server": "1.7.0"
113
113
  },
114
114
  "devDependencies": {
115
115
  "@hono/node-server": "^1.19.9",
@@ -129,10 +129,10 @@
129
129
  "typescript": "^5.9.3",
130
130
  "vitest": "4.0.18",
131
131
  "zod": "^3.25.76",
132
- "@internal/lint": "0.0.61",
133
- "@internal/types-builder": "0.0.36",
134
- "@mastra/core": "1.6.0",
135
- "@mastra/hono": "1.1.5",
132
+ "@internal/lint": "0.0.62",
133
+ "@internal/types-builder": "0.0.37",
134
+ "@mastra/core": "1.7.0",
135
+ "@mastra/hono": "1.1.6",
136
136
  "@mastra/mcp": "^1.0.1"
137
137
  },
138
138
  "peerDependencies": {
@@ -1,31 +0,0 @@
1
- ---
2
- name: mastra-deployer
3
- description: Documentation for @mastra/deployer. Use when working with @mastra/deployer APIs, configuration, or implementation.
4
- metadata:
5
- package: "@mastra/deployer"
6
- version: "1.6.0"
7
- ---
8
-
9
- ## When to use
10
-
11
- Use this skill whenever you are working with @mastra/deployer to obtain the domain-specific knowledge.
12
-
13
- ## How to use
14
-
15
- Read the individual reference documents for detailed explanations and code examples.
16
-
17
- ### Docs
18
-
19
- - [Deploy to Cloud Providers](references/docs-deployment-cloud-providers.md) - Deploy your Mastra applications to cloud providers
20
- - [Deploy a Mastra Server](references/docs-deployment-mastra-server.md) - Learn how to build and deploy a Mastra server.
21
- - [Deploy in a Monorepo](references/docs-deployment-monorepo.md) - Learn how to deploy Mastra applications that are part of a monorepo setup
22
- - [Deployment Overview](references/docs-deployment-overview.md) - Learn about different deployment options for your Mastra applications
23
- - [Deploy with a Web Framework](references/docs-deployment-web-framework.md) - Learn how Mastra can be deployed when integrated with a Web Framework
24
- - [Workflow Runners](references/docs-deployment-workflow-runners.md) - Deploy Mastra workflows to specialized workflow execution platforms
25
-
26
- ### Reference
27
-
28
- - [Reference: Deployer](references/reference-deployer.md) - Documentation for the Deployer abstract class, which handles packaging and deployment of Mastra applications.
29
-
30
-
31
- Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
@@ -1,27 +0,0 @@
1
- {
2
- "version": "1.6.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
- }
@@ -1,15 +0,0 @@
1
- # Deploy to Cloud Providers
2
-
3
- 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.
4
-
5
- ## Supported Cloud Providers
6
-
7
- The following guides show how to deploy Mastra to specific cloud providers:
8
-
9
- - [Amazon EC2](https://mastra.ai/guides/deployment/amazon-ec2)
10
- - [AWS Lambda](https://mastra.ai/guides/deployment/aws-lambda)
11
- - [Azure App Services](https://mastra.ai/guides/deployment/azure-app-services)
12
- - [Cloudflare](https://mastra.ai/guides/deployment/cloudflare)
13
- - [Digital Ocean](https://mastra.ai/guides/deployment/digital-ocean)
14
- - [Netlify](https://mastra.ai/guides/deployment/netlify)
15
- - [Vercel](https://mastra.ai/guides/deployment/vercel)
@@ -1,122 +0,0 @@
1
- # Deploy a Mastra Server
2
-
3
- Mastra compiles your application into a standalone Node.js server that can run on any platform supporting Node.js, Bun, or Deno.
4
-
5
- > **Tip:** 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/server/server-adapters) instead.
6
-
7
- ## Building your application
8
-
9
- Run the build command from your project root:
10
-
11
- ```bash
12
- mastra build
13
- ```
14
-
15
- This creates a `.mastra` directory containing your production-ready server.
16
-
17
- > **Info:** Read the [`mastra build`](https://mastra.ai/reference/cli/mastra) reference for all available flags.
18
-
19
- ## Build output
20
-
21
- After building, Mastra creates the following structure:
22
-
23
- ```text
24
- .mastra/
25
- ├── .build/ # Intermediate build artifacts (module maps, analysis)
26
- └── output/
27
- ├── index.mjs # Server entry point
28
- ├── mastra.mjs # Your bundled Mastra configuration
29
- ├── tools.mjs # Aggregated tool exports
30
- ├── tools/ # Individual tool bundles
31
- ├── package.json # Production dependencies
32
- ├── node_modules/ # Installed dependencies
33
- ├── .npmrc # Copied from your project (if present)
34
- ├── public/ # Static assets (if src/mastra/public exists)
35
- └── playground/ # Studio UI (if --studio flag used)
36
- ```
37
-
38
- The `output` directory is self-contained. You can copy it to any server and run it directly.
39
-
40
- ## Running the server
41
-
42
- Start the server using the Mastra CLI:
43
-
44
- ```bash
45
- mastra start
46
- ```
47
-
48
- Or run directly with Node.js:
49
-
50
- ```bash
51
- node .mastra/output/index.mjs
52
- ```
53
-
54
- The `mastra start` command provides additional features:
55
-
56
- - Loads environment variables from `.env.production` and `.env`
57
- - Provides helpful error messages for missing modules
58
- - Handles process signals for graceful shutdown
59
-
60
- > **Info:** Read the [`mastra start`](https://mastra.ai/reference/cli/mastra) reference for all available flags.
61
-
62
- ## Build configuration
63
-
64
- ### Public folder
65
-
66
- 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.
67
-
68
- ### Mastra configuration
69
-
70
- The build process respects configuration in your Mastra instance. For server behavior like CORS, timeouts, and middleware, see [server overview](https://mastra.ai/docs/server/mastra-server). For all available options, see the [configuration reference](https://mastra.ai/reference/configuration).
71
-
72
- ## Build process
73
-
74
- The build follows these steps:
75
-
76
- 1. **Locates entry file**: Finds `index.ts` or `index.js` in your Mastra directory.
77
- 2. **Discovers tools**: Scans for tool files matching `{mastraDir}/tools/**/*.{js,ts}`, excluding test files.
78
- 3. **Analyzes dependencies**: Determines which packages to bundle vs. install externally.
79
- 4. **Bundles code**: Uses Rollup with tree-shaking and optional source maps.
80
- 5. **Generates server**: Creates a Hono-based HTTP server as `index.mjs`.
81
- 6. **Installs dependencies**: Runs `npm install` in the output directory.
82
- 7. **Copies assets**: Copies `public` folder and `.npmrc` if present.
83
-
84
- ## Environment variables
85
-
86
- | Variable | Description |
87
- | -------------------- | --------------------------------------------------------------------------- |
88
- | `PORT` | Server port (default: `4111`) |
89
- | `MASTRA_STUDIO_PATH` | Path to Studio build directory (default: `./playground`) |
90
- | `MASTRA_SKIP_DOTENV` | Skip loading `.env` files when set |
91
- | `NODE_OPTIONS` | Node.js options (e.g., `--max-old-space-size=4096` for build memory issues) |
92
-
93
- ## Server endpoints
94
-
95
- The built server exposes endpoints for health checks, agents, workflows, and more:
96
-
97
- | Endpoint | Description |
98
- | ------------------- | ---------------------------------------------------------------------- |
99
- | `GET /health` | Health check endpoint, returns `200 OK` |
100
- | `GET /openapi.json` | OpenAPI specification (if `server.build.openAPIDocs` is enabled) |
101
- | `GET /swagger-ui` | Interactive API documentation (if `server.build.swaggerUI` is enabled) |
102
-
103
- This list is not exhaustive. To view all endpoints, run `mastra dev` and visit `http://localhost:4111/swagger-ui`.
104
-
105
- To add your own endpoints, see [Custom API Routes](https://mastra.ai/docs/server/custom-api-routes).
106
-
107
- ## Troubleshooting
108
-
109
- ### Memory errors during build
110
-
111
- If you encounter `JavaScript heap out of memory` errors:
112
-
113
- ```bash
114
- NODE_OPTIONS="--max-old-space-size=4096" mastra build
115
- ```
116
-
117
- ## Related
118
-
119
- - [Server Overview](https://mastra.ai/docs/server/mastra-server) - Configure server behavior, middleware, and authentication
120
- - [Server Adapters](https://mastra.ai/docs/server/server-adapters) - Use Express or Hono instead of `mastra build`
121
- - [Custom API Routes](https://mastra.ai/docs/server/custom-api-routes) - Add custom HTTP endpoints
122
- - [Configuration Reference](https://mastra.ai/reference/configuration) - Full configuration options
@@ -1,142 +0,0 @@
1
- # Deploy in a Monorepo
2
-
3
- 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/deployment/mastra-server).
4
-
5
- ## Supported monorepos
6
-
7
- Mastra works with:
8
-
9
- - npm workspaces
10
- - pnpm workspaces
11
- - Yarn workspaces
12
- - Turborepo
13
-
14
- Known limitations:
15
-
16
- - Bun workspaces - partial support; known issues
17
- - 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
18
-
19
- ## Example structure
20
-
21
- In this example, the Mastra application is located at `apps/api`:
22
-
23
- ```text
24
- apps/
25
- ├── api/
26
- │ ├── src/
27
- │ │ └── mastra/
28
- │ │ ├── agents/
29
- │ │ ├── tools/
30
- │ │ ├── workflows/
31
- │ │ └── index.ts
32
- │ ├── package.json
33
- │ └── tsconfig.json
34
- └── web/
35
- packages/
36
- ├── ui/
37
- └── utils/
38
- package.json
39
- ```
40
-
41
- ## Building from a monorepo
42
-
43
- Use your monorepo tool to run the build command from the correct package. There's no need for special flags.
44
-
45
- Examples:
46
-
47
- **npm**:
48
-
49
- ```bash
50
- npm run build --workspace=apps/api
51
- ```
52
-
53
- **pnpm**:
54
-
55
- ```bash
56
- pnpm --filter api run build
57
- ```
58
-
59
- **yarn**:
60
-
61
- ```bash
62
- yarn workspace api build
63
- ```
64
-
65
- **Turborepo**:
66
-
67
- ```bash
68
- turbo run build --filter=api
69
- ```
70
-
71
- Your package's `build` script should run `mastra build`:
72
-
73
- ```json
74
- {
75
- "scripts": {
76
- "build": "mastra build"
77
- }
78
- }
79
- ```
80
-
81
- ## Workspace packages
82
-
83
- When your Mastra application imports from other workspace packages, Mastra handles this automatically:
84
-
85
- - If the package is pre-compiled (e.g., built with `tsc` or `tsdown`), Mastra imports the compiled JavaScript
86
- - If the package contains uncompiled TypeScript, Mastra transpiles it during the build
87
-
88
- For most setups, this works without configuration. If you encounter issues with workspace package imports, add the package to [`transpilePackages`](https://mastra.ai/reference/configuration):
89
-
90
- ```typescript
91
- export const mastra = new Mastra({
92
- bundler: {
93
- transpilePackages: ["@my-org/utils"],
94
- },
95
- });
96
- ```
97
-
98
- ## Environment variables
99
-
100
- Store `.env` files in the Mastra application directory (e.g., `apps/api/.env`), not the monorepo root.
101
-
102
- ## Deployment configuration
103
-
104
- 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.
105
-
106
- Most providers let you specify the root directory in their dashboard or configuration file.
107
-
108
- ### Mastra Cloud
109
-
110
- The image below shows how to select `apps/api` as the project root when deploying to [Mastra Cloud](https://mastra.ai/docs/mastra-cloud/overview). While the interface may differ between providers, the configuration remains the same.
111
-
112
- ![Deployment configuration](/assets/images/monorepo-mastra-cloud-6bd3d30cb0ef7c255c8d8bb43aeff4ec.jpg)
113
-
114
- ## Dependency management
115
-
116
- Keep dependencies consistent to avoid version conflicts and build errors:
117
-
118
- - Use a **single lockfile** at the monorepo root so all packages resolve the same versions
119
- - Align versions of **shared libraries** (like Mastra or frameworks) to prevent duplicates
120
-
121
- ## Troubleshooting
122
-
123
- ### Workspace package not found
124
-
125
- If Mastra can't resolve a workspace package, ensure:
126
-
127
- - The package is listed in your `package.json` dependencies
128
- - Your lockfile is up to date (`pnpm install`, `npm install`, etc.)
129
- - The package has a valid `main` or `exports` field in its `package.json`
130
-
131
- ### TypeScript errors from workspace packages
132
-
133
- If you see type errors from uncompiled workspace packages, either:
134
-
135
- - Build the package first (recommended for faster Mastra builds)
136
- - Add the package to [`transpilePackages`](https://mastra.ai/reference/configuration) in your Mastra config
137
-
138
- ## Related
139
-
140
- - [Deploy a Mastra Server](https://mastra.ai/docs/deployment/mastra-server) - Core build and deployment guide
141
- - [Configuration Reference](https://mastra.ai/reference/configuration) - `bundler.transpilePackages` and other options
142
- - [CLI Reference](https://mastra.ai/reference/cli/mastra) - Build command flags
@@ -1,62 +0,0 @@
1
- # Deployment Overview
2
-
3
- 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.
4
-
5
- ## Runtime support
6
-
7
- Mastra can run against any of these runtime environments:
8
-
9
- - Node.js `v22.13.0` or later
10
- - Bun
11
- - Deno
12
- - Cloudflare
13
-
14
- ## Deployment Options
15
-
16
- ### Mastra Server
17
-
18
- Mastra provides a [server](https://mastra.ai/docs/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.
19
-
20
- 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/deployment/mastra-server) provides more details.
21
-
22
- ### Monorepo
23
-
24
- Deploy a Mastra server as part of a monorepo setup, following the same approach as standalone deployment.
25
-
26
- Read about [monorepo deployment](https://mastra.ai/docs/deployment/monorepo).
27
-
28
- ### Cloud Providers
29
-
30
- 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.
31
-
32
- Use this option for auto-scaling, minimal infrastructure management, or when you're already using one of these platforms.
33
-
34
- - [Amazon EC2](https://mastra.ai/guides/deployment/amazon-ec2)
35
- - [AWS Lambda](https://mastra.ai/guides/deployment/aws-lambda)
36
- - [Azure App Services](https://mastra.ai/guides/deployment/azure-app-services)
37
- - [Cloudflare](https://mastra.ai/guides/deployment/cloudflare)
38
- - [Digital Ocean](https://mastra.ai/guides/deployment/digital-ocean)
39
- - [Netlify](https://mastra.ai/guides/deployment/netlify)
40
- - [Vercel](https://mastra.ai/guides/deployment/vercel)
41
-
42
- ### Web Framework
43
-
44
- 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.
45
-
46
- Use these guides when adding Mastra to an existing Next.js or Astro application.
47
-
48
- - [With Next.js on Vercel](https://mastra.ai/docs/deployment/web-framework)
49
- - [With Astro on Vercel](https://mastra.ai/docs/deployment/web-framework)
50
- - [With Astro on Netlify](https://mastra.ai/docs/deployment/web-framework)
51
-
52
- ### Mastra Cloud
53
-
54
- We're building Mastra Cloud to be the easiest place to deploy and observe your Mastra agents. It's currently in beta.
55
-
56
- Learn more in the [Mastra Cloud docs](https://mastra.ai/docs/mastra-cloud/overview).
57
-
58
- ## Workflow Runners
59
-
60
- 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.
61
-
62
- Visit the [Workflow Runners guide](https://mastra.ai/docs/deployment/workflow-runners) for execution options and the [Inngest deployment guide](https://mastra.ai/guides/deployment/inngest) for setup instructions.
@@ -1,52 +0,0 @@
1
- # Deploy with a Web Framework
2
-
3
- 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.
4
-
5
- > **Warning:** If you're deploying to a cloud provider, remove any usage of [LibSQLStore](https://mastra.ai/reference/storage/libsql) from your Mastra configuration. LibSQLStore requires filesystem access and is not compatible with serverless platforms.
6
-
7
- Integration guides:
8
-
9
- - [With Next.js](https://mastra.ai/guides/getting-started/next-js)
10
- - [With Astro](https://mastra.ai/guides/getting-started/astro)
11
-
12
- ## With Next.js on Vercel
13
-
14
- If you've integrated Mastra with Next.js [by following our guide](https://mastra.ai/guides/getting-started/next-js) and plan to deploy to Vercel, add `serverExternalPackages: ["@mastra/*"]` to your `next.config.ts`:
15
-
16
- ```typescript
17
- import type { NextConfig } from "next";
18
-
19
- const nextConfig: NextConfig = {
20
- serverExternalPackages: ["@mastra/*"],
21
- };
22
-
23
- export default nextConfig;
24
- ```
25
-
26
- ## With Astro on Vercel
27
-
28
- If you've integrated Mastra with Astro [by following our guide](https://mastra.ai/guides/getting-started/astro) and plan to deploy to Vercel, add the Vercel adapter and server output to your `astro.config.mjs`:
29
-
30
- ```javascript
31
- import { defineConfig } from "astro/config";
32
- import vercel from "@astrojs/vercel";
33
-
34
- export default defineConfig({
35
- adapter: vercel(),
36
- output: "server",
37
- });
38
- ```
39
-
40
- ## With Astro on Netlify
41
-
42
- If you've integrated Mastra with Astro [by following our guide](https://mastra.ai/guides/getting-started/astro) and plan to deploy to Netlify, add the Netlify adapter and server output to your `astro.config.mjs`:
43
-
44
- ```javascript
45
- import { defineConfig } from "astro/config";
46
- import netlify from "@astrojs/netlify";
47
-
48
- export default defineConfig({
49
- adapter: netlify(),
50
- output: "server",
51
- });
52
- ```
@@ -1,9 +0,0 @@
1
- # Workflow Runners
2
-
3
- Mastra [workflows](https://mastra.ai/docs/workflows/overview) can be executed using the built-in workflow runner or deployed to specialized workflow execution platforms that handle orchestration, monitoring, and reliability.
4
-
5
- ## Inngest
6
-
7
- Inngest is a developer platform for running background workflows without managing infrastructure. Mastra workflows can be deployed to Inngest, which provides step memoization, automatic retries, real-time monitoring, and suspend/resume capabilities.
8
-
9
- Visit the [Inngest deployment guide](https://mastra.ai/guides/deployment/inngest) for setup instructions and the [Inngest workflow example](https://github.com/mastra-ai/mastra/tree/main/examples/inngest) for a complete implementation.
@@ -1,100 +0,0 @@
1
- # Deployer
2
-
3
- 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.
4
-
5
- ## Usage Example
6
-
7
- If you want to create a custom deployer, you can extend the abstract `Deployer` class and implement the `deploy` method with your specific deployment logic. Here's an example:
8
-
9
- ```typescript
10
- import { Deployer } from "@mastra/deployer";
11
-
12
- class CustomDeployer extends Deployer {
13
- constructor() {
14
- super({ name: "custom-deployer" });
15
- }
16
-
17
- async deploy(outputDirectory: string): Promise<void> {
18
- // Prepare the output directory
19
- await this.prepare(outputDirectory);
20
-
21
- // Bundle the application
22
- await this._bundle("server.ts", "mastra.ts", outputDirectory);
23
-
24
- // Custom deployment logic
25
- }
26
- }
27
- ```
28
-
29
- ## Parameters
30
-
31
- ### Constructor Parameters
32
-
33
- **args:** (`object`): Configuration options for the Deployer.
34
-
35
- **args.name:** (`string`): A unique name for the deployer instance.
36
-
37
- ### deploy Parameters
38
-
39
- **outputDirectory:** (`string`): The directory where the bundled and deployment-ready application will be output.
40
-
41
- ## Methods
42
-
43
- **getEnvFiles:** (`() => Promise<string[]>`): Returns a list of environment files to be used during deployment. By default, it looks for '.env.production' and '.env' files.
44
-
45
- **deploy:** (`(outputDirectory: string) => Promise<void>`): Abstract method that must be implemented by subclasses. Handles the deployment process to the specified output directory.
46
-
47
- ## Inherited Methods from Bundler
48
-
49
- The Deployer class inherits the following key methods from the Bundler class:
50
-
51
- **prepare:** (`(outputDirectory: string) => Promise<void>`): Prepares the output directory by cleaning it and creating necessary subdirectories.
52
-
53
- **writePackageJson:** (`(outputDirectory: string, dependencies: Map<string, string>) => Promise<void>`): Generates a package.json file in the output directory with the specified dependencies.
54
-
55
- **\_bundle:** (`(serverFile: string, mastraEntryFile: string, outputDirectory: string, bundleLocation?: string) => Promise<void>`): Bundles the application using the specified server and Mastra entry files.
56
-
57
- ## Core Concepts
58
-
59
- ### Deployment Lifecycle
60
-
61
- The Deployer abstract class implements a structured deployment lifecycle:
62
-
63
- 1. **Initialization**: The deployer is initialized with a name and creates a Deps instance for dependency management.
64
- 2. **Environment Setup**: The `getEnvFiles` method identifies environment files (.env.production, .env) to be used during deployment.
65
- 3. **Preparation**: The `prepare` method (inherited from Bundler) cleans the output directory and creates necessary subdirectories.
66
- 4. **Bundling**: The `_bundle` method (inherited from Bundler) packages the application code and its dependencies.
67
- 5. **Deployment**: The abstract `deploy` method is implemented by subclasses to handle the actual deployment process.
68
-
69
- ### Environment File Management
70
-
71
- The Deployer class includes built-in support for environment file management through the `getEnvFiles` method. This method:
72
-
73
- - Looks for environment files in a predefined order (.env.production, .env)
74
- - Uses the FileService to find the first existing file
75
- - Returns an array of found environment files
76
- - Returns an empty array if no environment files are found
77
-
78
- ```typescript
79
- getEnvFiles(): Promise<string[]> {
80
- const possibleFiles = ['.env.production', '.env.local', '.env'];
81
-
82
- try {
83
- const fileService = new FileService();
84
- const envFile = fileService.getFirstExistingFile(possibleFiles);
85
-
86
- return Promise.resolve([envFile]);
87
- } catch {}
88
-
89
- return Promise.resolve([]);
90
- }
91
- ```
92
-
93
- ### Bundling and Deployment Relationship
94
-
95
- The Deployer class extends the Bundler class, establishing a clear relationship between bundling and deployment:
96
-
97
- 1. **Bundling as a Prerequisite**: Bundling is a prerequisite step for deployment, where the application code is packaged into a deployable format.
98
- 2. **Shared Infrastructure**: Both bundling and deployment share common infrastructure like dependency management and file system operations.
99
- 3. **Specialized Deployment Logic**: While bundling focuses on code packaging, deployment adds environment-specific logic for deploying the bundled code.
100
- 4. **Extensibility**: The abstract `deploy` method allows for creating specialized deployers for different target environments.