Skip to content
/ mastra-starter Public template

A comprehensive starter template for building AI-powered applications with the Mastra framework. This kit provides everything you need to quickly develop and deploy AI agents and workflows.

License

Notifications You must be signed in to change notification settings

BunsDev/mastra-starter

Repository files navigation

Mastra Starter Template

Mastra Banner

Build AI-powered applications with the Mastra framework. Everything you need to quickly develop and deploy AI agents and workflows.

Mastra AI is a powerful framework for building AI applications with agents, tools, and workflows. This starter kit demonstrates how to:

  • Create AI agents using LLMs
  • Build custom tools for your agents
  • Define multi-step workflows
  • Set up a development environment

Starter Kit Overview

Project Structure

Project Structure

mastra-starter/
├── src/
│   └── mastra/
│       ├── agents/           # AI agent definitions
│       ├── tools/            # Custom tools for agents
│       ├── workflows/        # Multi-step workflows
│       └── index.ts          # Main Mastra configuration
├── package.json              # Project dependencies
├── tsconfig.json             # TypeScript configuration
└── .env.example              # Environment variables template

Features

  • Pre-configured Agents: Agents powered by OpenAI models
  • Custom Tools: Ready-to-use tools for common tasks like weather data retrieval
  • Workflow System: Define complex multi-step processes with error handling
  • TypeScript Support: Full type safety with TypeScript
  • Development Server: Built-in development server with hot reloading
  • Dashboard: Interactive interface for testing and debugging.

Benefits

Quick Start: Get up and running with minimal setup.

Best Practices: Learn from pre-built examples following best practices.

Extensible: Easily add new agents, tools, and workflows.

Modern Tech Stack: Built with TypeScript, OpenAI, and modern JavaScript.

Production Ready: Structured for both development and production deployment.

Requirements

  • Node.js 22+ (LTS recommended)
  • npm or yarn
  • OpenAI API key (for the example agent)

Getting Started

  1. Clone the repository:

    git clone https://github.com/BunsDev/mastra-starter.git
    cd mastra-starter
  2. Set up environment variables:

    cp .env.example .env && OPENAI_API_KEY=your_api_key_here
  3. Install dependencies and start development server:

    yarn && yarn dev

Development Mode

Running yarn dev or npm run dev starts the Mastra development server, which:

  • Watches for changes in your source files
  • Automatically restarts the server when changes are detected
  • Provides a dashboard interface to interact with your agents and workflows
  • Logs detailed information about agent interactions and workflow executions

Mastra Dashboard

Running the development server, opens a local development dashboard at http://localhost:4111. This dashboard provides:

  • A chat interface to interact with your agents
  • Workflow execution visualization
  • Debug information and logs
  • Agent and tool performance metrics
  • Direct access to workflow execution details

Mastra API

/api provides endpoints for:

  • Starting workflow executions
  • Sending messages to agents
  • Checking workflow status
  • Retrieving execution results

Example API Usage

// Start a weather workflow
fetch('http://localhost:4111/api/workflows/weather-workflow/execute', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    city: 'New York',
  }),
})
  .then(response => response.json())
  .then(data => console.log(data));

Mastra Components

Agents, Tools, and Workflows

Agents

Tools

Workflows

Path to Building AI Applications

  • Check out the Mastra Documentation for comprehensive guides
  • Explore the Weather agent and workflow as examples.
  • Experiment with different OpenAI models.
  • Create your own custom tools and agents.

DeDevs Online Community
What?
Who?
  • Innovators collaborate on cutting-edge projects
  • Experts share valuable insights and resources
  • Newcomers grow through mentorship and hands-on experience
  • Communities form around shared technological interests
Why?
Join DeDevs Today ➚

About

A comprehensive starter template for building AI-powered applications with the Mastra framework. This kit provides everything you need to quickly develop and deploy AI agents and workflows.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published