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.
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
}
type ResponseBody = Match[]
- Install dependencies
pnpm install
- Execute DB migrations
pnpm dev:migrate
- Start development server
pnpm dev
- Go wild!
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
*Matches,