# yash5429q/fedrated_collaborative_system architecture

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

- Interactive diagram: https://gitdiagram.com/yash5429q/fedrated_collaborative_system
- Repository: https://github.com/yash5429q/fedrated_collaborative_system

## Overview

CYBER-20 is a federated-learning threat-detection platform: organizations train locally, exchange model updates through a Flower aggregator, and expose threat prediction and operational telemetry through a FastAPI backend and React dashboard. The graph separates federation, inference, API/business data, persistence, and user-facing capabilities. The README documents the high-level HTTP and federated workflow; sampled source confirms client training, inference routing, and round persistence. Some feature endpoints and UI data wiring are unsampled, so their detailed internal links are omitted.

Main entry points: [`backend/client.py`](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/client.py) (Flower client), [`backend/run_experiment.py`](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/run_experiment.py) (Experiment simulation), [`backend/server.py`](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/server.py) (FedAvg aggregator), [`backend/app/ml/inference.py`](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/ml/inference.py) (Prediction inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_federation["Federated training"]
  node_flower_client["Flower client<br/>[client.py]"]
  node_flower_server["FedAvg aggregator<br/>[server.py]"]
  node_experiment_runner["Experiment simulation<br/>[run_experiment.py]"]
end

subgraph group_ml["Threat ML"]
  node_data_partitioning["Data and partitions<br/>[data.py]"]
  node_threatnet["ThreatNet model<br/>[model.py]"]
  node_privacy_controls["Privacy protections<br/>[privacy.py]"]
  node_inference["Prediction inference<br/>[inference.py]"]
end

subgraph group_backend["Backend services"]
  node_api_entry["FastAPI application<br/>[main.py]"]
  node_api_routes["REST endpoints<br/>[router.py]"]
  node_db_business["Dashboard and domain data<br/>[db_data.py]"]
end

subgraph group_storage["Persistence"]
  node_metric_repo["Metric repository<br/>[metric_repo.py]"]
  node_domain_repositories["Domain repositories"]
  node_sql_database[("SQL database<br/>[session.py]")]
  node_training_records["Training and participation records<br/>[training_round.py]"]
end

subgraph group_frontend["Dashboard"]
  node_frontend_routes["Dashboard navigation<br/>[router.tsx]"]
  node_domain_pages["Management pages"]
  node_domain_hooks["Domain data hooks"]
  node_api_client["HTTP API client<br/>[apiClient.ts]"]
end

node_organizations(("Participating organizations"))
node_backend_service(("Backend service"))

node_organizations -->|"train locally"| node_flower_client
node_flower_client -->|"loads partitions"| node_data_partitioning
node_flower_client -->|"trains model"| node_threatnet
node_flower_client -->|"sends updates"| node_flower_server
node_flower_server -->|"persists rounds"| node_training_records
node_flower_server -->|"aggregates updates"| node_organizations
node_experiment_runner -->|"loads data"| node_data_partitioning
node_experiment_runner -->|"runs training"| node_threatnet
node_experiment_runner -->|"applies protections"| node_privacy_controls
node_api_entry -->|"mounts routes"| node_api_routes
node_api_routes -->|"routes prediction"| node_inference
node_inference -->|"uses features"| node_data_partitioning
node_inference -->|"runs model"| node_threatnet
node_api_routes -->|"serves domain data"| node_db_business
node_db_business -->|"reads metrics"| node_metric_repo
node_db_business -->|"queries repositories"| node_domain_repositories
node_metric_repo -.->|"reads records"| node_sql_database
node_domain_repositories -.->|"accesses database"| node_sql_database
node_training_records -->|"maps records"| node_sql_database
node_frontend_routes -->|"routes views"| node_domain_pages
node_domain_pages -.->|"loads domain data"| node_domain_hooks
node_domain_hooks -.->|"fetches data"| node_api_client
node_api_client -->|"sends HTTP requests"| node_backend_service
node_backend_service -->|"serves API"| node_api_entry

click node_flower_client "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/client.py"
click node_flower_server "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/server.py"
click node_experiment_runner "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/run_experiment.py"
click node_data_partitioning "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/ml/data.py"
click node_threatnet "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/ml/model.py"
click node_privacy_controls "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/ml/privacy.py"
click node_inference "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/ml/inference.py"
click node_api_entry "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/main.py"
click node_api_routes "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/api/v1/router.py"
click node_db_business "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/services/db_data.py"
click node_metric_repo "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/repositories/metric_repo.py"
click node_domain_repositories "https://github.com/yash5429q/fedrated_collaborative_system/tree/main/backend/app/repositories"
click node_sql_database "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/database/session.py"
click node_training_records "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/models/training_round.py"
click node_frontend_routes "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/frontend/src/router.tsx"
click node_domain_pages "https://github.com/yash5429q/fedrated_collaborative_system/tree/main/frontend/src/pages"
click node_domain_hooks "https://github.com/yash5429q/fedrated_collaborative_system/tree/main/frontend/src/hooks"
click node_api_client "https://github.com/yash5429q/fedrated_collaborative_system/blob/main/frontend/src/lib/apiClient.ts"

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_flower_client,node_flower_server,node_experiment_runner toneBlue
class node_data_partitioning,node_threatnet,node_privacy_controls,node_inference toneAmber
class node_api_entry,node_api_routes,node_db_business toneMint
class node_metric_repo,node_domain_repositories,node_sql_database,node_training_records toneRose
class node_frontend_routes,node_domain_pages,node_domain_hooks,node_api_client,node_organizations,node_backend_service toneIndigo
```

## Components

### Federated training

- [Flower client](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/client.py): `backend/client.py`
- [FedAvg aggregator](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/server.py): `backend/server.py`
- [Experiment simulation](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/run_experiment.py): `backend/run_experiment.py`

### Threat ML

- [Data and partitions](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/ml/data.py): `backend/app/ml/data.py`
- [ThreatNet model](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/ml/model.py): `backend/app/ml/model.py`
- [Privacy protections](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/ml/privacy.py): `backend/app/ml/privacy.py`
- [Prediction inference](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/ml/inference.py): `backend/app/ml/inference.py`

### Backend services

- [FastAPI application](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/main.py): `backend/app/main.py`
- [REST endpoints](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Dashboard and domain data](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/services/db_data.py): `backend/app/services/db_data.py`

### Persistence

- [Metric repository](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/repositories/metric_repo.py): `backend/app/repositories/metric_repo.py`
- [Domain repositories](https://github.com/yash5429q/fedrated_collaborative_system/tree/main/backend/app/repositories): `backend/app/repositories`
- [SQL database](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/database/session.py): `backend/app/database/session.py`
- [Training and participation records](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/backend/app/models/training_round.py): `backend/app/models/training_round.py`

### Dashboard

- [Dashboard navigation](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/frontend/src/router.tsx): `frontend/src/router.tsx`
- [Management pages](https://github.com/yash5429q/fedrated_collaborative_system/tree/main/frontend/src/pages): `frontend/src/pages`
- [Domain data hooks](https://github.com/yash5429q/fedrated_collaborative_system/tree/main/frontend/src/hooks): `frontend/src/hooks`
- [HTTP API client](https://github.com/yash5429q/fedrated_collaborative_system/blob/main/frontend/src/lib/apiClient.ts): `frontend/src/lib/apiClient.ts`

### Other components

- **Participating organizations**
- **Backend service**

## Connections

- Participating organizations → Flower client: train locally (evidence: `README.md`)
- Flower client → Data and partitions: loads partitions (evidence: `backend/client.py`)
- Flower client → ThreatNet model: trains model (evidence: `backend/client.py`)
- Flower client → FedAvg aggregator: sends updates (evidence: `README.md`)
- FedAvg aggregator → Training and participation records: persists rounds (evidence: `backend/server.py`)
- FedAvg aggregator → Participating organizations: aggregates updates (evidence: `README.md`)
- Experiment simulation → Data and partitions: loads data (evidence: `backend/run_experiment.py`)
- Experiment simulation → ThreatNet model: runs training (evidence: `backend/run_experiment.py`)
- Experiment simulation → Privacy protections: applies protections (evidence: `backend/run_experiment.py`)
- FastAPI application → REST endpoints: mounts routes (evidence: `backend/app/main.py`)
- REST endpoints → Prediction inference: routes prediction (evidence: `backend/app/api/v1/router.py`)
- Prediction inference → Data and partitions: uses features (evidence: `backend/app/ml/inference.py`)
- Prediction inference → ThreatNet model: runs model (evidence: `backend/app/ml/inference.py`)
- REST endpoints → Dashboard and domain data: serves domain data
- Dashboard and domain data → Metric repository: reads metrics (evidence: `backend/app/services/db_data.py`)
- Dashboard and domain data → Domain repositories: queries repositories (evidence: `backend/app/services/db_data.py`)
- Metric repository → SQL database: reads records
- Domain repositories → SQL database: accesses database
- Training and participation records → SQL database: maps records (evidence: `backend/app/models/training_round.py`)
- Dashboard navigation → Management pages: routes views (evidence: `frontend/src/router.tsx`)
- Management pages → Domain data hooks: loads domain data
- Domain data hooks → HTTP API client: fetches data
- HTTP API client → Backend service: sends HTTP requests (evidence: `README.md`)
- Backend service → FastAPI application: serves API (evidence: `README.md`)
