Railway

Deploy Mastra Server With Studio

Mastra server with Studio UI - build, test, and manage AI agents

Deploy Mastra Server With Studio

Just deployed

/data

Deploy and Host Mastra Server With Studio on Railway

Mastra is the open-source TypeScript framework for building AI agents and workflows. This template deploys a complete Mastra server with Mastra Studio — the interactive UI for building, testing, and managing your agents — served from the same service. It ships with a starter agent (with conversation memory) you can chat with immediately.

About Hosting Mastra Server With Studio

Hosting Mastra in production involves more than mastra dev: the server must be built with the --studio flag (Studio is not bundled by default), serve the Studio SPA via MASTRA_STUDIO_PATH, auto-detect its public URL so the UI doesn't call localhost, bind 0.0.0.0 inside the container, and persist agent memory across deploys. This template handles all of that: a multi-stage Docker build runs mastra build --studio, the runtime serves API + Studio on one port, LibSQL storage lives on a Railway volume, and access is protected out of the box with a generated key (Mastra Simple Auth) so your agents aren't publicly exposed. Bring an LLM provider API key, deploy, and log in.

Common Use Cases

  • Build, test, and iterate on AI agents in a hosted Studio UI shared with your team
  • Run a production Mastra API (agents, workflows, tools) and manage it visually from the same deployment
  • Prototype agent products without wiring up your own frontend
  • A persistent playground for agent memory, scorers, and datasets that survives redeploys

Dependencies for Mastra Server With Studio Hosting

  • An LLM provider API key (OpenAI by default; any model router provider works via the MODEL variable)
  • A Railway volume (included) for LibSQL storage

Deployment Dependencies

Implementation Details

The service logs you in with the generated STUDIO_AUTH_KEY (check the service variables): open the deployed URL, paste the key on the login screen. All API routes also accept it as a Bearer token:

curl -H "Authorization: Bearer $STUDIO_AUTH_KEY" https://your-service.up.railway.app/api/agents

Customize the starter agent in src/mastra/agents/assistant.ts, change the model with the MODEL variable (provider/model format), and add your own agents, tools, and workflows — every push redeploys.

Why Deploy Mastra Server With Studio on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Mastra Server With Studio on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
[Jun'26] Self-improving AI agent with memory, skills, and web dashboard 🤖

codestorm
View Template
EchoDeck
Generate a mp4 from powerpoint with TTS

Fixed Scope