# madhuri02n/teamsphere-cpp architecture

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

- Interactive diagram: https://gitdiagram.com/madhuri02n/teamsphere-cpp
- Repository: https://github.com/madhuri02n/teamsphere-cpp

## Overview

TeamSphere is a team and match scheduling system: managers maintain teams and players, schedule matches with conflict checks, and record flight options. The principal flow runs from the React pages through a shared API client to the C++ HTTP server, resource controllers, scheduling/travel logic, and database, with JSON responses returned to the client. The graph also retains the dashboard, team-detail, and travel capabilities. Relationships reflect README statements and shown source references; unsampled controller and database details are kept at subsystem level where needed.

Main entry points: [`frontend/src/App.jsx`](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/App.jsx) (App routes), [`frontend/src/services/api.js`](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/services/api.js) (API client), [`backend/main.cpp`](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/main.cpp) (HTTP server), [`backend/database/Database.h`](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/database/Database.h) (Database interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React frontend"]
  node_app["App routes<br/>[App.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_teams["Teams<br/>[Teams.jsx]"]
  node_teamdetail["Team details<br/>[TeamDetails.jsx]"]
  node_matches["Matches<br/>[Matches.jsx]"]
  node_travel["Travel<br/>[Travel.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_message["Status messages<br/>[Message.jsx]"]
  node_format["Display formatting<br/>[format.js]"]
  node_client["API client<br/>[api.js]"]
end

subgraph group_server["HTTP API"]
  node_http["HTTP server<br/>[main.cpp]"]
end

subgraph group_domain["Resource management"]
  node_teamctl["Team routes<br/>[TeamController.cpp]"]
  node_playerctl["Player routes"]
  node_matchctl["Match routes"]
  node_flightctl["Flight routes"]
  node_models["Resource models"]
end

subgraph group_logic["Domain logic"]
  node_validation["Validation and errors"]
  node_schedule["Conflict detection"]
  node_travelservice["Flight ranking<br/>[TravelService.cpp]"]
end

subgraph group_storage["Persistence"]
  node_dbapi["Database interface<br/>[Database.h]"]
  node_mongo[("MongoDB store<br/>[MongoDB.cpp]")]
  node_memory[("Memory store<br/>[MemoryDB.cpp]")]
end

node_manager(("Manager"))

node_manager -->|"uses"| node_app
node_app -->|"renders"| node_navbar
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_teams
node_app -->|"routes to"| node_teamdetail
node_app -->|"routes to"| node_matches
node_app -->|"routes to"| node_travel
node_dashboard -->|"requests"| node_client
node_teams -->|"requests"| node_client
node_teamdetail -->|"requests"| node_client
node_matches -->|"requests"| node_client
node_travel -->|"requests"| node_client
node_dashboard -->|"displays"| node_message
node_teams -->|"displays"| node_message
node_teamdetail -->|"displays"| node_message
node_matches -->|"displays"| node_message
node_travel -->|"displays"| node_message
node_dashboard -->|"formats"| node_format
node_matches -->|"formats"| node_format
node_travel -->|"formats"| node_format
node_client -->|"sends requests"| node_http
node_http -->|"returns JSON"| node_client
node_http -->|"registers routes"| node_teamctl
node_http -->|"registers routes"| node_playerctl
node_http -->|"registers routes"| node_matchctl
node_http -->|"registers routes"| node_flightctl
node_teamctl -->|"validates input"| node_validation
node_playerctl -->|"validates input"| node_validation
node_matchctl -->|"validates input"| node_validation
node_flightctl -->|"validates input"| node_validation
node_teamctl -->|"uses storage"| node_dbapi
node_playerctl -->|"uses storage"| node_dbapi
node_matchctl -->|"reads and writes"| node_dbapi
node_flightctl -->|"reads and writes"| node_dbapi
node_matchctl -->|"checks conflicts"| node_schedule
node_flightctl -->|"ranks flights"| node_travelservice
node_dbapi -->|"implemented by"| node_mongo
node_dbapi -->|"implemented by"| node_memory
node_matchctl -->|"converts match and team data"| node_models
node_flightctl -->|"converts flight data"| node_models

click node_app "https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/pages/Dashboard.jsx"
click node_teams "https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/pages/Teams.jsx"
click node_teamdetail "https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/pages/TeamDetails.jsx"
click node_matches "https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/pages/Matches.jsx"
click node_travel "https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/pages/Travel.jsx"
click node_navbar "https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/components/Navbar.jsx"
click node_message "https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/components/Message.jsx"
click node_format "https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/services/format.js"
click node_client "https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/services/api.js"
click node_http "https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/main.cpp"
click node_teamctl "https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/controllers/TeamController.cpp"
click node_playerctl "https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/controllers/PlayerController.cpp"
click node_matchctl "https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/controllers/MatchController.cpp"
click node_flightctl "https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/controllers/FlightController.cpp"
click node_models "https://github.com/madhuri02n/teamsphere-cpp/tree/main/backend/models"
click node_validation "https://github.com/madhuri02n/teamsphere-cpp/tree/main/backend/utils"
click node_schedule "https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/services/ScheduleService.cpp"
click node_travelservice "https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/services/TravelService.cpp"
click node_dbapi "https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/database/Database.h"
click node_mongo "https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/database/MongoDB.cpp"
click node_memory "https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/database/MemoryDB.cpp"

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_app,node_dashboard,node_teams,node_teamdetail,node_matches,node_travel,node_navbar,node_message,node_format,node_client toneBlue
class node_http toneAmber
class node_teamctl,node_playerctl,node_matchctl,node_flightctl,node_models toneMint
class node_validation,node_schedule,node_travelservice toneRose
class node_dbapi,node_mongo,node_memory,node_manager toneIndigo
```

## Components

### React frontend

- [App routes](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Dashboard](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Teams](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/pages/Teams.jsx): `frontend/src/pages/Teams.jsx`
- [Team details](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/pages/TeamDetails.jsx): `frontend/src/pages/TeamDetails.jsx`
- [Matches](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/pages/Matches.jsx): `frontend/src/pages/Matches.jsx`
- [Travel](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/pages/Travel.jsx): `frontend/src/pages/Travel.jsx`
- [Navigation](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`
- [Status messages](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/components/Message.jsx): `frontend/src/components/Message.jsx`
- [Display formatting](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/services/format.js): `frontend/src/services/format.js`
- [API client](https://github.com/madhuri02n/teamsphere-cpp/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### HTTP API

- [HTTP server](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/main.cpp): `backend/main.cpp`

### Resource management

- [Team routes](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/controllers/TeamController.cpp): `backend/controllers/TeamController.cpp`
- [Player routes](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/controllers/PlayerController.cpp): `backend/controllers/PlayerController.cpp`
- [Match routes](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/controllers/MatchController.cpp): `backend/controllers/MatchController.cpp`
- [Flight routes](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/controllers/FlightController.cpp): `backend/controllers/FlightController.cpp`
- [Resource models](https://github.com/madhuri02n/teamsphere-cpp/tree/main/backend/models): `backend/models`

### Domain logic

- [Validation and errors](https://github.com/madhuri02n/teamsphere-cpp/tree/main/backend/utils): `backend/utils`
- [Conflict detection](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/services/ScheduleService.cpp): `backend/services/ScheduleService.cpp`
- [Flight ranking](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/services/TravelService.cpp): `backend/services/TravelService.cpp`

### Persistence

- [Database interface](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/database/Database.h): `backend/database/Database.h`
- [MongoDB store](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/database/MongoDB.cpp): `backend/database/MongoDB.cpp`
- [Memory store](https://github.com/madhuri02n/teamsphere-cpp/blob/main/backend/database/MemoryDB.cpp): `backend/database/MemoryDB.cpp`

### Other components

- **Manager**

## Connections

- Manager → App routes: uses (evidence: `README.md`)
- App routes → Navigation: renders (evidence: `frontend/src/App.jsx`)
- App routes → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Teams: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Team details: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Matches: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Travel: routes to (evidence: `frontend/src/App.jsx`)
- Dashboard → API client: requests (evidence: `frontend/src/pages/Dashboard.jsx`)
- Teams → API client: requests (evidence: `frontend/src/pages/Teams.jsx`)
- Team details → API client: requests (evidence: `frontend/src/pages/TeamDetails.jsx`)
- Matches → API client: requests (evidence: `frontend/src/pages/Matches.jsx`)
- Travel → API client: requests (evidence: `frontend/src/pages/Travel.jsx`)
- Dashboard → Status messages: displays (evidence: `frontend/src/pages/Dashboard.jsx`)
- Teams → Status messages: displays (evidence: `frontend/src/pages/Teams.jsx`)
- Team details → Status messages: displays (evidence: `frontend/src/pages/TeamDetails.jsx`)
- Matches → Status messages: displays (evidence: `frontend/src/pages/Matches.jsx`)
- Travel → Status messages: displays (evidence: `frontend/src/pages/Travel.jsx`)
- Dashboard → Display formatting: formats (evidence: `frontend/src/pages/Dashboard.jsx`)
- Matches → Display formatting: formats (evidence: `frontend/src/pages/Matches.jsx`)
- Travel → Display formatting: formats (evidence: `frontend/src/pages/Travel.jsx`)
- API client → HTTP server: sends requests (evidence: `README.md`)
- HTTP server → API client: returns JSON (evidence: `README.md`)
- HTTP server → Team routes: registers routes (evidence: `backend/main.cpp`)
- HTTP server → Player routes: registers routes (evidence: `backend/main.cpp`)
- HTTP server → Match routes: registers routes (evidence: `backend/main.cpp`)
- HTTP server → Flight routes: registers routes (evidence: `backend/main.cpp`)
- Team routes → Validation and errors: validates input (evidence: `backend/controllers/TeamController.cpp`)
- Player routes → Validation and errors: validates input (evidence: `backend/controllers/PlayerController.cpp`)
- Match routes → Validation and errors: validates input (evidence: `backend/controllers/MatchController.cpp`)
- Flight routes → Validation and errors: validates input (evidence: `backend/controllers/FlightController.cpp`)
- Team routes → Database interface: uses storage
- Player routes → Database interface: uses storage
- Match routes → Database interface: reads and writes (evidence: `backend/controllers/MatchController.cpp`)
- Flight routes → Database interface: reads and writes (evidence: `backend/controllers/FlightController.cpp`)
- Match routes → Conflict detection: checks conflicts (evidence: `backend/controllers/MatchController.cpp`)
- Flight routes → Flight ranking: ranks flights (evidence: `backend/controllers/FlightController.cpp`)
- Database interface → MongoDB store: implemented by (evidence: `README.md`)
- Database interface → Memory store: implemented by (evidence: `README.md`)
- Match routes → Resource models: converts match and team data (evidence: `backend/controllers/MatchController.cpp`)
- Flight routes → Resource models: converts flight data (evidence: `backend/controllers/FlightController.cpp`)
