# alikhaled01/client_server_desktopapplication architecture

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

- Interactive diagram: https://gitdiagram.com/alikhaled01/client_server_desktopapplication
- Repository: https://github.com/alikhaled01/client_server_desktopapplication

## Overview

This is a desktop book-inventory and purchasing application: users create accounts or log in, browse books, add items to a cart, check balance, deposit funds, and purchase; an operator can add books and view active-client counts. The client and server exchange length-prefixed JSON over TCP, and the server persists users, books, and purchases in SQLite. The README is empty, and the server excerpt omits parts of request dispatch and purchase logic, so uncertain links are left out or marked unverified.

Main entry points: [`Server Side/serverGUI.py`](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py) (Request Handler), [`Server Side/books.db`](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/books.db) (Book Database), [`Client Side/main.py`](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Client%20Side/main.py) (Account Screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Desktop Client"]
  node_client_auth["Account Screens<br/>[main.py]"]
  node_client_shop["Shop Screens<br/>[main.py]"]
end

subgraph group_server["TCP Server"]
  node_tcp_router["Request Handler<br/>[serverGUI.py]"]
end

subgraph group_features["Commerce Features"]
  node_account["Accounts<br/>[serverGUI.py]"]
  node_catalog["Book Catalog<br/>[serverGUI.py]"]
  node_cart["Cart<br/>[serverGUI.py]"]
  node_purchases["Purchasing<br/>[serverGUI.py]"]
  node_balance["Balance<br/>[serverGUI.py]"]
  node_admin["Admin Tools<br/>[serverGUI.py]"]
end

subgraph group_storage["Persistent State"]
  node_database[("Book Database<br/>[books.db]")]
end

node_shopper(("Shopper"))
node_operator(("Operator"))

node_shopper -->|"uses"| node_client_auth
node_shopper -->|"uses"| node_client_shop
node_operator -->|"uses"| node_admin
node_client_auth -.->|"sends JSON"| node_tcp_router
node_client_shop -->|"sends JSON"| node_tcp_router
node_tcp_router -.->|"dispatches"| node_account
node_tcp_router -->|"dispatches"| node_catalog
node_tcp_router -->|"dispatches"| node_cart
node_tcp_router -->|"dispatches"| node_purchases
node_tcp_router -->|"dispatches"| node_balance
node_account -->|"reads/writes"| node_database
node_catalog -->|"reads/writes"| node_database
node_cart -->|"reads/writes"| node_database
node_purchases -->|"reads/writes"| node_database
node_balance -->|"reads/writes"| node_database
node_admin -->|"adds books"| node_catalog
node_admin -->|"reports clients"| node_tcp_router

click node_client_auth "https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Client%20Side/main.py"
click node_client_shop "https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Client%20Side/main.py"
click node_tcp_router "https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py"
click node_account "https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py"
click node_catalog "https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py"
click node_cart "https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py"
click node_purchases "https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py"
click node_balance "https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py"
click node_admin "https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py"
click node_database "https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/books.db"

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_client_auth,node_client_shop toneBlue
class node_tcp_router toneAmber
class node_account,node_catalog,node_cart,node_purchases,node_balance,node_admin toneMint
class node_database toneRose
class node_shopper,node_operator toneIndigo
```

## Components

### Desktop Client

- [Account Screens](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Client%20Side/main.py): `Client Side/main.py`
- [Shop Screens](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Client%20Side/main.py): `Client Side/main.py`

### TCP Server

- [Request Handler](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py): `Server Side/serverGUI.py`

### Commerce Features

- [Accounts](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py): `Server Side/serverGUI.py`
- [Book Catalog](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py): `Server Side/serverGUI.py`
- [Cart](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py): `Server Side/serverGUI.py`
- [Purchasing](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py): `Server Side/serverGUI.py`
- [Balance](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py): `Server Side/serverGUI.py`
- [Admin Tools](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/serverGUI.py): `Server Side/serverGUI.py`

### Persistent State

- [Book Database](https://github.com/alikhaled01/client_server_desktopapplication/blob/master/Server%20Side/books.db): `Server Side/books.db`

### Other components

- **Shopper**
- **Operator**

## Connections

- Shopper → Account Screens: uses (evidence: `Client Side/main.py`)
- Shopper → Shop Screens: uses (evidence: `Client Side/main.py`)
- Operator → Admin Tools: uses (evidence: `Server Side/serverGUI.py`)
- Account Screens → Request Handler: sends JSON
- Shop Screens → Request Handler: sends JSON (evidence: `Client Side/main.py`)
- Request Handler → Accounts: dispatches (evidence: `Server Side/serverGUI.py`)
- Request Handler → Book Catalog: dispatches (evidence: `Server Side/serverGUI.py`)
- Request Handler → Cart: dispatches (evidence: `Server Side/serverGUI.py`)
- Request Handler → Purchasing: dispatches (evidence: `Server Side/serverGUI.py`)
- Request Handler → Balance: dispatches (evidence: `Server Side/serverGUI.py`)
- Accounts → Book Database: reads/writes (evidence: `Server Side/serverGUI.py`)
- Book Catalog → Book Database: reads/writes (evidence: `Server Side/serverGUI.py`)
- Cart → Book Database: reads/writes (evidence: `Server Side/serverGUI.py`)
- Purchasing → Book Database: reads/writes (evidence: `Server Side/serverGUI.py`)
- Balance → Book Database: reads/writes (evidence: `Server Side/serverGUI.py`)
- Admin Tools → Book Catalog: adds books (evidence: `Server Side/serverGUI.py`)
- Admin Tools → Request Handler: reports clients (evidence: `Server Side/serverGUI.py`)
