# bubu2001/team_server architecture

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

- Interactive diagram: https://gitdiagram.com/bubu2001/team_server
- Repository: https://github.com/bubu2001/team_server

## Overview

Team Server объединяет веб-интерфейс и JSON API, общее хранилище, консольный обмен Host ⇄ Pi и два способа анализа репозиториев. Основной путь: пользователь загружает проект через сайт, консоль или cryless; сервер сохраняет его и запускает анализ, после чего сайт показывает диаграммы, digest и журнал. README документирует общий обмен через БД и хранилище; внутренние связи unsampled-модулей показаны только там, где их подтверждают индекс импортов или README.

Main entry points: [`app_platform/main.py`](https://github.com/bubu2001/team_server/blob/main/app_platform/main.py) (JSON API сервера), [`src/server/query_processor.py`](https://github.com/bubu2001/team_server/blob/main/src/server/query_processor.py) (Обработка запроса), [`getting_started/core.py`](https://github.com/bubu2001/team_server/blob/main/getting_started/core.py) (Консоль Host Pi), [`app_platform/cryless_api.py`](https://github.com/bubu2001/team_server/blob/main/app_platform/cryless_api.py) (API cryless)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Клиенты и API"]
  node_web_app["Сайт Team Server<br/>[App.tsx]"]
  node_web_api["API-клиент сайта<br/>[api.ts]"]
  node_web_project["Проекты и анализ<br/>[ProjectDetail.tsx]"]
end

subgraph group_team["Team Server"]
  node_app_api["JSON API сервера<br/>[main.py]"]
  node_site_mount["Раздел Gitingest<br/>[site_router.py]"]
  node_team_db[("БД команды<br/>[db.py]")]
  node_team_storage[("Файлы и проекты")]
  node_cryless_api["API cryless<br/>[cryless_api.py]"]
end

subgraph group_analysis["Анализ репозиториев"]
  node_diagram_gen["Диаграммы проекта<br/>[diagram_gen.py]"]
  node_image_gen["PNG-структура<br/>[image_gen.py]"]
  node_static_pipeline["Статический анализ<br/>[pipeline.py]"]
  node_static_ingest["Загрузка репозитория<br/>[ingest.py]"]
  node_static_graph["Граф зависимостей<br/>[depgraph.py]"]
  node_static_model["Модель анализа<br/>[model.py]"]
  node_gitingest_api["API Gitingest<br/>[ingest.py]"]
  node_query_processor["Обработка запроса<br/>[query_processor.py]"]
  node_gitingest_ingestion["Обход файлов<br/>[ingestion.py]"]
  node_ingest_schema["Параметры ingest<br/>[ingestion.py]"]
  node_gitingest_models["Форматы API<br/>[models.py]"]
  node_s3_store[("S3-хранилище digest<br/>[s3_utils.py]")]
end

subgraph group_transfer["Обмен Host Pi"]
  node_console["Консоль Host Pi<br/>[core.py]"]
  node_tcp_protocol["TCP-протокол<br/>[protocol.py]"]
  node_cryless_cli["CLI cryless<br/>[cli.py]"]
  node_cryless_client["HTTP-клиент cryless<br/>[client.py]"]
end

node_browser(("Браузер"))
node_pi_user(("Пользователь Pi"))

node_browser -->|"открывает сайт"| node_web_app
node_web_app -->|"показывает проекты"| node_web_project
node_web_project -->|"запрашивает данные"| node_web_api
node_web_api -->|"вызывает JSON API"| node_app_api
node_app_api -->|"читает и пишет"| node_team_db
node_app_api -->|"сохраняет проекты"| node_team_storage
node_app_api -->|"генерирует диаграммы"| node_diagram_gen
node_app_api -->|"создаёт PNG"| node_image_gen
node_app_api -->|"монтирует раздел"| node_site_mount
node_site_mount -->|"показывает сервис"| node_gitingest_api
node_pi_user -->|"запускает обмен"| node_console
node_console -->|"обменивается сообщениями"| node_tcp_protocol
node_console -->|"передаёт файлы"| node_team_storage
node_console -->|"пишет журнал"| node_team_db
node_pi_user -->|"запускает команды"| node_cryless_cli
node_cryless_cli -->|"использует клиент"| node_cryless_client
node_cryless_client -->|"вызывает HTTP API"| node_cryless_api
node_cryless_api -->|"загружает проект"| node_team_storage
node_cryless_api -->|"журналирует действия"| node_team_db
node_gitingest_api -->|"обрабатывает запрос"| node_query_processor
node_query_processor -->|"разбирает параметры"| node_ingest_schema
node_query_processor -->|"запускает ingest"| node_gitingest_ingestion
node_gitingest_api -->|"валидирует запрос"| node_gitingest_models
node_query_processor -->|"проверяет и сохраняет digest"| node_s3_store
node_static_pipeline -->|"загружает исходники"| node_static_ingest
node_static_pipeline -->|"строит граф"| node_static_graph
node_static_graph -->|"анализирует дерево"| node_static_ingest
node_static_graph -->|"формирует модель"| node_static_model
node_app_api -.->|"анализирует репозитории"| node_static_pipeline

click node_web_app "https://github.com/bubu2001/team_server/blob/main/web/src/App.tsx"
click node_web_api "https://github.com/bubu2001/team_server/blob/main/web/src/api.ts"
click node_web_project "https://github.com/bubu2001/team_server/blob/main/web/src/pages/ProjectDetail.tsx"
click node_app_api "https://github.com/bubu2001/team_server/blob/main/app_platform/main.py"
click node_site_mount "https://github.com/bubu2001/team_server/blob/main/app_platform/site_router.py"
click node_team_db "https://github.com/bubu2001/team_server/blob/main/app_platform/db.py"
click node_team_storage "https://github.com/bubu2001/team_server/tree/main/data"
click node_console "https://github.com/bubu2001/team_server/blob/main/getting_started/core.py"
click node_tcp_protocol "https://github.com/bubu2001/team_server/blob/main/getting_started/protocol.py"
click node_cryless_cli "https://github.com/bubu2001/team_server/blob/main/cryless/src/cryless/cli.py"
click node_cryless_client "https://github.com/bubu2001/team_server/blob/main/cryless/src/cryless/client.py"
click node_cryless_api "https://github.com/bubu2001/team_server/blob/main/app_platform/cryless_api.py"
click node_diagram_gen "https://github.com/bubu2001/team_server/blob/main/app_platform/diagram_gen.py"
click node_image_gen "https://github.com/bubu2001/team_server/blob/main/app_platform/image_gen.py"
click node_static_pipeline "https://github.com/bubu2001/team_server/blob/main/gitdiagram-static/src/staticdiagram/pipeline.py"
click node_static_ingest "https://github.com/bubu2001/team_server/blob/main/gitdiagram-static/src/staticdiagram/ingest.py"
click node_static_graph "https://github.com/bubu2001/team_server/blob/main/gitdiagram-static/src/staticdiagram/depgraph.py"
click node_static_model "https://github.com/bubu2001/team_server/blob/main/gitdiagram-static/src/staticdiagram/model.py"
click node_gitingest_api "https://github.com/bubu2001/team_server/blob/main/src/server/routers/ingest.py"
click node_query_processor "https://github.com/bubu2001/team_server/blob/main/src/server/query_processor.py"
click node_gitingest_ingestion "https://github.com/bubu2001/team_server/blob/main/src/gitingest/ingestion.py"
click node_ingest_schema "https://github.com/bubu2001/team_server/blob/main/src/gitingest/schemas/ingestion.py"
click node_gitingest_models "https://github.com/bubu2001/team_server/blob/main/src/server/models.py"
click node_s3_store "https://github.com/bubu2001/team_server/blob/main/src/server/s3_utils.py"

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_app,node_web_api,node_web_project toneBlue
class node_app_api,node_site_mount,node_team_db,node_team_storage,node_cryless_api toneAmber
class node_diagram_gen,node_image_gen,node_static_pipeline,node_static_ingest,node_static_graph,node_static_model,node_gitingest_api,node_query_processor,node_gitingest_ingestion,node_ingest_schema,node_gitingest_models,node_s3_store toneMint
class node_console,node_tcp_protocol,node_cryless_cli,node_cryless_client toneRose
class node_browser,node_pi_user toneIndigo
```

## Components

### Клиенты и API

- [Сайт Team Server](https://github.com/bubu2001/team_server/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [API-клиент сайта](https://github.com/bubu2001/team_server/blob/main/web/src/api.ts): `web/src/api.ts`
- [Проекты и анализ](https://github.com/bubu2001/team_server/blob/main/web/src/pages/ProjectDetail.tsx): `web/src/pages/ProjectDetail.tsx`

### Team Server

- [JSON API сервера](https://github.com/bubu2001/team_server/blob/main/app_platform/main.py): `app_platform/main.py`
- [Раздел Gitingest](https://github.com/bubu2001/team_server/blob/main/app_platform/site_router.py): `app_platform/site_router.py`
- [БД команды](https://github.com/bubu2001/team_server/blob/main/app_platform/db.py): `app_platform/db.py`
- [Файлы и проекты](https://github.com/bubu2001/team_server/tree/main/data): `data`
- [API cryless](https://github.com/bubu2001/team_server/blob/main/app_platform/cryless_api.py): `app_platform/cryless_api.py`

### Анализ репозиториев

- [Диаграммы проекта](https://github.com/bubu2001/team_server/blob/main/app_platform/diagram_gen.py): `app_platform/diagram_gen.py`
- [PNG-структура](https://github.com/bubu2001/team_server/blob/main/app_platform/image_gen.py): `app_platform/image_gen.py`
- [Статический анализ](https://github.com/bubu2001/team_server/blob/main/gitdiagram-static/src/staticdiagram/pipeline.py): `gitdiagram-static/src/staticdiagram/pipeline.py`
- [Загрузка репозитория](https://github.com/bubu2001/team_server/blob/main/gitdiagram-static/src/staticdiagram/ingest.py): `gitdiagram-static/src/staticdiagram/ingest.py`
- [Граф зависимостей](https://github.com/bubu2001/team_server/blob/main/gitdiagram-static/src/staticdiagram/depgraph.py): `gitdiagram-static/src/staticdiagram/depgraph.py`
- [Модель анализа](https://github.com/bubu2001/team_server/blob/main/gitdiagram-static/src/staticdiagram/model.py): `gitdiagram-static/src/staticdiagram/model.py`
- [API Gitingest](https://github.com/bubu2001/team_server/blob/main/src/server/routers/ingest.py): `src/server/routers/ingest.py`
- [Обработка запроса](https://github.com/bubu2001/team_server/blob/main/src/server/query_processor.py): `src/server/query_processor.py`
- [Обход файлов](https://github.com/bubu2001/team_server/blob/main/src/gitingest/ingestion.py): `src/gitingest/ingestion.py`
- [Параметры ingest](https://github.com/bubu2001/team_server/blob/main/src/gitingest/schemas/ingestion.py): `src/gitingest/schemas/ingestion.py`
- [Форматы API](https://github.com/bubu2001/team_server/blob/main/src/server/models.py): `src/server/models.py`
- [S3-хранилище digest](https://github.com/bubu2001/team_server/blob/main/src/server/s3_utils.py): `src/server/s3_utils.py`

### Обмен Host Pi

- [Консоль Host Pi](https://github.com/bubu2001/team_server/blob/main/getting_started/core.py): `getting_started/core.py`
- [TCP-протокол](https://github.com/bubu2001/team_server/blob/main/getting_started/protocol.py): `getting_started/protocol.py`
- [CLI cryless](https://github.com/bubu2001/team_server/blob/main/cryless/src/cryless/cli.py): `cryless/src/cryless/cli.py`
- [HTTP-клиент cryless](https://github.com/bubu2001/team_server/blob/main/cryless/src/cryless/client.py): `cryless/src/cryless/client.py`

### Other components

- **Браузер**
- **Пользователь Pi**

## Connections

- Браузер → Сайт Team Server: открывает сайт
- Сайт Team Server → Проекты и анализ: показывает проекты (evidence: `web/src/App.tsx`)
- Проекты и анализ → API-клиент сайта: запрашивает данные (evidence: `web/src/pages/ProjectDetail.tsx`)
- API-клиент сайта → JSON API сервера: вызывает JSON API
- JSON API сервера → БД команды: читает и пишет (evidence: `app_platform/main.py`)
- JSON API сервера → Файлы и проекты: сохраняет проекты
- JSON API сервера → Диаграммы проекта: генерирует диаграммы (evidence: `app_platform/main.py`)
- JSON API сервера → PNG-структура: создаёт PNG (evidence: `app_platform/main.py`)
- JSON API сервера → Раздел Gitingest: монтирует раздел (evidence: `app_platform/main.py`)
- Раздел Gitingest → API Gitingest: показывает сервис
- Пользователь Pi → Консоль Host Pi: запускает обмен
- Консоль Host Pi → TCP-протокол: обменивается сообщениями (evidence: `getting_started/core.py`)
- Консоль Host Pi → Файлы и проекты: передаёт файлы
- Консоль Host Pi → БД команды: пишет журнал (evidence: `getting_started/core.py`)
- Пользователь Pi → CLI cryless: запускает команды
- CLI cryless → HTTP-клиент cryless: использует клиент (evidence: `cryless/src/cryless/client.py`)
- HTTP-клиент cryless → API cryless: вызывает HTTP API
- API cryless → Файлы и проекты: загружает проект
- API cryless → БД команды: журналирует действия
- API Gitingest → Обработка запроса: обрабатывает запрос (evidence: `src/server/routers/ingest.py`)
- Обработка запроса → Параметры ingest: разбирает параметры (evidence: `src/server/query_processor.py`)
- Обработка запроса → Обход файлов: запускает ingest (evidence: `src/server/query_processor.py`)
- API Gitingest → Форматы API: валидирует запрос (evidence: `src/server/routers/ingest.py`)
- Обработка запроса → S3-хранилище digest: проверяет и сохраняет digest (evidence: `src/server/query_processor.py`)
- Статический анализ → Загрузка репозитория: загружает исходники (evidence: `gitdiagram-static/src/staticdiagram/pipeline.py`)
- Статический анализ → Граф зависимостей: строит граф (evidence: `gitdiagram-static/src/staticdiagram/pipeline.py`)
- Граф зависимостей → Загрузка репозитория: анализирует дерево (evidence: `gitdiagram-static/src/staticdiagram/depgraph.py`)
- Граф зависимостей → Модель анализа: формирует модель (evidence: `gitdiagram-static/src/staticdiagram/depgraph.py`)
- JSON API сервера → Статический анализ: анализирует репозитории
