A simple RESTful API for the brackets-manager.js library by Drarig29. This server provides an HTTP interface to manage tournaments, stages, matches, participants, and seeding operations, using brackets-json-db as the storage backend.
The API is designed to be used as a backend service for tournament management applications. Only a subset of the library’s functions are exposed – specifically those required by the ssbu-matchups-tracker project. A tool for tracking Super Smash Bros. Ultimate matchups and tournament results.
- Tournaments / Stages – create, list, retrieve, and delete tournaments (stages)
- Matches – list matches of a stage, update matches, update child games (Best‑of‑X), reset match results, retrieve current playable matches
- Seeding – get, update, confirm, and reset the seeding of a stage
- Ordering – update the ordering of a stage or a round
- Participants – CRUD operations for participants (create, read, update, delete, list, delete all)
- Standings – obtain final standings for a tournament (with custom ranking formula for round‑robin)
- Utilities – health check, reset the entire database
Not all functions of brackets-manager.js are implemented; only the endpoints needed for the ssbu-matchups-tracker are provided.
- Node.js
- Express
- brackets-manager.js – tournament management core
- brackets-json-db – JSON file storage
- Docker – containerisation
- Docker and Docker Compose (if you use the Docker method)
- Alternatively, Node.js (v18 or later) to run without Docker
The easiest way to run the server is with Docker Compose.
-
Clone the repository
git clone https://github.com/juniornff/brackets-manager-server.git cd brackets-manager-server -
Start the container
docker-compose up -d
This will build the image (if not already built) and start the container on port 3000. The database file
db.jsonwill be persisted in thedata/directory (mounted as a volume). -
Verify the server is running
curl http://localhost:3000/health
You should receive a JSON response with status
OK.To stop the container:
docker-compose down
If you prefer to build and run the image without Compose:
docker build -t brackets-manager-server .
docker run -p 3000:3000 -v $(pwd)/data:/app/data -e DATA_FILE=data/db.json brackets-manager-serverIf you need to run the server on a different host port (e.g., 8080), edit the ports section in docker-compose.yml
The server uses the environment variable DATA_FILE to determine where to store the JSON database. By default, in the provided docker-compose.yml, it is set to data/db.json and the ./data directory is mounted as a volume.
If you want to change the location or filename:
- Modify the
volumessection to mount a different host directory. - Update the
DATA_FILEenvironment variable accordingly (the path should be relative to the container's working directory,/app).
If you prefer to run the server directly on your machine without Docker, follow these steps:
-
Install dependencies
npm install
-
Prepare the database directory
By default, the server stores the database in
data/db.json. Create the directory if it doesn't exist:mkdir -p data
-
Set environment variables (optional)
You can change the database file location by setting the
DATA_FILEenvironment variable. For example, to use./my_db.json:export DATA_FILE=my_db.jsonIf not set, it defaults to
data/db.json. -
Start the server
npm start
Or directly with Node:
node tournament-server.js
This project is licensed under the MIT License – see the LICENSE file for details.