Skip to content

delightech/my-mastra-app

Repository files navigation

My Mastra App

A weather application built with Mastra framework that provides weather information and activity suggestions based on current conditions.

Features

  • Weather information retrieval using Open-Meteo API
  • AI-powered activity suggestions based on weather conditions
  • RESTful API endpoints for agents and workflows
  • Interactive playground UI

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn
  • Google Generative AI API key (for Gemini integration)

Setup

  1. Clone the repository:

    git clone [email protected]:delightech/my-mastra-app.git
    cd my-mastra-app
  2. Install dependencies:

    npm install
  3. Configure environment variables:

    cp .env.example .env

    Then edit .env and add your Google AI API key:

    GOOGLE_GENERATIVE_AI_API_KEY=your_actual_api_key_here
    

    You can get your API key from: https://makersuite.google.com/app/apikey

Running the Application

Start the development server:

npm run dev

The server will start at http://localhost:4111

API Endpoints

Agent Endpoints

  • GET /api/agents - List all available agents
  • GET /api/agents/:agentId - Get details of a specific agent
  • POST /api/agents/:agentId/text - Chat with an agent

Workflow Endpoints

  • GET /api/workflows - List all available workflows
  • GET /api/workflows/:workflowId - Get details of a specific workflow
  • POST /api/workflows/:workflowId/execute - Execute a workflow

Testing

Run the included test script:

node test-mastra-api.mjs

This will test all API endpoints and display the results.

Project Structure

├── src/
│   └── mastra/
│       ├── index.ts          # Main Mastra configuration
│       ├── agents/           # AI agents
│       │   └── weather-agent.ts
│       ├── tools/            # Custom tools
│       │   └── weather-tool.ts
│       └── workflows/        # Workflow definitions
│           └── weather-workflow.ts
├── .env.example             # Example environment variables
├── package.json
├── tsconfig.json
└── test-mastra-api.mjs      # API test script

Security Notes

  • Never commit your .env file to version control
  • The .env file is already included in .gitignore
  • Always use environment variables for sensitive data like API keys

License

This project is open source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published