Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL

mastra-ai/mastra

AI Engineering

A TypeScript framework for building AI agents and workflows, with model routing, memory, RAG, evals, and observability.

29,595
3,114
TypeScript
NOASSERTION
2 years old

Overview

Mastra is a TypeScript framework for building AI-powered applications and agents, positioned for teams that want to move from a prototype to a production service without assembling every piece themselves. It bundles several commonly needed capabilities behind one interface: a model router that connects to 40+ providers, autonomous agents that call tools, a graph-based workflow engine with .then(), .branch() and .parallel() control flow, and human-in-the-loop suspend/resume backed by storage. Context features cover conversation history, retrieval from APIs, databases, or files, and agent memory; MCP servers, evals, and observability cover integration and production monitoring.

It is aimed at TypeScript developers working in React, Next.js, or Node.js, and can also be deployed as a standalone server. The project also publishes learning material such as templates and a course.

Get started

The recommended path is the project scaffold:

npm create mastra@latest

Follow the installation guide for the CLI or manual install steps. The scaffold can also take a project name and LLM provider non-interactively, e.g. npm create mastra@latest <project-name> -- --llm <provider>, where the provider is one of openai, anthropic, google, or xai. After creation, enter the project directory and run the dev server; Mastra Studio is then available at http://localhost:4111 for building, testing, and managing agents, workflows, and tools. Backend integration with React, Next.js, and Node.js is documented separately if you prefer to add Mastra to an existing app.

Usage constraints

The framework is TypeScript-based and integrates with React, Next.js, Node.js, or a standalone server, so the runtime and toolchain must support that stack. Human-in-the-loop workflows and memory depend on configured storage, and model routing depends on credentials for the chosen provider. Licensing is split: the core framework and most of the codebase are Apache-2.0, while code under directories named ee/ is source-available under the Mastra Enterprise License and requires a valid enterprise license for production use; development and testing use is allowed. Full terms are in the license mapping and the enterprise license file. Pull requests are limited to collaborators; outside contributors are directed to open high-quality issues instead.

Operational note

A June 2026 report on Hacker News stated that multiple mastra npm packages had been compromised, according to StepSecurity threat intelligence reported in the thread. Readers installing or updating packages should verify the versions and integrity of what they install rather than treating this as a comment on the current state; no remediation details are part of the provided material.

HotRepo's take

The repository's recorded activity is a single daily snapshot on 2026-11-17 in the TypeScript list: 29,561 stars and 3,107 forks, with 25 stars gained and a best position of 12 on that list. That is one data point, so it supports only the fact of a ranking that day, not a trend. The community record is more informative about reception: the February 2025 Show HN post drew 442 points and 154 comments, and the January 2026 1.0 post drew 213 points and 70 comments. In the earlier discussion, a reviewer criticized the workflow builder's chained syntax as an awkward representation of the graph, and a maintainer responded that conditional logic lives on the steps rather than the workflow structure. That exchange is the useful context for anyone evaluating the API: workflows are explicit and graph-oriented, while agent autonomy is a separate layer. The June 2026 compromise report is the other operational record worth knowing before adopting the npm packages.

Written by AI from the project's README, updated . The project's own docs are the source of truth.

Hacker News

Show HN: Mastra – Open-source JS agent framework, by the developers of Gatsby
▲ 442 · 154 comments · February 19, 2025
Show HN: Mastra 1.0, open-source JavaScript agent framework from the Gatsby devs
▲ 213 · 70 comments · January 20, 2026
Show HN: Principles of Building AI Agents book [pdf]
▲ 5 · 0 comments · August 6, 2025

You might also like

  1. vercel/aiA TypeScript library for calling many LLM providers through one API and wiring models into UI frameworks and agents.TypeScript27,500
  2. CopilotKit/CopilotKitSDK for wiring existing agents into web, mobile and chat UIs with generative UI and shared state.TypeScript38,353
  3. davemessew/AgentFluxSelf-hosted visual builder for LLM workflows and autonomous agents, connecting local files and models.JavaScript111
  4. osolmaz/switchBuild harnesses that let classifier decision models pick actions step by step until a task is answered.TypeScript236
  5. docker/docker-agentDefine multi-agent setups in YAML, wire in MCP tools and any model provider, then run or share them via Docker.Go4,609