# imsolx/prsportteched architecture

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

- Interactive diagram: https://gitdiagram.com/imsolx/prsportteched
- Repository: https://github.com/imsolx/prsportteched

## Overview

PrSport is a web application for managing sports tournaments, from administration and athlete registration through match results and public schedules, standings, and reports. The visible runtime path is a browser-facing PHP page or API request into the application service, which uses authentication, database access, and optionally Gemini for AI features. The service file is very large and only partially excerpted; domain capabilities are grouped rather than mapped to unverified internal calls. The README is empty, so product scope comes from the sampled UI and source.

Main entry points: [`app/AppService.php`](https://github.com/imsolx/prsportteched/blob/main/app/AppService.php) (Application service), [`app/Database.php`](https://github.com/imsolx/prsportteched/blob/main/app/Database.php) (Database access), [`app/Auth.php`](https://github.com/imsolx/prsportteched/blob/main/app/Auth.php) (Authentication and roles), [`app/bootstrap.php`](https://github.com/imsolx/prsportteched/blob/main/app/bootstrap.php) (Runtime bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry points"]
  node_web_page["Tournament web page<br/>[index.php]"]
  node_api["Action API<br/>[api.php]"]
end

subgraph group_domain["Tournament operations"]
  node_service["Application service<br/>[AppService.php]"]
  node_competition["Sports and tournaments<br/>[AppService.php]"]
  node_athletes["Athletes and teams<br/>[AppService.php]"]
  node_matches["Matches and results<br/>[AppService.php]"]
  node_reports["Reports and AI<br/>[AppService.php]"]
  node_news_orgs["News and organizations<br/>[AppService.php]"]
end

subgraph group_platform["Access and infrastructure"]
  node_auth["Authentication and roles<br/>[Auth.php]"]
  node_bootstrap["Runtime bootstrap<br/>[bootstrap.php]"]
  node_database_code["Database access<br/>[Database.php]"]
  node_database[("SQL database")]
  node_gemini{{"Gemini service"}}
  node_gemini_client["Gemini client<br/>[GeminiClient.php]"]
end

node_visitor(("Visitor or staff"))

node_visitor -.->|"views"| node_web_page
node_web_page -->|"loads runtime"| node_bootstrap
node_api -->|"loads runtime"| node_bootstrap
node_api -->|"dispatches action"| node_service
node_bootstrap -->|"boots database"| node_database_code
node_service -->|"checks permissions"| node_auth
node_service -->|"queries data"| node_database_code
node_service -->|"creates client"| node_gemini_client
node_auth -->|"reads users"| node_database_code
node_auth -->|"records audit"| node_service
node_database_code -->|"connects"| node_database
node_gemini_client -->|"sends requests"| node_gemini

click node_web_page "https://github.com/imsolx/prsportteched/blob/main/public/index.php"
click node_api "https://github.com/imsolx/prsportteched/blob/main/public/api.php"
click node_service "https://github.com/imsolx/prsportteched/blob/main/app/AppService.php"
click node_competition "https://github.com/imsolx/prsportteched/blob/main/app/AppService.php"
click node_athletes "https://github.com/imsolx/prsportteched/blob/main/app/AppService.php"
click node_matches "https://github.com/imsolx/prsportteched/blob/main/app/AppService.php"
click node_reports "https://github.com/imsolx/prsportteched/blob/main/app/AppService.php"
click node_news_orgs "https://github.com/imsolx/prsportteched/blob/main/app/AppService.php"
click node_auth "https://github.com/imsolx/prsportteched/blob/main/app/Auth.php"
click node_bootstrap "https://github.com/imsolx/prsportteched/blob/main/app/bootstrap.php"
click node_database_code "https://github.com/imsolx/prsportteched/blob/main/app/Database.php"
click node_gemini_client "https://github.com/imsolx/prsportteched/blob/main/app/GeminiClient.php"

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_web_page,node_api toneBlue
class node_service,node_competition,node_athletes,node_matches,node_reports,node_news_orgs toneAmber
class node_auth,node_bootstrap,node_database_code,node_database,node_gemini,node_gemini_client toneMint
class node_visitor toneIndigo
```

## Components

### Web entry points

- [Tournament web page](https://github.com/imsolx/prsportteched/blob/main/public/index.php): `public/index.php`
- [Action API](https://github.com/imsolx/prsportteched/blob/main/public/api.php): `public/api.php`

### Tournament operations

- [Application service](https://github.com/imsolx/prsportteched/blob/main/app/AppService.php): `app/AppService.php`
- [Sports and tournaments](https://github.com/imsolx/prsportteched/blob/main/app/AppService.php): `app/AppService.php`
- [Athletes and teams](https://github.com/imsolx/prsportteched/blob/main/app/AppService.php): `app/AppService.php`
- [Matches and results](https://github.com/imsolx/prsportteched/blob/main/app/AppService.php): `app/AppService.php`
- [Reports and AI](https://github.com/imsolx/prsportteched/blob/main/app/AppService.php): `app/AppService.php`
- [News and organizations](https://github.com/imsolx/prsportteched/blob/main/app/AppService.php): `app/AppService.php`

### Access and infrastructure

- [Authentication and roles](https://github.com/imsolx/prsportteched/blob/main/app/Auth.php): `app/Auth.php`
- [Runtime bootstrap](https://github.com/imsolx/prsportteched/blob/main/app/bootstrap.php): `app/bootstrap.php`
- [Database access](https://github.com/imsolx/prsportteched/blob/main/app/Database.php): `app/Database.php`
- **SQL database**
- **Gemini service**
- [Gemini client](https://github.com/imsolx/prsportteched/blob/main/app/GeminiClient.php): `app/GeminiClient.php`

### Other components

- **Visitor or staff**

## Connections

- Visitor or staff → Tournament web page: views
- Tournament web page → Runtime bootstrap: loads runtime (evidence: `public/index.php`)
- Action API → Runtime bootstrap: loads runtime (evidence: `public/api.php`)
- Action API → Application service: dispatches action (evidence: `public/api.php`)
- Runtime bootstrap → Database access: boots database (evidence: `app/bootstrap.php`)
- Application service → Authentication and roles: checks permissions (evidence: `app/AppService.php`)
- Application service → Database access: queries data (evidence: `app/AppService.php`)
- Application service → Gemini client: creates client (evidence: `app/AppService.php`)
- Authentication and roles → Database access: reads users (evidence: `app/Auth.php`)
- Authentication and roles → Application service: records audit (evidence: `app/Auth.php`)
- Database access → SQL database: connects (evidence: `app/Database.php`)
- Gemini client → Gemini service: sends requests (evidence: `app/GeminiClient.php`)
