For TypeScript teams building with Mastra

Deploy Mastra agents and workflows to your cloud in one command

Use Docker Compose and Defang to deploy Mastra-powered assistants and RAG pipelines alongside your existing TypeScript stack on AWS or GCP.

Docker Compose-native
Built for Mastra stacks
BYOC on AWS or GCP
CLI

Deploy the stack from your repo in one command.

defang compose up --provider=aws
Defang launches you to any cloud
Illustration of a Next.js UI and Mastra agent backend deployed to the cloud via Defang.
TLS

HTTPS, secrets, env wiring

Included by default when you deploy

Stack fit

A deployment story that matches TypeScript developer expectations

Mastra gives you a modern TypeScript-native way to build agents and workflows. Defang gives you an equally modern way to run them in production without leaving the comfort of Docker and familiar CLIs.

TypeScript + Compose friendlyKeep prod close to your code
01

Keep your stack cohesive

Run your Next.js frontend, Mastra workflows, and supporting databases as a single application defined in Compose. You avoid one-off infrastructure for each new AI feature and keep deployments predictable.

02

Use Bedrock and Vertex AI with TypeScript

Running Mastra on Defang inside your own AWS or GCP account lets your TypeScript agents call managed inference services such as Amazon Bedrock or Vertex AI through your existing cloud configuration, with no extra gateways or one-off deployment paths.

03

Stay close to your users and data

With BYOC, Mastra services live in the same cloud accounts that already host your product. That makes integrating with existing databases and APIs straightforward and keeps compliance audits simple.

Path to production

How it works

Defang extends the workflows you already know from building modern web apps: develop locally, containerise, then deploy with a CLI.

1

Containerise your Mastra services

Add Dockerfiles for your Next.js app and any dedicated Mastra backend or ingestion workers. Define them, plus databases and vector stores, in docker-compose.yml.

2

Deploy with Defang

From your repo, run:

defang compose up --provider=aws

Defang builds the images, provisions compute and networking, and exposes your web and API entrypoints over HTTPS.

3

Operate with IDE-friendly tooling

Combine Mastra's own MCP servers with Defang's MCP integration to manage deployments and infrastructure from your AI‑powered IDE, all while keeping the underlying configuration in Compose.

FAQ