@mastra/core
Version:
116 lines (78 loc) • 2.92 kB
Markdown
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
# Overview
This reference explains how to use existing Mastra templates and create your own. It also covers contributing templates 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 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 templates
### Installation
Install a template using the `create-mastra` command:
**npm**:
```sh
npx create-mastra@latest my-project --template template-name
```
**pnpm**:
```sh
pnpm dlx create-mastra@latest my-project --template template-name
```
**Yarn**:
```sh
yarn dlx create-mastra@latest my-project --template template-name
```
**Bun**:
```sh
bun x create-mastra@latest my-project --template template-name
```
This creates a complete project and installs its dependencies. The template author controls the models, provider dependencies, environment variables, and source code.
### Setup Process
After installation:
1. **Navigate to project directory**:
```bash
cd your-project-name
```
2. **Configure environment variables**:
```bash
cp .env.example .env
```
Edit `.env` with required API keys as documented in the template's README.
3. **Start development server**:
**npm**:
```sh
npm run dev
```
**pnpm**:
```sh
pnpm run dev
```
**Yarn**:
```sh
yarn dev
```
**Bun**:
```sh
bun run dev
```
### Template structure
All templates follow this standardized structure:
```text
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
```