DocsProject Structure

Project Structure and Organization

This page provides a guide for organizing folders and files in Mastra. Mastra is a modular framework, and you can use any of the modules separately or together.

You could write everything in a single file (as we showed in the quick start), or separate each agent, tool, and workflow into their own files. We don’t enforce a specific folder structure, but we do recommend some best practices, and the CLI will scaffold a project with a sensible structure.

Using the CLI

When you run mastra init, it will create the files and folders listed below:

Top-level Folders

FolderDescription
mastraCore application folder
mastra/agentsAgent configurations and definitions
mastra/blueprintsWorkflow blueprint definitions
mastra/toolsCustom tool definitions
mastra/vector-configsVector database configurations
mastra/integrationsIntegration configurations

Top-level Files

FileDescription
mastra/index.tsMain configuration file for Mastra
.env.developmentDevelopment environment variables