https://github.com/drarig29/brackets-toornament-layer
A layer to convert Toornament data to data following the brackets-model
https://github.com/drarig29/brackets-toornament-layer
bracket elimination esports gaming group matches pnpm round-robin seeding sports toornament tournament tournament-bracket typescript
Last synced: about 2 months ago
JSON representation
A layer to convert Toornament data to data following the brackets-model
- Host: GitHub
- URL: https://github.com/drarig29/brackets-toornament-layer
- Owner: Drarig29
- Created: 2021-03-27T22:34:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-23T19:51:29.000Z (over 1 year ago)
- Last Synced: 2025-08-09T02:44:26.408Z (about 2 months ago)
- Topics: bracket, elimination, esports, gaming, group, matches, pnpm, round-robin, seeding, sports, toornament, tournament, tournament-bracket, typescript
- Language: TypeScript
- Homepage: https://replit.com/@Drarig29/Toornament-and-brackets-viewerjs
- Size: 134 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# brackets-toornament-layer
A layer to convert Toornament data to [brackets-viewer.js](https://github.com/Drarig29/brackets-viewer.js) data.
You can use this to view Toornament stages with your own personalized viewer without embedding Toornament's viewer.
[](https://www.npmjs.com/package/brackets-toornament-layer)
# Input
You need to give data for **one tournament** at a time.
Toornament API routes needed:
- `/stages` to have the list of stages
- `/bracket-nodes` to have the `source_node_id` property (used to have the `position` property)
- `/matches/{match_id}/games` for each match (if you know you have child matches, i.e. Bo3, Bo5, ...)The input is constructed as this:
```jsonc
{
"tournament_id": "4468708049713692672", // Input tournament ID
"stages": [
// Output of `/stages?tournament_ids=4468708049713692672`
],
"matches": [
// Output of `/matches?stage_ids=618965765764577354,618931468547654563` for round-robin stages
// and `/bracket-nodes?tournament_ids=4468708049713692672` for single and double elimination brackets
],
"match_games": [
// Flattened list of all `/matches/{match_id}/games` list results
]
}
```**Note:** If `match_games` is omitted, the `child_count` will be set to `0`.
# How to test
First, do `npm start`. This will generate the database file `db.json`.
To quickly test the results, you can use `json-server`.
```bash
npx json-server ./output/db.json
```Then, open the `./demo/index.html` file from the [brackets-viewer.js](https://github.com/Drarig29/brackets-viewer.js) project.
And tada! You are viewing Toornament data with your own viewer! 🎉
# Credits
This library has been created to be used by the [Nantarena](https://nantarena.net/).