create-mastra
The create-mastra command creates a new standalone Mastra project. Use this command to scaffold a complete Mastra setup in a dedicated directory. You can run it with additional flags to customize the setup process.
Usage
npx create-mastra@latestcreate-mastra automatically runs in interactive mode, but you can also specify your project name and template with command line arguments.
npx create-mastra@latest my-mastra-project -- --template coding-agentCheck out the full list of templates and use the slug as input to the --template CLI flag.
You can also use any GitHub repo as a template (it has to be a valid Mastra project):
npx create-mastra@latest my-mastra-project -- --template mastra-ai/template-coding-agentCLI flags
Instead of an interactive prompt you can also define these CLI flags.
--version?:
--project-name?:
--default?:
--components?:
--llm?:
--llm-api-key?:
--example?:
--no-example?:
--template?:
--timeout?:
--dir?:
--mcp?:
--help?:
Telemetry
By default, Mastra collects anonymous information about your project like your OS, Mastra version or Node.js version. You can read the source code to check what’s collected.
You can opt out of the CLI analytics by setting an environment variable:
MASTRA_TELEMETRY_DISABLED=1You can also set this while using other mastra commands:
MASTRA_TELEMETRY_DISABLED=1 npx create-mastra@latest