-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1275 from mastra-ai/update-installation-docs
Mastra init local dev docs
- Loading branch information
Showing
3 changed files
with
67 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Tabs } from "nextra/components"; | ||
|
||
# Mastra Init | ||
|
||
The `mastra init` command helps you add Mastra to an existing project. This command provides an interactive setup process to configure Mastra in your project. | ||
|
||
## Using the CLI | ||
|
||
### Install the CLI | ||
|
||
First, install the mastra CLI. | ||
|
||
<Tabs items={["npm", "yarn", "pnpm"]}> | ||
<Tabs.Tab> | ||
|
||
```bash copy | ||
npm i -g mastra | ||
``` | ||
|
||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```bash copy | ||
yarn i -g mastra | ||
``` | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```bash copy | ||
pnpm i -g mastra | ||
``` | ||
</Tabs.Tab> | ||
</Tabs> | ||
|
||
### Initialize Mastra | ||
|
||
To initialize mastra in your project by following the interactive setup, run: | ||
|
||
```bash copy | ||
mastra init | ||
``` | ||
|
||
### Set Up your API Key | ||
|
||
Add the API key for your configured LLM provider in your `.env` file. | ||
|
||
```env | ||
OPENAI_API_KEY=<your-openai-key> | ||
``` | ||
|
||
## Non-Interactive Mode | ||
|
||
If you prefer to run the command with flags (non-interactive mode) and include the example code, you can use: | ||
|
||
```bash copy | ||
mastra init --dir src/mastra --components agents,tools --llm openai --example | ||
``` | ||
|
||
This allows you to specify your preferences upfront without being prompted. | ||
|
||
- [Mastra Init reference](../reference/cli/init.mdx) |