# mypatoff/clubcontrol architecture

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

- Interactive diagram: https://gitdiagram.com/mypatoff/clubcontrol
- Repository: https://github.com/mypatoff/clubcontrol

## Overview

ClubControl is a Windows PC-locking and billing system for computer clubs, with a server/admin panel and a client on each gaming PC. Staff start and manage sessions in the admin panel; the server persists billing state and sends commands to clients, which enforce locks and display session status. The server also provides bar sales, reports, discovery, backups, and update workflows. The graph emphasizes relationships visible in excerpts, the source index, or README; unsampled implementation links are omitted where evidence is insufficient.

Main entry points: [`src/ClubControl.Server/Services/SessionService.cs`](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/SessionService.cs) (Session billing), [`src/ClubControl.Client/Services/ServerConnection.cs`](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Client/Services/ServerConnection.cs) (Server connection), [`src/ClubControl.Client/Services/ClientUpdater.cs`](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Client/Services/ClientUpdater.cs) (Client updater), [`src/ClubControl.Server/Data/ClubDbContext.cs`](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Data/ClubDbContext.cs) (Data access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["Admin operations"]
  node_adminui["Admin panel<br/>[MainWindow.xaml.cs]"]
  node_barview["Bar page<br/>[BarView.xaml.cs]"]
  node_reportsui["Reports window"]
end

subgraph group_server["Server runtime"]
  node_sessions["Session billing<br/>[SessionService.cs]"]
  node_monitor["Session monitor"]
  node_hub["Client hub<br/>[ClubHub.cs]"]
  node_bar["Bar sales<br/>[BarService.cs]"]
  node_reports["Reports<br/>[ReportsService.cs]"]
  node_discovery["LAN discovery"]
  node_updates["Client updates"]
  node_backup["Database backup<br/>[DatabaseBackup.cs]"]
  node_dbcontext["Data access<br/>[ClubDbContext.cs]"]
  node_database[("Club database<br/>[ClubDbContext.cs]")]
end

subgraph group_client["Gaming PC client"]
  node_appcontroller["Lock controller<br/>[AppController.cs]"]
  node_connection["Server connection"]
  node_clientupdate["Client updater<br/>[ClientUpdater.cs]"]
  node_clientwindows["Lock screens<br/>[LockWindow.xaml.cs]"]
end

subgraph group_shared["Shared protocol"]
  node_commands["Client commands<br/>[ClientCommand.cs]"]
  node_settings["Client settings"]
  node_updateauth["Update verification"]
  node_release["Update script"]
end

node_staff(("Club staff"))

node_staff -->|"operates"| node_adminui
node_adminui -.->|"manages sessions"| node_sessions
node_monitor -->|"ticks billing"| node_sessions
node_sessions -->|"reads and writes"| node_dbcontext
node_sessions -->|"sends commands"| node_hub
node_hub -.->|"delivers commands"| node_connection
node_connection -->|"updates state"| node_appcontroller
node_appcontroller -.->|"shows lock UI"| node_clientwindows
node_barview -.->|"records sales"| node_bar
node_bar -->|"reads and writes"| node_dbcontext
node_reportsui -.->|"views reports"| node_reports
node_dbcontext -->|"persists entities"| node_database
node_updates -.->|"stages update command"| node_commands
node_connection -.->|"routes update"| node_clientupdate
node_clientupdate -->|"verifies package"| node_updateauth
node_clientupdate -->|"builds swap script"| node_release
node_sessions -->|"builds client payloads"| node_commands
node_commands -->|"carries settings"| node_settings
node_discovery -.->|"finds server"| node_connection
node_backup -.->|"backs up"| node_database

click node_adminui "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/MainWindow.xaml.cs"
click node_sessions "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/SessionService.cs"
click node_monitor "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/SessionMonitorService.cs"
click node_hub "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Hubs/ClubHub.cs"
click node_bar "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/BarService.cs"
click node_reports "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/ReportsService.cs"
click node_discovery "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/UdpDiscoveryService.cs"
click node_updates "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/ClientUpdateFile.cs"
click node_backup "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/DatabaseBackup.cs"
click node_dbcontext "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Data/ClubDbContext.cs"
click node_database "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Data/ClubDbContext.cs"
click node_appcontroller "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Client/Services/AppController.cs"
click node_connection "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Client/Services/ServerConnection.cs"
click node_clientupdate "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Client/Services/ClientUpdater.cs"
click node_clientwindows "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Client/Windows/LockWindow.xaml.cs"
click node_commands "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Shared/Dto/ClientCommand.cs"
click node_settings "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Shared/Dto/ClientSettingsDto.cs"
click node_updateauth "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Shared/Security/ClientUpdateAuth.cs"
click node_release "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Shared/ClientUpdateScript.cs"
click node_barview "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Views/BarView.xaml.cs"
click node_reportsui "https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Windows/ReportsWindow.xaml.cs"

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_adminui,node_barview,node_reportsui toneBlue
class node_sessions,node_monitor,node_hub,node_bar,node_reports,node_discovery,node_updates,node_backup,node_dbcontext,node_database toneAmber
class node_appcontroller,node_connection,node_clientupdate,node_clientwindows toneMint
class node_commands,node_settings,node_updateauth,node_release toneRose
class node_staff toneIndigo
```

## Components

### Admin operations

- [Admin panel](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/MainWindow.xaml.cs): `src/ClubControl.Server/MainWindow.xaml.cs`
- [Bar page](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Views/BarView.xaml.cs): `src/ClubControl.Server/Views/BarView.xaml.cs`
- [Reports window](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Windows/ReportsWindow.xaml.cs): `src/ClubControl.Server/Windows/ReportsWindow.xaml.cs`

### Server runtime

- [Session billing](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/SessionService.cs): `src/ClubControl.Server/Services/SessionService.cs`
- [Session monitor](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/SessionMonitorService.cs): `src/ClubControl.Server/Services/SessionMonitorService.cs`
- [Client hub](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Hubs/ClubHub.cs): `src/ClubControl.Server/Hubs/ClubHub.cs`
- [Bar sales](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/BarService.cs): `src/ClubControl.Server/Services/BarService.cs`
- [Reports](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/ReportsService.cs): `src/ClubControl.Server/Services/ReportsService.cs`
- [LAN discovery](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/UdpDiscoveryService.cs): `src/ClubControl.Server/Services/UdpDiscoveryService.cs`
- [Client updates](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/ClientUpdateFile.cs): `src/ClubControl.Server/Services/ClientUpdateFile.cs`
- [Database backup](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Services/DatabaseBackup.cs): `src/ClubControl.Server/Services/DatabaseBackup.cs`
- [Data access](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Data/ClubDbContext.cs): `src/ClubControl.Server/Data/ClubDbContext.cs`
- [Club database](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Server/Data/ClubDbContext.cs): `src/ClubControl.Server/Data/ClubDbContext.cs`

### Gaming PC client

- [Lock controller](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Client/Services/AppController.cs): `src/ClubControl.Client/Services/AppController.cs`
- [Server connection](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Client/Services/ServerConnection.cs): `src/ClubControl.Client/Services/ServerConnection.cs`
- [Client updater](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Client/Services/ClientUpdater.cs): `src/ClubControl.Client/Services/ClientUpdater.cs`
- [Lock screens](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Client/Windows/LockWindow.xaml.cs): `src/ClubControl.Client/Windows/LockWindow.xaml.cs`

### Shared protocol

- [Client commands](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Shared/Dto/ClientCommand.cs): `src/ClubControl.Shared/Dto/ClientCommand.cs`
- [Client settings](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Shared/Dto/ClientSettingsDto.cs): `src/ClubControl.Shared/Dto/ClientSettingsDto.cs`
- [Update verification](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Shared/Security/ClientUpdateAuth.cs): `src/ClubControl.Shared/Security/ClientUpdateAuth.cs`
- [Update script](https://github.com/mypatoff/clubcontrol/blob/main/src/ClubControl.Shared/ClientUpdateScript.cs): `src/ClubControl.Shared/ClientUpdateScript.cs`

### Other components

- **Club staff**

## Connections

- Club staff → Admin panel: operates (evidence: `README.md`)
- Admin panel → Session billing: manages sessions
- Session monitor → Session billing: ticks billing (evidence: `src/ClubControl.Server/Services/SessionMonitorService.cs`)
- Session billing → Data access: reads and writes (evidence: `src/ClubControl.Server/Services/SessionService.cs`)
- Session billing → Client hub: sends commands (evidence: `src/ClubControl.Server/Services/SessionService.cs`)
- Client hub → Server connection: delivers commands
- Server connection → Lock controller: updates state (evidence: `src/ClubControl.Client/Services/AppController.cs`)
- Lock controller → Lock screens: shows lock UI
- Bar page → Bar sales: records sales
- Bar sales → Data access: reads and writes (evidence: `src/ClubControl.Server/Services/BarService.cs`)
- Reports window → Reports: views reports
- Data access → Club database: persists entities (evidence: `src/ClubControl.Server/Data/ClubDbContext.cs`)
- Client updates → Client commands: stages update command
- Server connection → Client updater: routes update
- Client updater → Update verification: verifies package (evidence: `src/ClubControl.Client/Services/ClientUpdater.cs`)
- Client updater → Update script: builds swap script (evidence: `src/ClubControl.Shared/ClientUpdateScript.cs`)
- Session billing → Client commands: builds client payloads (evidence: `src/ClubControl.Server/Services/SessionService.cs`)
- Client commands → Client settings: carries settings (evidence: `src/ClubControl.Shared/Dto/ClientCommand.cs`)
- LAN discovery → Server connection: finds server
- Database backup → Club database: backs up
