I built tournament-engine for goatformat.com.1 It runs Swiss rounds and single and
double elimination brackets, and ranks players with the community's custom tiebreakers. No open
source bracket library I found covers all of this, or is tested this thoroughly. This post covers why
goatformat.com moved off Challonge, what tournament-engine does, the edge cases it gets right, and how I
validated it with over 1,500 simulations.
Where Challonge fell short
goatformat.com ran its events on Challonge, a hosted bracket service, from 2019.2 It had four problems:
- Tiebreakers. The community decides top cut with its own tiebreakers, and Challonge only offers a fixed list.3
- Swiss pairing. Swiss rounds match players with the same record. Challonge sometimes gave a player two opponents from a lower record in one event, which lowers their tiebreakers.
- API limits. Free apps get 500 requests a month, and from July 6, 2026 requests past that fail.4
- Display. Pairings and standings lived on Challonge, so players left goatformat.com to find their next match.
What tournament-engine does
- Swiss pairing follows FIDE's chess rules:5 no rematches, the bye to the lowest record, and opponents on the same record wherever possible. It scores every possible pairing and picks the best set at once.
- Elimination brackets drop players who lose into the losers bracket the way start.gg and Challonge do, which keeps early rematches rare.6
- Rankings use Mantis 2.0, the community's tiebreaker,7 to seed a single or double elimination top cut after Swiss.
Edge cases tournament-engine gets right
Finishing brackets full of byes
A bye produces no loser, so a losers bracket match fed by two byes waits for players who never
arrive, and the event never finishes. tournament-engine marks that match empty and plays on.
Dropping losers away from past opponents
In double elimination, a player is out after two losses, and those losses should come from different
opponents wherever the bracket allows. A fixed drop order can drop a player onto someone they already
beat. tournament-engine rotates the drop order like Challonge and start.gg,6 and wires the losers
bracket exactly like Challonge at all 19 sizes I captured.
Giving the Swiss bye to the lowest record
With an odd number of players, one player each round gets a bye. It goes to the lowest record, since
a free win at the top can decide top cut. Pairing code that adds every rule into one score lets the
others outvote this one and hands the bye to the leader. tournament-engine ranks its rules so this one
always wins.
Validation and simulations
Brackets and pairings are validated against outside references, and simulations play whole events to the end:
- Brackets match brackets captured from Challonge at 19 field sizes, from 4 to 64 players.
- Swiss pairings are compared with FIDE's reference pairings at 18 field sizes: 130 events, 659
rounds.
tournament-engineis never worse on rematches or byes, and never pairs a player further outside their record than FIDE does. - Simulated events: 1,680 single and double elimination events from 2 to 64 players are played to the end, with every result checked against the bracket's rules.
- Corrections give an identical bracket when a result is reopened and reported again, across 60 randomized runs.
Running in production
goatformat.com runs its events on tournament-engine. Players sign up and report results through the
community's Discord bot, and the site shows every bracket and standing as results come in.
Try it yourself
tournament-engine is extracted from
goatformat.com as an MIT-licensed library. Single elimination, double elimination and Swiss are pure
functions over plain data, so it works with any database or framework. There are three ways to use
it:
- Try it: the demo runs a full tournament in the
browser and shows every
tournament-enginecall it makes. - Build on it: install
tournament-enginefrom npm and call it from your own app. The package README has an example. - Self-host it: clone the repo and run the demo, or the CLI on Postgres.
References
-
GOAT Format: About: Yu-Gi-Oh played on the 2005 card pool, and its community. ↩
-
Challonge: Rank and tie-break statistics: the tiebreakers Challonge supports. ↩
-
Challonge API v2.1: Getting started: 500 requests a month without a paid plan, 429 responses from July 6, 2026. ↩
-
FIDE Dutch System (C.04.3): no rematches, one bye per player, the bye to the lowest score, fewest players paired outside their score group. ↩
-
start.gg: Changes in the world of brackets: rotating four losers bracket placement orders to avoid rematches. ↩ ↩2
-
UDE Tournament Policy v5: Mantis 2.0 tiebreakers, sections 21, 22 and 24. ↩