Overview
This reference provides comprehensive information about Mastra templates, including how to use existing templates, create your own, and contribute to the community ecosystem.
Mastra templates are pre-built project structures that demonstrate specific use cases and patterns. They provide:
- Working examples: Complete, functional Mastra applications
- Best practices: Proper project structure and coding conventions
- Educational resources: Learn Mastra patterns through real implementations
- Quickstarts: Bootstrap projects faster than building from scratch
Available templatesDirect link to Available templates
The following templates demonstrate Gateway-first Mastra applications:
template-docs-expert: Answers documentation questions with Gateway web search, citations, memory, and structured responses.template-browser-agent: Uses AgentBrowser to browse, inspect, and interact with web pages.template-meeting-notes: Turns Zoom transcripts or uploaded transcripts into structured notes with decisions and action items.template-company-knowledge: Indexes Linear and Notion content into pgvector and answers internal knowledge questions.template-claw-assistant: Operates a workspace with filesystem, sandbox, browser, and web-search tools.
Using templatesDirect link to Using templates
InstallationDirect link to Installation
Install a template using the create-mastra command:
- npm
- pnpm
- Yarn
- Bun
npx create-mastra@latest --template template-name
pnpm dlx create-mastra@latest --template template-name
yarn dlx create-mastra@latest --template template-name
bun x create-mastra@latest --template template-name
This creates a complete project with all necessary code and configuration.
Setup ProcessDirect link to Setup Process
After installation:
-
Navigate to project directory:
cd your-project-name -
Configure environment variables:
cp .env.example .envEdit
.envwith required API keys as documented in the template's README. -
Install dependencies (if not done automatically):
- npm
- pnpm
- Yarn
- Bun
npm installpnpm installyarn installbun install -
Start development server:
- npm
- pnpm
- Yarn
- Bun
npm run devpnpm run devyarn devbun run dev
Template structureDirect link to Template structure
All templates follow this standardized structure:
your-template/
├── src/
│ └── mastra/
│ ├── agents/ # Agent definitions
│ ├── tools/ # Tool definitions
│ ├── workflows/ # Workflow definitions
│ └── index.ts # Main Mastra config
├── .env.example # Required environment variables
├── package.json
├── tsconfig.json
└── README.md