Running locally
Run Auto Tournament from source for development.
What you need
- Node.js 20. The repository has an
.nvmrc, sonvm usepicks the right version. - Yarn 1 (classic).
- Docker, for the database.
- Git.
Run the dev servers
Fork and clone
Fork Auto-Tournament/auto-tournament on GitHub, then clone your fork:
git clone https://github.com/YOUR_USERNAME/auto-tournament.git
cd auto-tournamentInstall the packages
yarn installStart the database
yarn dbThis starts PostgreSQL 16 in a Docker container called auto-tournament-postgres on port 5432.
Create .env
cp example.env .envThe DB_* values in example.env match yarn db. Set the address of the dev server:
FRONTEND_BASE_URL=http://localhost:5173Sign-in providers are set up later in the app (Settings → Sign-in). You do not need any to get started.
Start the API and the web app
yarn devThis starts the API on port 3000 and the web app on port 5173. The API log is also written to logs/dev-api-<time>.log.
Open the app
Open http://localhost:5173. On an empty database, the API log prints a one-time setup code: open Set up the first admin (/setup), enter it, and create the local admin. The dev build also shows Dev tools in the menu and the Developer tab in Settings.
Run a production build
To test the Docker image the way users run it, build it from your checkout:
Set the secrets
Set SESSION_SECRET and SERVER_TOKEN in .env. Set FRONTEND_BASE_URL=http://localhost:3069.
Build and start
yarn docker:local:upThis runs docker compose --env-file .env -f docker/docker-compose.local.yml up -d --build. The build has Dev Tools turned on and allows simulation mode.
Open the app
Open http://localhost:3069. Follow the log with yarn docker:local:logs.
Stop it
yarn docker:local:downThis build does not keep the database in a volume. The data is gone when the containers are removed.
Test a pull request
Run it
Use yarn dev for a quick look, or yarn docker:local:up to test the production build. After a change to the Dockerfile or the dependencies, use yarn docker:local:rebuild.
Useful commands
| Command | What it does |
|---|---|
yarn lint | Run ESLint. yarn lint:fix fixes what it can. |
yarn typecheck | Typecheck the API and the web app. |
yarn typecheck:ratchet | Fail if there are more type errors than in scripts/typecheck-baseline.json. CI runs this one. |
yarn docs:api | Generate docs/API-REFERENCE.md and docs/openapi.json from the routers. |
yarn db:reset | Delete the dev database container and start a new, empty one. |
yarn db:stop | Stop the dev database. |
yarn build | Build the API and the web app. |
To test matches without real players, see Simulation mode.