Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Drarig29/brackets-manager.js
A simple library to manage tournament brackets (round-robin, single elimination, double elimination).
https://github.com/Drarig29/brackets-manager.js
bracket elimination esports gaming group hacktoberfest manager matches mocha-tests round-robin seeding sports tournament tournament-bracket typescript
Last synced: 3 months ago
JSON representation
A simple library to manage tournament brackets (round-robin, single elimination, double elimination).
- Host: GitHub
- URL: https://github.com/Drarig29/brackets-manager.js
- Owner: Drarig29
- License: mit
- Created: 2020-06-02T16:22:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-13T23:18:02.000Z (about 1 year ago)
- Last Synced: 2024-07-21T23:23:29.296Z (4 months ago)
- Topics: bracket, elimination, esports, gaming, group, hacktoberfest, manager, matches, mocha-tests, round-robin, seeding, sports, tournament, tournament-bracket, typescript
- Language: TypeScript
- Homepage: https://drarig29.github.io/brackets-docs
- Size: 681 KB
- Stars: 240
- Watchers: 8
- Forks: 37
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-esports - brackets-manager.js - A JavaScript library to manage tournament brackets. (Libraries / Tournaments management)
README
# brackets-manager.js
[![npm](https://img.shields.io/npm/v/brackets-manager.svg)](https://www.npmjs.com/package/brackets-manager)
[![Downloads](https://img.shields.io/npm/dt/brackets-manager.svg)](https://www.npmjs.com/package/brackets-manager)
[![Package Quality](https://packagequality.com/shield/brackets-manager.svg)](https://packagequality.com/#?package=brackets-manager)A simple library to manage tournament brackets (round-robin, single elimination, double elimination).
It contains all the logic needed to manage tournaments.
# Features
- [BYE](https://en.wikipedia.org/wiki/Bye_%28sports%29) supported: only during creation (for seeding and balancing).
- Forfeit supported: only during updates.
- Match supported (locked, waiting, ready, running, completed, archived).
- Multiple stages per tournament.
- So you can first have a round-robin stage (which will give you a seeding), then an elimination stage.# Interface
- This library doesn't come with a GUI to create and update tournaments.
- You can use [brackets-viewer.js](https://github.com/Drarig29/brackets-viewer.js) to display the current state of a stage.
- It is designed to be used with any type of storage (JSON, in-memory, SQL, Redis, and more).
- Some storage implementations are already available (see the [documentation](https://drarig29.github.io/brackets-docs/user-guide/storage/)).# Getting Started
For more information, see the [documentation](https://drarig29.github.io/brackets-docs/getting-started/).
```js
const { JsonDatabase } = require('brackets-json-db');
const { BracketsManager } = require('brackets-manager');const storage = new JsonDatabase();
const manager = new BracketsManager(storage);// Create an elimination stage for tournament `3`.
await manager.create.stage({
tournamentId: 3,
name: 'Elimination stage',
type: 'double_elimination',
seeding: ['Team 1', 'Team 2', 'Team 3', 'Team 4'],
settings: { grandFinal: 'double' },
});await manager.update.match({
id: 0, // First match of winner bracket (round 1)
opponent1: { score: 16, result: 'win' },
opponent2: { score: 12 },
});
```Rendered with the [viewer](https://github.com/Drarig29/brackets-viewer.js):
As you can see, the [manager](https://drarig29.github.io/brackets-docs/reference/manager/classes/BracketsManager.html) is composed of submodules, which themselves have methods:
- [`create`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Create.html) module: [`manager.create.stage()`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Create.html#stage)
- [`get`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Get.html) module: [`manager.get.seeding()`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Get.html#seeding), [`manager.get.finalStandings()`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Get.html#finalStandings), ...
- [`update`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Update.html) module: [`manager.update.match()`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Update.html#match), [`manager.update.confirmSeeding()`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Update.html#confirmSeeding), ...
- [`reset`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Reset.html) module: [`manager.reset.seeding()`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Reset.html#seeding), [`manager.reset.matchGame()`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Reset.html#matchResults), ...
- [`delete`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Delete.html) module: [`manager.delete.stage()`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Delete.html#stage)
- [`find`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Find.html) module: [`manager.find.match()`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Find.html#match), [`manager.find.nextMatches()`](https://drarig29.github.io/brackets-docs/reference/manager/classes/_internal_.Find.html#nextMatches), ...
- [`storage`](https://drarig29.github.io/brackets-docs/reference/manager/interfaces/Storage.html) module: this gives you access to the abstract storage interface. Use it as a last resort.You can navigate the API documentation here: [`BracketsManager` class documentation](https://drarig29.github.io/brackets-docs/reference/manager/classes/BracketsManager.html)
All the helpers defined by the library are available [here](https://drarig29.github.io/brackets-docs/reference/manager/modules/helpers.html):
```js
const { helpers } = require('brackets-manager');
```# Credits
This library has been created to be used by the [Nantarena](https://nantarena.net/).
It has been inspired by:
- [Toornament](https://www.toornament.com/en_US/) (configuration, API and data format)
- [Challonge's bracket generator](https://challonge.com/tournaments/bracket_generator)
- [jQuery Bracket](http://www.aropupu.fi/bracket/) (feature examples)