tessl install tessl/npm-mastra@1.0.5Command-line tool for creating, developing, and deploying AI-powered applications with the Mastra framework
Get up and running with Mastra CLI in minutes.
npm install -g mastra
mastra --versionnpx mastra create my-appmastra create my-appYou'll be prompted for:
mastra create my-app --defaultThis creates a project with:
src/mastra create my-app \
--components agents,workflows \
--llm openai \
--llm-api-key sk-... \
--example \
--dir src/After creation, you'll have:
my-app/
├── package.json # Mastra dependency included
├── .env # API keys (git-ignored)
├── .gitignore # Standard Node.js ignores
├── node_modules/ # Dependencies
└── src/
└── mastra/
├── index.ts # Main Mastra configuration
├── agents/ # AI agents
│ └── example-agent.ts
├── workflows/ # Workflows
│ └── example-workflow.ts
└── tools/ # Tools
└── example-tool.tscd my-app
npm install # If not already installed
mastra devThe development server starts on http://localhost:4111 by default.
--debug flag for detailed logs--https flag for local HTTPSPORT=8080 mastra dev
HOST=0.0.0.0 mastra dev # Allow external connectionsIn a separate terminal:
cd my-app
mastra studioStudio opens on http://localhost:3000 and provides:
mastra lintThis checks:
src/mastra/agents/example-agent.tsmastra scorers list # See available scorers
mastra scorers add answer-relevancyIf you have an existing Node.js project:
cd existing-project
mastra initFollow the same prompts as create.
Create or update .env:
# LLM API Keys
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GROQ_API_KEY=gsk_...
# Optional: Database
DATABASE_URL=postgresql://user:pass@localhost:5432/mastra
# Optional: Disable telemetry
MASTRA_TELEMETRY_DISABLED=1mastra buildBuild output in .mastra/output/:
index.js: Bundled server (~1-2MB)package.json: Runtime dependenciesmastra build --studioAdds Studio UI to build (~6-12MB total).
mastra startOr with custom environment:
mastra start --env .env.production# Solution 1: Use different port
PORT=8080 mastra dev
# Solution 2: Kill process
lsof -ti:4111 | xargs kill -9# Check version
node --version
# Upgrade with nvm
nvm install 22
nvm use 22# Add to .env file
echo "OPENAI_API_KEY=sk-..." >> .env# Increase timeout (milliseconds)
mastra create my-app --timeout 120000# Create
mastra create my-app
mastra create my-app --default
mastra init
# Develop
mastra dev
mastra dev --https
mastra dev --debug
mastra studio
# Validate
mastra lint
# Build
mastra build
mastra build --studio
# Run
mastra start
# Scorers
mastra scorers list
mastra scorers add <name>
# Help
mastra --help
mastra <command> --helpMastra collects optional usage analytics via PostHog.
Disable:
export MASTRA_TELEMETRY_DISABLED=1Or add to .env:
MASTRA_TELEMETRY_DISABLED=1mastra --help for command overviewmastra <command> --help for command-specific help