A web-based tournament management and scoring platform with event-centric workflows, supporting seeding rounds, double-elimination brackets, game queues, and customizable score sheet templates.
- Event Management - Create and manage tournament events with statuses (setup, active, complete, archived)
- Team Management - Register teams, bulk import, check-in workflows, and status tracking
- Seeding Rounds - Multi-round seeding with automatic ranking calculation (top 2 of 3 scores)
- Double Elimination Brackets - Generate brackets (4-64 teams), automatic seeding from rankings, bye handling, and winner advancement
- Game Queue - Ordered queue system for seeding rounds and bracket games with table assignments
- Customizable Score Sheets - Template-driven scoring with text, number, dropdown, button, checkbox, and repeatable group field types
- Score Review System - Admins can accept, reject, or edit submitted scores with full audit trail
- Access Codes - Judges access scoresheets via secure access codes (no login required)
- Google OAuth Authentication - Secure admin login with Google accounts
- Modern UI - Responsive React interface with dark mode support
- Public Views - Public event listings and bracket/seeding displays
Score sheet templates support the following field types:
- Text - Free-form text input
- Number - Numeric input with min/max/step validation
- Dropdown - Select from predefined options
- Buttons - Multiple choice with visual button selection
- Checkbox - Boolean (true/false) values
- Repeatable Group - Repeatable rows of sub-fields (for example, per-stack cube entry)
See Template Schema Guide for detailed schema documentation.
Note: Templates that include
repeatableGroupfields are not portable yet. They cannot be exported with the portable scoresheet tool until portable exporter support for this field type is added.
- Node.js 24 LTS and npm 11
- Google Cloud Platform account with OAuth 2.0 credentials (for admin authentication)
- Docker Engine + Compose (required; local PostgreSQL 18)
cd colosseum
npm install- Go to Google Cloud Console
- Create a new project or select an existing one
- Create OAuth 2.0 credentials:
- Go to "Credentials" -> "Create Credentials" -> "OAuth 2.0 Client ID"
- Application type: Web application
- Authorized redirect URIs:
http://localhost:3000/auth/google/callback
- Copy the Client ID and Client Secret
Colosseum uses Google only to sign admins in. It requests the basic profile and email scopes and nothing else: no offline access (refresh tokens) and no Google API scopes such as Drive or Sheets. Google tokens are not stored after sign-in. The OAuth consent screen only needs those two scopes, so remove any others listed there. Scopes granted to earlier versions stay on each user's Google account until revoked, either by the user at https://myaccount.google.com/connections or by a Workspace admin under Security → API controls.
The production OAuth client is configured as an Internal app, so Google only lets kipr.org Workspace accounts sign in. The app also checks the signed-in email against ALLOWED_EMAIL_DOMAINS (default kipr.org), and every account that passes that check is created as an admin. If the OAuth client is ever switched to External:
ALLOWED_EMAIL_DOMAINSbecomes the only gate on admin access, so it must stay set to the organization's domains in production. Setting it to an empty string would make any Google account an admin.- The domain check reads the account's email address. With an External client, consider also checking the verified Workspace domain (the
hdclaim) rather than the email domain alone. - Because only basic sign-in scopes are requested, an External client does not need Google's sensitive-scope verification.
cp .env.example .envEdit .env and add your Google OAuth credentials:
GOOGLE_CLIENT_ID=your-client-id-here
GOOGLE_CLIENT_SECRET=your-client-secret-here
SESSION_SECRET=your-random-session-secret
DATABASE_URL=postgres://colosseum:colosseum@localhost:5432/colosseum
TEST_DATABASE_URL=postgres://colosseum:colosseum@localhost:5432/colosseum_test.env.example already includes those database URLs. Inside a devcontainer the hostname is postgres rather than localhost.
Do not auto-start Compose from npm run dev. Start it first:
npm run db:up && npm run db:waitPort 5432 already in use. Create docker-compose.override.yml (gitignored if you prefer; do not commit local port choices):
services:
postgres:
ports:
- '5433:5432'Point DATABASE_URL and TEST_DATABASE_URL at localhost:5433.
Wipe local Postgres data:
npm run db:resetHelper scripts: db:up, db:wait, db:down, db:reset, db:psql.
Devcontainer / Codespaces. Reopening the folder in a container starts Compose siblings (app + postgres) with DATABASE_URL already pointing at hostname postgres. Wait for postStartCommand (pg_isready) before npm run dev.
Dev servers (React + Express):
npm run devThis starts two servers:
- Vite dev server (React frontend):
http://localhost:5173- Open this URL in your browser - Express API server (Backend):
http://localhost:3000
The Vite server proxies API calls to Express automatically.
Expect these logs:
Using PostgreSQL session store
Using PostgreSQL database
Database initialized successfully
Confirm the API is up:
curl http://localhost:3000/healthShould return { "status": "ok", ... }.
Inspect databases and schema:
npm run db:psqlThen in psql:
\l
\c colosseum
\dt
\l should list both colosseum and colosseum_test. \dt should show application tables plus "session" after the first server start (the session table is created by connect-pg-simple).
Production mode:
npm run build
npm startIn production, Express serves the built React app at http://localhost:3000.
Important: When running the Vite + Express pair, always use http://localhost:5173 (Vite) for the frontend, NOT port 3000.
A typical tournament follows this workflow:
- Create Event - Admin creates a new event with name, date, location, and number of seeding rounds
- Register Teams - Add teams individually or via bulk import
- Check In Teams - Mark teams as checked in on competition day
- Run Seeding Rounds - Queue seeding rounds, judges score via access codes, admin reviews scores
- Calculate Rankings - System computes rankings from top 2 of 3 seeding scores
- Generate Brackets - Create double-elimination brackets seeded from rankings
- Run Bracket Games - Queue bracket games, judges score, admin reviews, winners advance automatically
- Complete Event - Archive the event when the tournament concludes
- Navigate to the home page
- Click "Enter as Judge"
- Select a score sheet template
- Enter the access code provided by the admin
- Fill out the scoresheet and submit
- Login with Google OAuth
- Create an Event in the Events tab
- Add Teams in the Teams tab (single or bulk import)
- Configure Score Sheets in the Score Sheets tab
- Manage Seeding - View scores, calculate rankings in the Seeding tab
- Create Brackets - Generate brackets from seeding in the Brackets tab
- Manage Queue - Populate and order the game queue in the Queue tab
- Review Scores - Accept, reject, or edit scores in the Scoring tab
colosseum/
├── src/
│ ├── client/ # React frontend
│ │ ├── components/ # Reusable React components
│ │ │ ├── admin/ # Admin panel tabs and modals
│ │ │ ├── bracket/ # Bracket visualization components
│ │ │ └── seeding/ # Seeding table components
│ │ ├── contexts/ # React contexts (Auth, Theme, Event, Chat)
│ │ ├── pages/ # Page components (Home, Judge, Admin, etc.)
│ │ ├── styles/ # Global styles
│ │ ├── types/ # TypeScript type definitions
│ │ ├── utils/ # Utility functions
│ │ ├── App.tsx # Main React app with routing
│ │ └── main.tsx # React entry point
│ └── server/ # Express backend
│ ├── config/ # OAuth and API configuration
│ ├── database/ # Database connection and schema initialization
│ ├── middleware/ # Authentication middleware
│ ├── routes/ # API route handlers
│ │ ├── auth.ts # Authentication routes
│ │ ├── events.ts # Event CRUD
│ │ ├── teams.ts # Team management
│ │ ├── seeding.ts # Seeding scores and rankings
│ │ ├── brackets.ts # Bracket management
│ │ ├── queue.ts # Game queue
│ │ ├── scores.ts # Score review/approval
│ │ ├── scoresheet.ts # Template management
│ │ ├── audit.ts # Audit log
│ │ └── api.ts # Score submission (judge-facing)
│ ├── services/ # Business logic
│ │ ├── seedingRankings.ts # Seeding calculation
│ │ ├── bracketTemplates.ts # Bracket structure generation
│ │ ├── bracketByeResolver.ts # Bye handling
│ │ └── scoreAccept.ts # Score acceptance logic
│ ├── session/ # Session store
│ └── server.ts # Express server setup
├── docs/ # Documentation
│ ├── TEMPLATE_SCHEMA_GUIDE.md # Score sheet template schema reference
│ └── API_TESTING.md # API testing guide with curl examples
├── templates/ # Example score sheet templates
├── tests/ # Unit & integration tests (Vitest)
├── e2e/ # End-to-end tests (Playwright)
├── config/ # Shared test-runner configuration
├── docker/ # Local Postgres init scripts
├── docker-compose.yml # Local PostgreSQL 18 (required for app and tests)
├── dist/ # Build output
├── playwright.config.ts # Playwright E2E config
├── vite.config.ts # Vite configuration
├── tsconfig.json # TypeScript config
├── package.json
├── Dockerfile # Production Docker image
└── .env # Environment variables (not committed)
The application uses PostgreSQL with the following tables:
- users - Admin accounts (Google account id, email, name)
- events - Tournament events with status tracking
- teams - Participating teams per event with check-in status
- scoresheet_templates - Score sheet template definitions
- seeding_scores - Individual round scores per team
- seeding_rankings - Computed rankings (seed average, rank, normalized score)
- brackets - Double-elimination bracket containers
- bracket_entries - Teams assigned to brackets with seed positions
- bracket_games - Individual games with advancement routing
- bracket_templates - Pre-defined bracket structures for standard sizes
- score_submissions - Submitted scores with review status
- score_details - Field-by-field score breakdown
- event_scoresheet_templates - Links templates to events for seeding/bracket scoring
- game_queue - Ordered queue of games ready for judging
- audit_log - Change tracking for accountability
GET /auth/google- Initiate Google OAuthGET /auth/google/callback- OAuth callbackGET /auth/user- Get current userGET /auth/logout- Logout
GET /events- List all eventsGET /events/:id- Get event detailsPOST /events- Create eventPATCH /events/:id- Update eventDELETE /events/:id- Delete event
GET /teams/event/:eventId- List teams for eventGET /teams/:id- Get team detailsPOST /teams- Create teamPOST /teams/bulk- Bulk create teamsPATCH /teams/:id- Update teamPATCH /teams/:id/check-in- Check in teamDELETE /teams/:id- Delete team
GET /seeding/scores/event/:eventId- Get all scores for eventGET /seeding/scores/team/:teamId- Get scores for teamPOST /seeding/scores- Submit seeding scorePATCH /seeding/scores/:id- Update scoreDELETE /seeding/scores/:id- Delete scoreGET /seeding/rankings/event/:eventId- Get rankingsPOST /seeding/rankings/recalculate/:eventId- Recalculate rankings
GET /brackets/event/:eventId- List brackets for eventGET /brackets/:id- Get bracket with entries and gamesPOST /brackets- Create bracketPATCH /brackets/:id- Update bracketDELETE /brackets/:id- Delete bracketPOST /brackets/:id/entries- Add entryPOST /brackets/:id/entries/generate- Generate entries from seedingGET /brackets/:id/games- Get gamesPOST /brackets/:id/games- Create gamePATCH /brackets/games/:id- Update gamePOST /brackets/games/:id/advance- Advance winner
GET /queue/event/:eventId- Get queue for eventPOST /queue- Add item to queuePATCH /queue/:id- Update queue itemPATCH /queue/:id/call- Call team/gameDELETE /queue/:id- Remove from queue
POST /api/scores/submit- Submit a score (judge-facing)GET /scores/by-event/:eventId- Get scores for event (admin)POST /scores/:id/accept-event- Accept score (event-scoped)POST /scores/:id/revert-event- Revert acceptance
GET /scoresheet/templates- List all templatesGET /scoresheet/templates/:id- Get template detailsPOST /scoresheet/templates- Create templatePUT /scoresheet/templates/:id- Update template
GET /audit/event/:eventId- Get audit log for eventGET /audit/entity/:type/:id- Get audit log for entity
- Frontend: React 19, TypeScript, React Router, Vite
- Backend: Node.js, Express 5, TypeScript
- Database: PostgreSQL 18 (Docker Compose locally; Cloud SQL in production)
- Authentication: Passport.js with Google OAuth 2.0
- Testing: Vitest (unit/integration), Playwright (E2E)
- Build Tools: Vite (frontend), TypeScript Compiler (backend)
npm run buildBuilds both React frontend and Express backend:
- React app ->
dist/client/ - Express server ->
dist/server/
npm run devRuns both servers concurrently:
- Vite (React with HMR): http://localhost:5173 - Open this URL in your browser
- Express (API): http://localhost:3000
Changes to React components update instantly (Hot Module Replacement). Changes to Express server restart automatically (nodemon).
Individual servers:
npm run dev:client # Vite only
npm run dev:server # Express onlyUnit & integration tests (Vitest):
These run against PostgreSQL 18, the same major version as production, so the
tests exercise the dialect the application actually ships on. Start the server
first — npm run db:up also creates the colosseum_test database:
npm run db:up && npm run db:wait
npm test # Run tests in watch mode
npm run test:run # Run tests once
npm run coverage # Run with coverage reportThe connection string comes from TEST_DATABASE_URL (in your environment or
.env), and defaults to
postgres://colosseum:colosseum@localhost:5432/colosseum_test. Inside a
devcontainer the host is postgres rather than localhost.
Each Vitest worker process creates its own schema in that database and
truncates it between tests, so runs never touch your colosseum dev data.
End-to-end tests (Playwright):
Playwright tests live in the e2e/ directory and run against the full
application. npm run db:up must have been run first.
The Playwright config (playwright.config.ts) starts its own Express on
port 3001 and Vite on port 5174, with DATABASE_URL set to
TEST_DATABASE_URL. It never reuses a server already listening on 3000/5173,
so you can leave npm run dev running while the suite executes and it will not
touch your dev data. The suite uses the public schema of colosseum_test and
truncates it once at the start of each run, which does not disturb the Vitest
suite's per-worker schemas on the same database.
Before your first run, you will need to download Playwright's headless browser builds and their required OS libraries.
This is not handled by npm install.
Note
If you are using the Devcontainer setup, you do not need to run these commands manually.
Simply go straight to npm run test:e2e below.
# First-time setup — download Chromium and install required OS libraries.
# If in an environment without sudo (e.g. container), install in two steps.
# First, run as root to install OS-level libraries and dependencies:
npx playwright install-deps
# Then, as your user, run:
npx playwright install
# If in an environment with sudo access, you can do this in one step with:
npx playwright install --with-depsOnce the dependencies are installed, run Playwright tests with:
# Run E2E tests
npm run test:e2e
npm run lint # ESLint
npm run pretty # Prettier checkPublic and abuse-prone API endpoints are protected by express-rate-limit with per-route policies defined in src/server/middleware/rateLimit.ts.
| Limiter | Endpoints | Window | Limit | Key |
|---|---|---|---|---|
oauthLimiter |
GET /auth/google |
15 min | 20 | IP |
scoreSubmitLimiter |
POST /api/scores/submit |
1 min | 30 | IP |
accessCodeLimiter |
POST /scoresheet/templates/:id/verify |
15 min | 10 | IP + template id |
chatWriteLimiter |
POST /chat/events/:eventId/messages |
1 min | 15 | IP |
chatReadLimiter |
GET /chat/events/:eventId/messages |
1 min | 120 | IP |
queueSyncLimiter |
GET /queue/event/:eventId (sync=1 only) |
1 min | 60 | IP |
publicExpensiveReadLimiter |
GET /events/:id/overall/public, GET /documentation-scores/event/:eventId/public |
1 min | 30 | IP |
- Rate-limit counters use the built-in in-process memory store. This is a deliberate first-pass choice.
- Counters reset on process restart and are not shared across workers or instances.
- This is acceptable for a single-instance deployment or an initial rollout.
Move to a shared store (e.g. Redis via rate-limit-redis) when any of the following apply:
- The app runs on more than one instance (clustering, PM2 workers, Kubernetes replicas)
- Consistent global rate limits are required across restarts
- Stricter abuse controls are needed that survive deploys
- Ensure you're logged in with Google
- Check that OAuth credentials are correctly configured
- Verify redirect URI matches in Google Cloud Console
- Verify the event is selected in the admin panel
- Check that teams have been added to the correct event
- Ensure team status is not "withdrawn" or "no_show"
- Ensure seeding rankings have been calculated first
- Verify the bracket size accommodates the number of teams
- Check that teams are checked in before generating entries
- Rankings must be recalculated manually after score changes
- Use the "Recalculate Rankings" button in the Seeding tab
GNU AGPL v3