• Stars
    star
    134
  • Rank 270,967 (Top 6 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple library to manage tournament brackets (round-robin, single elimination, double elimination).

brackets-manager.js

npm Downloads Package Quality

A simple library to manage tournament brackets (round-robin, single elimination, double elimination).

It contains all the logic needed to manage tournaments.

Features

  • BYE 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 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).

Getting Started

For more information, see the documentation.

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:

image

As you can see, the manager is composed of submodules, which themselves have methods:

You can navigate the API documentation here: BracketsManager class documentation

All the helpers defined by the library are available here:

const { helpers } = require('brackets-manager');

Credits

This library has been created to be used by the Nantarena.

It has been inspired by:

More Repositories

1

brackets-viewer.js

A simple library to display tournament brackets (round-robin, single elimination, double elimination).
TypeScript
98
star
2

brackets-model

Types to manage tournament brackets
TypeScript
9
star
3

typedoc-plugin-extras

A plugin for TypeDoc which adds extras to the generated documentation
TypeScript
8
star
4

brackets-toornament-layer

A layer to convert Toornament data to data following the brackets-model
TypeScript
5
star
5

crypto-balance

A web application to show charts and graphs of your crypto balance
Rust
5
star
6

brackets-docs

Contains the documentation for all brackets-* related projects
Dockerfile
5
star
7

brackets-storage-calls

Creates a list of all storage calls with their signature and parameters
TypeScript
3
star
8

ts-json-db

A Node.js database using JSON file as storage. The result of requests are typed!
TypeScript
3
star
9

auto-paste-emoji

A script which automatically pastes an emoji if you just selected it from KDE Plasma's emoji picker
Shell
2
star
10

sm-builder-docker

Generates a Docker image which provides a ready-to-use `sm-builder`
Shell
2
star
11

auto-pause-unplug

A script which automatically pauses your music when you unplug your headphones
Shell
2
star
12

IndentCode

An easy VB.NET tool to increase indentation of code for StackOverflow
Visual Basic .NET
2
star
13

tee-shirt-song

🎢 A tee-shirt which programmatically "sings" a song
C++
2
star
14

Drarig29

My personal repo
Python
2
star
15

brackets-storage

Published packages and examples of CrudInterface implementations
TypeScript
2
star
16

is-emoji

A small CLI to check if a certain input is an emoji
Rust
1
star
17

MessengerBubble

A replica of the Messenger app (Facebook) conversation bubbles behavior.
JavaScript
1
star
18

stegcloak-webreveal

Reveal detected hidden secrets in a web page by injecting this script
JavaScript
1
star
19

UpdateWorker

A WinForms Component that checks for updates (VB.NET).
Visual Basic .NET
1
star