Skip to main content

Deploy to Mastra platform

Running mastra deploy deploys three things to the Mastra platform: Your Mastra server, the Factory UI, and the Studio UI. The CLI builds and validates the project, then uploads the build. Once the deploy is serving traffic it prints the public URL.

note

A Factory project uses the Mastra platform for auth, database, and sandboxes from the start, but the Mastra server, Factory UI, and Studio all run locally until you deploy them with mastra deploy.

Before you begin

You'll need a Factory project created with the quickstart and a Mastra platform account. If you're not authenticated, the CLI prompts you to log in on first use.

Project setup provisions the platform resources the Factory needs, including a hosted database. Its connection variables are injected into deploys automatically. Environment variables stored on the platform, such as integration credentials, are applied at deploy time without a local .env file.

Deploy

From your project directory, run:

mastra deploy

The command builds the Factory UI and the server bundle, uploads the build, and streams build logs until the deploy is live. Expect the full build and deploy to take between 30 seconds and a few minutes.

Verify the deployment by opening the URL printed by the CLI. The deployed Factory serves the same UI you use during local development.

Choose a region

Deploys are hosted in the US by default. To host your server in the EU, pass the --region flag on your first deploy:

mastra deploy --region eu
warning

The region is fixed when the environment is created on your first deploy. Passing --region on later deploys has no effect.

Access your project

Open your project page on the Mastra platform. From there you can access:

  • Factory: The deployed Factory UI where your team moves work across the board
  • Server: The deployed Mastra server that exposes your Factory's API
  • Studio: The hosted Studio UI for testing agents, running workflows, and inspecting traces

Each surface has its own URL based on your platform project slug:

SurfaceURL
Factory<slug>.factory.mastra.cloud
Server<slug>.server.mastra.cloud
Studio<slug>.studio.mastra.cloud