# kostya12rus/steam_work_example architecture

> Architecture diagram of the GitHub repository kostya12rus/steam_work_example, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kostya12rus/steam_work_example
- Repository: https://github.com/kostya12rus/steam_work_example

## Overview

##### Project type and purpose
- This is a desktop GUI application written in Python (using Flet) for managing Steam inventory operations (trading, selling, monitoring offers).
- It includes helper scripts in Node.js for Steam authentication (QR code, login/password, 2FA).

##### File structure
Top‑level directories / files:
- app/ → the main package
– main.py → application entry point
– core/manager_class → business‑logic classes (account, app details)
– database/ → config manager + SQLite manager + “cyber_safe” checks
– logger/ → logging configuration
– callback/ → Flet callback handlers
– package/ → two submodules:
· data_collectors/ → Python modules calling Steam Web APIs
· steam_session/ → Node.js scripts & package.json for auth flows
– ui/ → Flet UI layer: main_page, pages, widgets
- requirements/ → pip requirements
- setup.py, start.bat, update_install.bat
- tests/ → unit tests for callbacks and manager classes
- user_pages/ → sample user‑defined page

##### README for additional insights
- Confirms Python 3.10+, Node.js for auth, Git for source control
- Describes installation & runtime scripts (update_install.bat, start.bat)
- Highlights multi‑method Steam authentication and Flet auto‑install

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Presentation Layer
  subgraph "UI Layer" 
    direction TB
    UI_Main["Main Page"]:::frontend
    UI_Pages["Pages"]:::frontend
    UI_Widgets["Widgets"]:::frontend
  end

  subgraph "Callback Handlers"
    direction TB
    Callbacks["callbacks.py"]:::frontend
  end

  %% Business Logic Layer
  subgraph "Business Logic" 
    direction TB
    AccountMgr["account_class.py"]:::business
    AppDetailsMgr["app_details_class.py"]:::business
  end

  %% Data Collection Layer
  subgraph "Data Collection (Python)" 
    direction TB
    Collector1["cs_coplay_players.py"]:::data
    Collector2["cs_matchmaking_stats.py"]:::data
    Collector3["cs_profile_time.py"]:::data
    Collector4["steam_api_utility.py"]:::data
    Collector5["steam_id_from_url.py"]:::data
    Collector6["steam_mini_profile_info.py"]:::data
    Collector7["steam_profile_info.py"]:::data
  end

  subgraph "Steam Session Service (Node.js)"
    direction TB
    QRCode["session_qrcode.js"]:::data
    LoginPwd["session_login_password.js"]:::data
    RefreshToken["session_refresh_token.js"]:::data
    SessionMgr["manager_session.py"]:::data
    InstallScript["update_or_install.py"]:::data
    PackageJSON["package.json"]:::data
  end

  %% Persistence Layer
  subgraph "Persistence Layer"
    direction TB
    SQLite["sqlite_manager.py"]:::persistence
    ConfigMgr["config_manager.py"]:::persistence
    CyberSafe["cyber_safe.py"]:::persistence
  end

  %% Infrastructure / Support
  subgraph "Infrastructure"
    direction TB
    Logger["config.py"]:::infra
    EntryPoint["main.py"]:::infra
    StartScript["start.bat"]:::infra
    UpdateScript["update_install.bat"]:::infra
    Setup["setup.py"]:::infra
    Requirements["base.txt"]:::infra
  end

  %% User Extensions
  UserPages["page_example.py"]:::frontend

  %% External Systems
  subgraph "External Systems"
    direction TB
    SteamAPI["Steam Web API"]:::external
    SteamAuth["Steam Auth Endpoints"]:::external
  end

  %% Connections
  UI_Main -->|click| Callbacks
  UI_Pages -->|click| Callbacks
  UI_Widgets -->|click| Callbacks

  Callbacks -->|"invoke"| AccountMgr
  Callbacks -->|"invoke"| AppDetailsMgr

  AccountMgr -->|uses| Collector1
  AccountMgr -->|uses| Collector2
  AccountMgr -->|uses| Collector3
  AccountMgr -->|uses| Collector4
  AccountMgr -->|uses| Collector5
  AccountMgr -->|uses| Collector6
  AccountMgr -->|uses| Collector7

  AppDetailsMgr -->|uses| Collector4
  AppDetailsMgr -->|uses| Collector7

  AccountMgr -->|calls| SessionMgr
  AppDetailsMgr -->|calls| SessionMgr

  SessionMgr -->|executes| QRCode
  SessionMgr -->|executes| LoginPwd
  SessionMgr -->|executes| RefreshToken
  SessionMgr -->|executes| InstallScript
  SessionMgr -->|reads| PackageJSON

  Collector1 -->|fetch| SteamAPI
  Collector2 -->|fetch| SteamAPI
  Collector3 -->|fetch| SteamAPI
  Collector4 -->|util| SteamAPI
  Collector5 -->|util| SteamAPI
  Collector6 -->|util| SteamAPI
  Collector7 -->|util| SteamAPI

  QRCode -->|auth| SteamAuth
  LoginPwd -->|auth| SteamAuth
  RefreshToken -->|auth| SteamAuth

  AccountMgr -->|read/write| SQLite
  AccountMgr -->|read/write| ConfigMgr
  AccountMgr -->|check| CyberSafe

  AppDetailsMgr -->|read/write| SQLite
  AppDetailsMgr -->|read/write| ConfigMgr
  AppDetailsMgr -->|check| CyberSafe

  SQLite --- CyberSafe
  ConfigMgr --- CyberSafe

  AccountMgr -->|returns data| Callbacks
  AppDetailsMgr -->|returns data| Callbacks
  Callbacks -->|update| UI_Main
  Callbacks -->|update| UI_Pages
  Callbacks -->|update| UI_Widgets

  EntryPoint -->|launches| UI_Main
  StartScript -->|runs| EntryPoint
  UpdateScript -->|installs dependencies| Requirements
  UpdateScript -->|runs| EntryPoint
  Setup -->|configures| Requirements

  Logger -->|logs| UI_Main
  Logger -->|logs| Callbacks
  Logger -->|logs| AccountMgr
  Logger -->|logs| AppDetailsMgr
  Logger -->|logs| Collector1
  Logger -->|logs| SessionMgr
  Logger -->|logs| SQLite

  UserPages -->|extension| UI_Pages

  %% Click Events
  click UI_Main "https://github.com/kostya12rus/steam_work_example/blob/main/app/ui/main_page.py"
  click UI_Pages "https://github.com/kostya12rus/steam_work_example/tree/main/app/ui/pages/"
  click UI_Widgets "https://github.com/kostya12rus/steam_work_example/tree/main/app/ui/widgets/"
  click Callbacks "https://github.com/kostya12rus/steam_work_example/blob/main/app/callback/callbacks.py"
  click AccountMgr "https://github.com/kostya12rus/steam_work_example/blob/main/app/core/manager_class/account_class.py"
  click AppDetailsMgr "https://github.com/kostya12rus/steam_work_example/blob/main/app/core/manager_class/app_details_class.py"
  click Collector1 "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/data_collectors/cs_coplay_players.py"
  click Collector2 "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/data_collectors/cs_matchmaking_stats.py"
  click Collector3 "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/data_collectors/cs_profile_time.py"
  click Collector4 "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/data_collectors/steam_api_utility.py"
  click Collector5 "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/data_collectors/steam_id_from_url.py"
  click Collector6 "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/data_collectors/steam_mini_profile_info.py"
  click Collector7 "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/data_collectors/steam_profile_info.py"
  click QRCode "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/steam_session/session_qrcode.js"
  click LoginPwd "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/steam_session/session_login_password.js"
  click RefreshToken "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/steam_session/session_refresh_token.js"
  click SessionMgr "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/steam_session/manager_session.py"
  click InstallScript "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/steam_session/update_or_install.py"
  click PackageJSON "https://github.com/kostya12rus/steam_work_example/blob/main/app/package/steam_session/package.json"
  click SQLite "https://github.com/kostya12rus/steam_work_example/blob/main/app/database/sqlite_manager.py"
  click ConfigMgr "https://github.com/kostya12rus/steam_work_example/blob/main/app/database/config_manager.py"
  click CyberSafe "https://github.com/kostya12rus/steam_work_example/blob/main/app/database/cyber_safe.py"
  click Logger "https://github.com/kostya12rus/steam_work_example/blob/main/app/logger/config.py"
  click EntryPoint "https://github.com/kostya12rus/steam_work_example/blob/main/app/main.py"
  click StartScript "https://github.com/kostya12rus/steam_work_example/blob/main/start.bat"
  click UpdateScript "https://github.com/kostya12rus/steam_work_example/blob/main/update_install.bat"
  click Setup "https://github.com/kostya12rus/steam_work_example/blob/main/setup.py"
  click Requirements "https://github.com/kostya12rus/steam_work_example/blob/main/requirements/base.txt"
  click UserPages "https://github.com/kostya12rus/steam_work_example/blob/main/user_pages/page_example.py"

  %% Styles
  classDef frontend fill:#D0E6FF,stroke:#0366D6,color:#0366D6
  classDef business fill:#E6F5D0,stroke:#3C763D,color:#3C763D
  classDef data fill:#FFE6D0,stroke:#D2691E,color:#D2691E
  classDef persistence fill:#FFF0B3,stroke:#B8860B,color:#B8860B
  classDef infra fill:#E0E0E0,stroke:#666666,color:#333333
  classDef external fill:#FFD6D6,stroke:#D32F2F,color:#D32F2F
```
