# ashish070patel/cross-platform-hardening architecture

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

- Interactive diagram: https://gitdiagram.com/ashish070patel/cross-platform-hardening
- Repository: https://github.com/ashish070patel/cross-platform-hardening

## Overview

Cross-Platform Hardening is an endpoint-security monitoring and advisory platform: a Python agent registers a device, gathers security signals, and periodically uploads reports; the Express API stores reports and synchronizes alerts, while a React dashboard presents device, security, and alert views. Users can request Gemini assessments of the latest report and inspect saved analysis history. The graph combines sampled calls, SOURCE INDEX references, and documented capabilities; unsampled subsystem links are included only where the README establishes them.

Main entry points: [`backend/app/app.js`](https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/app/app.js) (Express routing), [`frontend/src/services/api.js`](https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/services/api.js) (Web API client), [`agent/agent.py`](https://github.com/ashish070patel/cross-platform-hardening/blob/main/agent/agent.py) (Monitoring loop), [`frontend/src/App.jsx`](https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/App.jsx) (Dashboard routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_monitoring["Endpoint monitoring"]
  node_agent_loop["Monitoring loop<br/>[agent.py]"]
  node_agent_config["Agent configuration<br/>[config.py]"]
  node_host_checks["Security checks<br/>[security_checks.py]"]
  node_host_info["Device metadata<br/>[system_info.py]"]
  node_agent_http["Agent API client<br/>[api_client.py]"]
end

subgraph group_api["Backend API"]
  node_express_app["Express routing<br/>[app.js]"]
  node_agent_api["Agent endpoints<br/>[agentController.js]"]
  node_report_api["Security reports"]
  node_alerts_api["Alert endpoints<br/>[alertController.js]"]
  node_ai_api["AI endpoints<br/>[aiController.js]"]
end

subgraph group_data_ai["Persistence and assessment"]
  node_agent_service["Agent records<br/>[agentService.js]"]
  node_security_service["Report service<br/>[securityService.js]"]
  node_alert_service["Alert synchronization<br/>[alertService.js]"]
  node_ai_service["Gemini assessment<br/>[aiService.js]"]
  node_mongo[("MongoDB")]
end

subgraph group_dashboard["Web dashboard"]
  node_web_app["Dashboard routes<br/>[App.jsx]"]
  node_api_client["Web API client<br/>[api.js]"]
  node_dashboard_page["Dashboard view<br/>[Dashboard.jsx]"]
  node_devices_page["Devices view<br/>[Devices.jsx]"]
  node_security_page["Security view<br/>[Security.jsx]"]
  node_alerts_page["Alerts view<br/>[Alerts.jsx]"]
  node_ai_panel["Analysis history UI"]
  node_port_utils["Port classification"]
end

node_operator(("Security operator"))
node_host(("Monitored endpoint"))
node_gemini{{"Gemini API"}}

node_host -->|"runs on"| node_agent_loop
node_agent_loop -->|"loads settings"| node_agent_config
node_agent_loop -->|"collects signals"| node_host_checks
node_agent_loop -->|"collects metadata"| node_host_info
node_agent_loop -->|"uploads reports"| node_agent_http
node_agent_http -->|"HTTP requests"| node_express_app
node_express_app -->|"routes agent calls"| node_agent_api
node_express_app -->|"routes report calls"| node_report_api
node_express_app -->|"routes alert calls"| node_alerts_api
node_express_app -->|"routes analysis calls"| node_ai_api
node_agent_api -->|"delegates records"| node_agent_service
node_agent_service -->|"reads and writes"| node_mongo
node_report_api -->|"saves and reads"| node_security_service
node_report_api -->|"synchronizes alerts"| node_alert_service
node_security_service -->|"stores reports"| node_mongo
node_alert_service -->|"stores alerts"| node_mongo
node_alerts_api -->|"retrieves alerts"| node_alert_service
node_ai_api -->|"requests assessment"| node_ai_service
node_ai_api -->|"reads reports and saves analyses"| node_mongo
node_ai_service -->|"requests assessment"| node_gemini
node_ai_service -->|"saves analysis"| node_mongo
node_operator -->|"uses dashboard"| node_web_app
node_web_app -->|"routes to"| node_dashboard_page
node_web_app -->|"routes to"| node_devices_page
node_web_app -->|"routes to"| node_security_page
node_web_app -->|"routes to"| node_alerts_page
node_dashboard_page -->|"fetches dashboard data"| node_api_client
node_devices_page -->|"fetches devices"| node_api_client
node_security_page -->|"fetches security data"| node_api_client
node_security_page -->|"renders analysis UI"| node_ai_panel
node_security_page -->|"classifies ports"| node_port_utils
node_ai_panel -->|"requests analysis and history"| node_api_client
node_alerts_page -->|"fetches alerts"| node_api_client
node_api_client -->|"HTTP requests"| node_express_app

click node_agent_loop "https://github.com/ashish070patel/cross-platform-hardening/blob/main/agent/agent.py"
click node_agent_config "https://github.com/ashish070patel/cross-platform-hardening/blob/main/agent/config.py"
click node_host_checks "https://github.com/ashish070patel/cross-platform-hardening/blob/main/agent/security_checks.py"
click node_host_info "https://github.com/ashish070patel/cross-platform-hardening/blob/main/agent/system_info.py"
click node_agent_http "https://github.com/ashish070patel/cross-platform-hardening/blob/main/agent/api_client.py"
click node_express_app "https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/app/app.js"
click node_agent_api "https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/controllers/agentController.js"
click node_report_api "https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/controllers/securityController.js"
click node_alerts_api "https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/controllers/alertController.js"
click node_ai_api "https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/controllers/aiController.js"
click node_agent_service "https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/services/agentService.js"
click node_security_service "https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/services/securityService.js"
click node_alert_service "https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/services/alertService.js"
click node_ai_service "https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/services/aiService.js"
click node_web_app "https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/services/api.js"
click node_dashboard_page "https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/pages/Dashboard.jsx"
click node_devices_page "https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/pages/Devices.jsx"
click node_security_page "https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/pages/Security.jsx"
click node_alerts_page "https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/pages/Alerts.jsx"
click node_ai_panel "https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/components/AISecurityAnalysis.jsx"
click node_port_utils "https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/utils/portClassification.js"

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_agent_loop,node_agent_config,node_host_checks,node_host_info,node_agent_http toneBlue
class node_express_app,node_agent_api,node_report_api,node_alerts_api,node_ai_api toneAmber
class node_agent_service,node_security_service,node_alert_service,node_ai_service,node_mongo,node_gemini toneMint
class node_web_app,node_api_client,node_dashboard_page,node_devices_page,node_security_page,node_alerts_page,node_ai_panel,node_port_utils toneRose
class node_operator,node_host toneIndigo
```

## Components

### Endpoint monitoring

- [Monitoring loop](https://github.com/ashish070patel/cross-platform-hardening/blob/main/agent/agent.py): `agent/agent.py`
- [Agent configuration](https://github.com/ashish070patel/cross-platform-hardening/blob/main/agent/config.py): `agent/config.py`
- [Security checks](https://github.com/ashish070patel/cross-platform-hardening/blob/main/agent/security_checks.py): `agent/security_checks.py`
- [Device metadata](https://github.com/ashish070patel/cross-platform-hardening/blob/main/agent/system_info.py): `agent/system_info.py`
- [Agent API client](https://github.com/ashish070patel/cross-platform-hardening/blob/main/agent/api_client.py): `agent/api_client.py`

### Backend API

- [Express routing](https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/app/app.js): `backend/app/app.js`
- [Agent endpoints](https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/controllers/agentController.js): `backend/controllers/agentController.js`
- [Security reports](https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/controllers/securityController.js): `backend/controllers/securityController.js`
- [Alert endpoints](https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/controllers/alertController.js): `backend/controllers/alertController.js`
- [AI endpoints](https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/controllers/aiController.js): `backend/controllers/aiController.js`

### Persistence and assessment

- [Agent records](https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/services/agentService.js): `backend/services/agentService.js`
- [Report service](https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/services/securityService.js): `backend/services/securityService.js`
- [Alert synchronization](https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/services/alertService.js): `backend/services/alertService.js`
- [Gemini assessment](https://github.com/ashish070patel/cross-platform-hardening/blob/main/backend/services/aiService.js): `backend/services/aiService.js`
- **MongoDB**

### Web dashboard

- [Dashboard routes](https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Web API client](https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Dashboard view](https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Devices view](https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/pages/Devices.jsx): `frontend/src/pages/Devices.jsx`
- [Security view](https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/pages/Security.jsx): `frontend/src/pages/Security.jsx`
- [Alerts view](https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/pages/Alerts.jsx): `frontend/src/pages/Alerts.jsx`
- [Analysis history UI](https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/components/AISecurityAnalysis.jsx): `frontend/src/components/AISecurityAnalysis.jsx`
- [Port classification](https://github.com/ashish070patel/cross-platform-hardening/blob/main/frontend/src/utils/portClassification.js): `frontend/src/utils/portClassification.js`

### Other components

- **Security operator**
- **Monitored endpoint**
- **Gemini API**

## Connections

- Monitored endpoint → Monitoring loop: runs on (evidence: `README.md`)
- Monitoring loop → Agent configuration: loads settings (evidence: `agent/agent.py`)
- Monitoring loop → Security checks: collects signals (evidence: `agent/agent.py`)
- Monitoring loop → Device metadata: collects metadata (evidence: `agent/agent.py`)
- Monitoring loop → Agent API client: uploads reports (evidence: `agent/agent.py`)
- Agent API client → Express routing: HTTP requests (evidence: `README.md`)
- Express routing → Agent endpoints: routes agent calls (evidence: `backend/app/app.js`)
- Express routing → Security reports: routes report calls (evidence: `backend/app/app.js`)
- Express routing → Alert endpoints: routes alert calls (evidence: `backend/app/app.js`)
- Express routing → AI endpoints: routes analysis calls (evidence: `backend/app/app.js`)
- Agent endpoints → Agent records: delegates records (evidence: `backend/controllers/agentController.js`)
- Agent records → MongoDB: reads and writes (evidence: `README.md`)
- Security reports → Report service: saves and reads (evidence: `backend/controllers/securityController.js`)
- Security reports → Alert synchronization: synchronizes alerts (evidence: `backend/controllers/securityController.js`)
- Report service → MongoDB: stores reports (evidence: `backend/services/securityService.js`)
- Alert synchronization → MongoDB: stores alerts (evidence: `backend/services/alertService.js`)
- Alert endpoints → Alert synchronization: retrieves alerts (evidence: `backend/controllers/alertController.js`)
- AI endpoints → Gemini assessment: requests assessment (evidence: `backend/controllers/aiController.js`)
- AI endpoints → MongoDB: reads reports and saves analyses (evidence: `backend/controllers/aiController.js`)
- Gemini assessment → Gemini API: requests assessment (evidence: `README.md`)
- Gemini assessment → MongoDB: saves analysis (evidence: `README.md`)
- Security operator → Dashboard routes: uses dashboard (evidence: `README.md`)
- Dashboard routes → Dashboard view: routes to (evidence: `frontend/src/App.jsx`)
- Dashboard routes → Devices view: routes to (evidence: `frontend/src/App.jsx`)
- Dashboard routes → Security view: routes to (evidence: `frontend/src/App.jsx`)
- Dashboard routes → Alerts view: routes to (evidence: `frontend/src/App.jsx`)
- Dashboard view → Web API client: fetches dashboard data (evidence: `frontend/src/pages/Dashboard.jsx`)
- Devices view → Web API client: fetches devices (evidence: `frontend/src/pages/Devices.jsx`)
- Security view → Web API client: fetches security data (evidence: `frontend/src/pages/Security.jsx`)
- Security view → Analysis history UI: renders analysis UI (evidence: `frontend/src/pages/Security.jsx`)
- Security view → Port classification: classifies ports (evidence: `frontend/src/pages/Security.jsx`)
- Analysis history UI → Web API client: requests analysis and history (evidence: `frontend/src/components/AISecurityAnalysis.jsx`)
- Alerts view → Web API client: fetches alerts (evidence: `frontend/src/pages/Alerts.jsx`)
- Web API client → Express routing: HTTP requests (evidence: `README.md`)
