Templates
Templates are pre-built Mastra projects that demonstrate specific use cases and patterns. Browse available templates in the templates directory.
Using Templates
Install a template using the create-mastra command:
- npm
- yarn
- pnpm
- bun
npx create-mastra@latest --template template-name
yarn dlx create-mastra@latest --template template-name
pnpm create mastra@latest --template template-name
bun create mastra@latest --template template-name
For example, to create a text-to-SQL application:
npx create-mastra@latest --template text-to-sql
Setting Up a Template
After installation:
-
Navigate to your project:
cd your-project-name -
Configure environment variables:
cp .env.example .envEdit
.envwith your API keys as specified in the template's README. -
Start development:
npm run dev
info
Each template includes a comprehensive README with specific setup instructions and usage examples.
For detailed information on creating templates, see the Templates Reference.