Skip to content

Latest commit

 

History

History
75 lines (57 loc) · 1.49 KB

README.md

File metadata and controls

75 lines (57 loc) · 1.49 KB

Dota 2 Team Matches API

A simple API that fetches, caches and formats the current upcoming match schedule from Liquipedia.

It caches matches for 3 hours after initially fetching them.

Big thanks to Liquipedia for providing the data! It is an amazing website ran and maintained by amazing people.

API

Base URL: https://dota.haglund.dev

type Team = {
  name: string | null
  url: string | null
}

type Match = {
  hash: string
  teams: [Team | null, Team | null]
  matchType: string | null
  startsAt: string | null
  leagueName: string | null
  leagueUrl: string | null
  streamUrl: string | null
}

GET /v1/matches

type ResponseBody = Match[]

Development

Setup

  1. Install dependencies
    pnpm install
  2. Execute DB migrations
    pnpm dev:migrate
  3. Start development server
    pnpm dev
  4. Go wild!

Architecture

flowchart TD
  clients([API Clients])
  browser([Browser])
  worker(Worker):::cf
  discord([Discord]):::discord
  d1[("D1 (SQLite)")]:::cf
  cache("Cache"):::cf

  classDef cf stroke:#FFC500,stroke-width:2px
  classDef discord stroke:#5865F2

  subgraph Cloudflare
    worker
    d1
    cache
  end

  d1 <-- all data* --> worker
  cache <-- /matches requests --> worker
  worker <-- /matches --> clients
  worker <-- validate oauth, commands --> discord
  %% worker <--> browser
  discord <-- init oauth --> browser
Loading

*Matches,