Skip to content

hemao612/dota2HeroPick

Repository files navigation

Dota 2 Hero Pool Analyzer

A Next.js web application that fetches and analyzes Dota 2 hero pool data for 5 players using the OpenDota API.

Features

  • Fetch hero statistics for up to 5 players simultaneously
  • Display hero pools with detailed statistics (games played, wins, win rate)
  • Filter heroes based on criteria:
    • Minimum 5 games played
    • Played within the last 6 months
  • Modern, responsive UI with Tailwind CSS
  • Real-time data from OpenDota API

Tech Stack

  • Framework: Next.js 14 with App Router
  • Language: TypeScript (strict mode)
  • Styling: Tailwind CSS
  • API: OpenDota API (no key required)
  • HTTP Client: Axios with retry logic
  • Validation: Zod

Getting Started

Prerequisites

  • Node.js 18.x or higher
  • npm or yarn

Installation

  1. Clone the repository:
cd dota2HeroPick
  1. Install dependencies:
npm install
  1. Create environment file:
cp .env.example .env.local

The .env.local file should contain:

OPENDOTA_API_URL=https://api.opendota.com/api

Running the Development Server

npm run dev

Open http://localhost:3000 in your browser.

Building for Production

npm run build
npm start

Usage

  1. Enter 5 SteamID64 values (17 digits starting with 7656119)
  2. Click "Analyze Hero Pools" to fetch data
  3. View each player's hero statistics and win rates

Example Steam IDs

Try these professional player Steam IDs:

  • 76561198047011640 (Miracle-)
  • 76561198131932277 (Arteezy)
  • 76561198091935823 (s4)
  • 76561198033560957 (Dendi)
  • 76561198053867390 (Puppey)

Project Structure

├── app/
│   ├── api/
│   │   └── hero-pools/        # API endpoints
│   ├── components/            # React components
│   ├── page.tsx               # Main page
│   ├── layout.tsx             # Root layout
│   └── globals.css            # Global styles
├── lib/
│   ├── types/                 # TypeScript types
│   ├── services/              # API services
│   ├── utils/                 # Utility functions
│   └── core/                  # Business logic
└── public/                    # Static assets

API Endpoints

POST /api/hero-pools

Fetches hero pools for 5 players.

Request Body:

{
  "steamIds": [
    "76561198047011640",
    "76561198131932277",
    "76561198091935823",
    "76561198033560957",
    "76561198053867390"
  ]
}

Response:

{
  "success": true,
  "data": [
    {
      "success": true,
      "steamId": "76561198047011640",
      "data": {
        "playerId": 86745912,
        "steamId64": "76561198047011640",
        "heroes": [...],
        "totalGames": 8234,
        "lastUpdated": "2025-01-26T..."
      }
    }
  ]
}

Limitations

  • OpenDota API rate limit: 60 requests per minute
  • Private profiles return empty hero data
  • Recent games filter is hardcoded to 6 months
  • Only supports SteamID64 format input

Future Enhancements

  • Phase 2: Hero selection algorithm
    • Analyze 5 hero pools together
    • Recommend best team composition
    • Consider win rates, roles, synergies, and counters
  • Support more Steam ID formats
  • Configurable filters (time window, min games)
  • Hero images/icons
  • Dark mode toggle
  • Export results

License

MIT

Acknowledgments

About

Pick dota2 hero for xdm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages