# tranquang2012/tournament-organizer architecture

> Architecture diagram of the GitHub repository tranquang2012/tournament-organizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tranquang2012/tournament-organizer
- Repository: https://github.com/tranquang2012/tournament-organizer

## Overview

Netcompany Tournament Organizer is a browser platform for creating, scheduling, running, and following sports and esports tournaments. Guests browse sports, events, brackets, results, matches, and a calendar; signed-in users can manage profiles and favorites; administrators configure and score tournaments, with super-admin account controls. The backend exposes these capabilities through an Express API, with tournament, match, identity, favorites, and admin subsystems. Major runtime connections are supported by the README and sampled route/controller code; unsampled subsystem internals are represented at their existing directories.

Main entry points: [`frontend/src/main.jsx`](https://github.com/tranquang2012/tournament-organizer/blob/main/frontend/src/main.jsx) (React SPA routes), [`backend/src/modules/tournament/tournament.routes.js`](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/tournament/tournament.routes.js) (Tournament API), [`backend/src/modules/matches/matches.routes.js`](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/matches/matches.routes.js) (Match API), [`frontend/src/config/apiEndpoints.js`](https://github.com/tranquang2012/tournament-organizer/blob/main/frontend/src/config/apiEndpoints.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser experience"]
  node_spa["React SPA routes<br/>[main.jsx]"]
  node_public_pages["Public pages"]
  node_admin_pages["Admin pages"]
  node_auth_ui["Login and profile UI"]
  node_api_client["API client<br/>[apiEndpoints.js]"]
end

subgraph group_tournament["Tournament lifecycle"]
  node_tournament_api["Tournament API"]
  node_tournament_workflow["Tournament setup and publishing"]
  node_brackets["Bracket generation<br/>[bracket.service.js]"]
  node_rankings["Rankings<br/>[ranking.service.js]"]
  node_sports["Sports catalog"]
end

subgraph group_matches["Matches and results"]
  node_match_api["Match API<br/>[matches.routes.js]"]
  node_match_workflow["Scheduling and scoring<br/>[matches.service.js]"]
  node_match_stats["Match statistics"]
end

subgraph group_identity["Identity and access"]
  node_supabase["Supabase Auth and Storage"]
  node_user_api["User API<br/>[user.routes.js]"]
  node_user_service["Profile and account management<br/>[user.service.js]"]
end

subgraph group_operations["User and admin services"]
  node_favorites["Favorites and reminders"]
  node_admin_services["Dashboard and AI advisor"]
  node_database[("PostgreSQL<br/>[pool.js]")]
end

node_guest(("Guest"))
node_signed_user(("Signed-in user"))
node_administrator(("Administrator"))

node_guest -->|"browses"| node_spa
node_signed_user -->|"uses"| node_spa
node_administrator -->|"manages events"| node_spa
node_spa -->|"routes to"| node_public_pages
node_spa -->|"routes to"| node_admin_pages
node_spa -->|"routes to"| node_auth_ui
node_public_pages -.->|"loads data"| node_api_client
node_admin_pages -.->|"submits changes"| node_api_client
node_auth_ui -->|"authenticates"| node_supabase
node_auth_ui -->|"requests profile"| node_api_client
node_api_client -->|"calls profile routes"| node_user_api
node_tournament_api -->|"dispatches setup"| node_tournament_workflow
node_tournament_api -->|"dispatches bracket actions"| node_brackets
node_tournament_api -->|"dispatches ranking query"| node_rankings
node_match_api -->|"dispatches match actions"| node_match_workflow
node_match_api -->|"routes statistics"| node_match_stats
node_user_api -->|"dispatches profile actions"| node_user_service
node_user_api -->|"verifies bearer token"| node_supabase
node_tournament_workflow -.->|"persists tournament data"| node_database
node_match_workflow -->|"reads and writes"| node_database
node_signed_user -->|"follows tournaments"| node_favorites
node_signed_user -->|"receives reminders"| node_favorites
node_administrator -->|"uses dashboard and advisor"| node_admin_services
node_administrator -->|"creates and runs events"| node_tournament_api
node_guest -->|"browses published events"| node_tournament_api
node_guest -->|"views match details"| node_match_api
node_administrator -->|"schedules and scores"| node_match_api

click node_spa "https://github.com/tranquang2012/tournament-organizer/blob/main/frontend/src/main.jsx"
click node_public_pages "https://github.com/tranquang2012/tournament-organizer/tree/main/frontend/src/pages/public"
click node_admin_pages "https://github.com/tranquang2012/tournament-organizer/tree/main/frontend/src/pages/admin"
click node_auth_ui "https://github.com/tranquang2012/tournament-organizer/tree/main/frontend/src/pages/auth"
click node_api_client "https://github.com/tranquang2012/tournament-organizer/blob/main/frontend/src/config/apiEndpoints.js"
click node_tournament_api "https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/tournament/tournament.routes.js"
click node_tournament_workflow "https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/tournament/service/tournament.service.js"
click node_brackets "https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/tournament/service/bracket.service.js"
click node_rankings "https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/tournament/service/ranking.service.js"
click node_sports "https://github.com/tranquang2012/tournament-organizer/tree/main/backend/src/modules/sport"
click node_match_api "https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/matches/matches.routes.js"
click node_match_workflow "https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/matches/service/matches.service.js"
click node_match_stats "https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/matches/service/matchStat.service.js"
click node_user_api "https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/user/user.routes.js"
click node_user_service "https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/user/service/user.service.js"
click node_favorites "https://github.com/tranquang2012/tournament-organizer/tree/main/backend/src/modules/favorites"
click node_admin_services "https://github.com/tranquang2012/tournament-organizer/tree/main/backend/src/modules/admin"
click node_database "https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/shared/database/pool.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_spa,node_public_pages,node_admin_pages,node_auth_ui,node_api_client,node_signed_user toneBlue
class node_tournament_api,node_tournament_workflow,node_brackets,node_rankings,node_sports toneAmber
class node_match_api,node_match_workflow,node_match_stats toneMint
class node_supabase,node_user_api,node_user_service toneRose
class node_favorites,node_admin_services,node_database,node_guest,node_administrator toneIndigo
```

## Components

### Browser experience

- [React SPA routes](https://github.com/tranquang2012/tournament-organizer/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Public pages](https://github.com/tranquang2012/tournament-organizer/tree/main/frontend/src/pages/public): `frontend/src/pages/public`
- [Admin pages](https://github.com/tranquang2012/tournament-organizer/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`
- [Login and profile UI](https://github.com/tranquang2012/tournament-organizer/tree/main/frontend/src/pages/auth): `frontend/src/pages/auth`
- [API client](https://github.com/tranquang2012/tournament-organizer/blob/main/frontend/src/config/apiEndpoints.js): `frontend/src/config/apiEndpoints.js`

### Tournament lifecycle

- [Tournament API](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/tournament/tournament.routes.js): `backend/src/modules/tournament/tournament.routes.js`
- [Tournament setup and publishing](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/tournament/service/tournament.service.js): `backend/src/modules/tournament/service/tournament.service.js`
- [Bracket generation](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/tournament/service/bracket.service.js): `backend/src/modules/tournament/service/bracket.service.js`
- [Rankings](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/tournament/service/ranking.service.js): `backend/src/modules/tournament/service/ranking.service.js`
- [Sports catalog](https://github.com/tranquang2012/tournament-organizer/tree/main/backend/src/modules/sport): `backend/src/modules/sport`

### Matches and results

- [Match API](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/matches/matches.routes.js): `backend/src/modules/matches/matches.routes.js`
- [Scheduling and scoring](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/matches/service/matches.service.js): `backend/src/modules/matches/service/matches.service.js`
- [Match statistics](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/matches/service/matchStat.service.js): `backend/src/modules/matches/service/matchStat.service.js`

### Identity and access

- **Supabase Auth and Storage**
- [User API](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/user/user.routes.js): `backend/src/modules/user/user.routes.js`
- [Profile and account management](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/modules/user/service/user.service.js): `backend/src/modules/user/service/user.service.js`

### User and admin services

- [Favorites and reminders](https://github.com/tranquang2012/tournament-organizer/tree/main/backend/src/modules/favorites): `backend/src/modules/favorites`
- [Dashboard and AI advisor](https://github.com/tranquang2012/tournament-organizer/tree/main/backend/src/modules/admin): `backend/src/modules/admin`
- [PostgreSQL](https://github.com/tranquang2012/tournament-organizer/blob/main/backend/src/shared/database/pool.js): `backend/src/shared/database/pool.js`

### Other components

- **Guest**
- **Signed-in user**
- **Administrator**

## Connections

- Guest → React SPA routes: browses (evidence: `README.md`)
- Signed-in user → React SPA routes: uses (evidence: `README.md`)
- Administrator → React SPA routes: manages events (evidence: `README.md`)
- React SPA routes → Public pages: routes to (evidence: `frontend/src/main.jsx`)
- React SPA routes → Admin pages: routes to (evidence: `frontend/src/main.jsx`)
- React SPA routes → Login and profile UI: routes to (evidence: `frontend/src/main.jsx`)
- Public pages → API client: loads data
- Admin pages → API client: submits changes
- Login and profile UI → Supabase Auth and Storage: authenticates
- Login and profile UI → API client: requests profile
- API client → User API: calls profile routes
- Tournament API → Tournament setup and publishing: dispatches setup
- Tournament API → Bracket generation: dispatches bracket actions
- Tournament API → Rankings: dispatches ranking query
- Match API → Scheduling and scoring: dispatches match actions
- Match API → Match statistics: routes statistics (evidence: `backend/src/modules/matches/matches.routes.js`)
- User API → Profile and account management: dispatches profile actions
- User API → Supabase Auth and Storage: verifies bearer token
- Tournament setup and publishing → PostgreSQL: persists tournament data
- Scheduling and scoring → PostgreSQL: reads and writes (evidence: `backend/src/modules/matches/service/matches.service.js`)
- Signed-in user → Favorites and reminders: follows tournaments (evidence: `README.md`)
- Signed-in user → Favorites and reminders: receives reminders (evidence: `README.md`)
- Administrator → Dashboard and AI advisor: uses dashboard and advisor (evidence: `README.md`)
- Administrator → Tournament API: creates and runs events (evidence: `README.md`)
- Guest → Tournament API: browses published events (evidence: `backend/src/modules/tournament/tournament.routes.js`)
- Guest → Match API: views match details (evidence: `backend/src/modules/matches/matches.routes.js`)
- Administrator → Match API: schedules and scores (evidence: `backend/src/modules/matches/matches.routes.js`)
