Novelty Palliates Malaise

    brackets-manager
    TypeScript icon, indicating that this package has built-in type declarations

    1.5.4 • Public • Published

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

    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);
    
    await manager.create({
      name: 'My tournament',
      tournamentId: 0,
      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 },
    });

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

    You can navigate the API documentation here: BracketsManager class documentation

    You can also use all the helpers defined by the library (see list here):

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

    Credits

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

    It has been inspired by:

    Install

    npm i brackets-manager

    DownloadsWeekly Downloads

    206

    Version

    1.5.4

    License

    ISC

    Unpacked Size

    378 kB

    Total Files

    55

    Last publish

    Collaborators

    • drarig29