> Discover all available pages from the documentation index: https://mastra.ai/llms.txt # create-mastra Create a standalone Mastra project. By default, `create-mastra` installs a default starter and configures it for your selected model provider. **npm**: ```bash npx create-mastra@latest ``` **pnpm**: ```bash pnpm dlx create-mastra@latest ``` **Yarn**: ```bash yarn dlx create-mastra@latest ``` **Bun**: ```bash bun x create-mastra@latest ``` ## Creation modes ### Default starter The default starter creates an agent harness with workspace tools, memory, task tracking, web access, recurring schedules, storage, and observability. Select OpenAI, Anthropic, Gemini, or xAI as your model provider. Provide both the project name and provider to create the project without prompts. This example uses Anthropic; you can also pass `openai`, `google`, or `xai`: **npm**: ```bash npx create-mastra@latest my-mastra-project --llm anthropic ``` **pnpm**: ```bash pnpm dlx create-mastra@latest my-mastra-project --llm anthropic ``` **Yarn**: ```bash yarn dlx create-mastra@latest my-mastra-project --llm anthropic ``` **Bun**: ```bash bun x create-mastra@latest my-mastra-project --llm anthropic ``` Omit `--llm` to select the provider and optionally enter its API key interactively. The interactive setup also offers to connect your project to the Mastra platform. If enabled, the command opens the browser authentication flow and creates a platform project with the same name as the local project. It then writes `MASTRA_PLATFORM_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` to `.env`. ### Template Use a template slug or a public GitHub URL: **npm**: ```bash npx create-mastra@latest my-mastra-project --template agent-harness ``` **pnpm**: ```bash pnpm dlx create-mastra@latest my-mastra-project --template agent-harness ``` **Yarn**: ```bash yarn dlx create-mastra@latest my-mastra-project --template agent-harness ``` **Bun**: ```bash bun x create-mastra@latest my-mastra-project --template agent-harness ``` **npm**: ```bash npx create-mastra@latest my-mastra-project --template https://github.com/mastra-ai/template-agent-harness ``` **pnpm**: ```bash pnpm dlx create-mastra@latest my-mastra-project --template https://github.com/mastra-ai/template-agent-harness ``` **Yarn**: ```bash yarn dlx create-mastra@latest my-mastra-project --template https://github.com/mastra-ai/template-agent-harness ``` **Bun**: ```bash bun x create-mastra@latest my-mastra-project --template https://github.com/mastra-ai/template-agent-harness ``` Leave the template value blank to select a template interactively: **npm**: ```bash npx create-mastra@latest my-mastra-project --template ``` **pnpm**: ```bash pnpm dlx create-mastra@latest my-mastra-project --template ``` **Yarn**: ```bash yarn dlx create-mastra@latest my-mastra-project --template ``` **Bun**: ```bash bun x create-mastra@latest my-mastra-project --template ``` Template authors own their dependencies, models, environment variables, and source code. `create-mastra` doesn't apply `--llm` or `--llm-api-key`. ### Empty scaffold Use `--empty` to create a provider-free project without agents, examples, model SDKs, or environment files: **npm**: ```bash npx create-mastra@latest my-empty-project --empty ``` **pnpm**: ```bash pnpm dlx create-mastra@latest my-empty-project --empty ``` **Yarn**: ```bash yarn dlx create-mastra@latest my-empty-project --empty ``` **Bun**: ```bash bun x create-mastra@latest my-empty-project --empty ``` ## Automatic setup After installing dependencies, the command: 1. Detects supported coding assistants on `PATH` and installs Mastra skills. If none are detected, it installs universal skills. 2. Creates an initial Git commit when the current directory and generated project aren't already inside Git repositories. Use `--no-skills` or `--no-git` to skip these steps. Skills and Git setup failures produce warnings but don't remove a successfully created project. ## Conflicts and validation - `--empty` and `--template` can't be used together. - `--llm` and `--llm-api-key` are only valid for the default starter project. - The project name must be a safe, lowercase, single directory name and the target must not already exist. Invalid input is rejected before templates are fetched or files are created. ## Arguments and flags **\[project-name]** (`string`): Project directory and package name. When omitted, the command prompts for it. **--empty** (`boolean`): Create a minimal, provider-free Mastra project. **-l, --llm \** (`string`): Managed agent-harness provider: openai, anthropic, google, or xai. **-k, --llm-api-key \** (`string`): Write the selected provider API key to the generated .env file when automatic provider setup succeeds. **--no-skills** (`boolean`): Skip automatic Mastra skills installation. **--no-git** (`boolean`): Skip automatic Git initialization and the initial commit. **--no-install** (`boolean`): Skip dependency installation. **-t, --template \[template]** (`string`): Use a template slug or public GitHub URL. Omit the value to select interactively. **--timeout \** (`number`): Positive integer timeout for dependency installation. Defaults to 60000. **--version** (`boolean`): Print the create-mastra version. **--help** (`boolean`): Display command help. ## Telemetry Mastra collects anonymous CLI usage information, such as the operating system, Mastra version, and Node.js version. You can review the [analytics source](https://github.com/mastra-ai/mastra/blob/main/packages/cli/src/analytics/index.ts). Set `MASTRA_TELEMETRY_DISABLED=1` to opt out: ```bash MASTRA_TELEMETRY_DISABLED=1 npx create-mastra@latest my-project --empty ```