Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/beeequeue/dota-matches-api

🟥 An API that returns upcoming Dota 2 matches from Liquipedia
https://github.com/beeequeue/dota-matches-api

api cloudflare cloudflare-workers dota2 dota2-api match matches schedule series

Last synced: 13 days ago
JSON representation

🟥 An API that returns upcoming Dota 2 matches from Liquipedia

Awesome Lists containing this project

README

        

# Dota 2 Team Matches API

A simple API that fetches, caches and formats the
current [upcoming match schedule from Liquipedia](https://liquipedia.net/dota2/Liquipedia:Upcoming_and_ongoing_matches).

It caches matches for 3 hours after initially fetching them.

Big thanks to [Liquipedia](https://liquipedia.net) for providing the data! It is an amazing website ran and maintained
by amazing people.

## API

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

```ts
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`

```ts
type ResponseBody = Match[]
```

## Development

### Setup

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

### Architecture

```mermaid
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,