← NewTon DC Tournament Manager

Architecture & Reliability

How NewTon DC Tournament Manager is built to be virtually crash-proof.

Design Philosophy

NewTon DC Tournament Manager is built around a single overriding principle: a tournament that has started must never lose data or end up in an invalid state. Every architectural decision follows from that.

This means no dynamic calculations that could produce different results depending on execution order, no mutable shared state that different code paths can corrupt, and no operations that can half-complete. Instead, NewTon DC Tournament Manager uses hardcoded lookup tables as the single source of truth for all bracket logic, and a transaction-based history system that logs every match action and enables surgical undo.

The result is a system that can survive almost any failure — a misclick, a browser crash, a power cut mid-tournament — and be restored to an exact, consistent state.


Single Source of Truth

The most critical architectural decision in NewTon DC Tournament Manager is how bracket progression works. Many systems calculate where a player should go next at runtime — using formulas, round arithmetic, or conditional logic. NewTon DC Tournament Manager does not.

Instead, all bracket progression is defined in a single constant object called MATCH_PROGRESSION, hardcoded in clean-match-progression.js:

const MATCH_PROGRESSION = {
    8:  { /* all rules for 8-slot brackets  */ },
    16: { /* all rules for 16-slot brackets */ },
    32: { /* all rules for 32-slot brackets */ }
};

Every match — on the Frontside and Backside — has an explicit entry that defines exactly where the winner goes and where the loser goes:

'FS-1-1': {
    winner: ['FS-2-1', 'player1'],
    loser:  ['BS-1-1', 'player1']
}

There is only one function that moves players between matches — advancePlayer() — and it does nothing but look up the rule and apply it. No calculations. No special cases. No branches.

Why this matters


Transaction History & Undo

Every match action in NewTon DC Tournament Manager is recorded as a transaction in a per-tournament log. The tournament's current state is not just a snapshot — it is the sum of every recorded action that has been applied to it.

This approach — known as event sourcing — has two important consequences:

The transaction log is capped at 1,000 entries, visible and manageable via the Developer Console. The Console also shows a Transaction Health indicator so operators can see at a glance how much of the limit is in use.


Data Separation

NewTon DC Tournament Manager maintains strict isolation between three categories of data, each stored independently and never mixed:

CategoryWhat it containsStorage key
Tournament dataPlayers, matches, bracket, placements, statustournament_{id}
Transaction historyFull audit log of every match actiontournament_{id}_history
Global configurationPoints, legs, lanes, UI preferencesdartsGlobalConfig

Configuration is never saved with a tournament. Tournament exports contain only the tournament's own data — not the config of the machine it was exported from. This means a tournament exported from one club's setup can be imported at another without any configuration bleed.

When a tournament is deleted, all of its keys are removed completely. No residue, no contamination between tournaments.


Offline-First Persistence

NewTon DC Tournament Manager has no server dependency for any of its core functionality. All data lives in the browser's localStorage — a sandboxed, domain-isolated storage area that persists across browser restarts and reboots without any network connection.

Every state change is saved immediately. There is no "save button" because there is no moment where unsaved state exists. If the browser crashes mid-tournament, the last saved state is fully intact and consistent.

See the Privacy Architecture page for the full storage model.


Strengths


Known Limitations

Honesty is part of reliability. These are the known constraints of the current architecture: