Giter Club home page Giter Club logo

brackets-manager.js's Introduction

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:

brackets-manager.js's People

Contributors

drarig29 avatar zestsystem avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.