How anshgupta517/system-diagnostics-app works
What this project is (type + purpose)
From the tree, this is a full-stack “system diagnostics” web app:
• Frontend: frontend/ is a React + Vite SPA (components, charts, src/services/api.js for backend calls).
• Backend: backend/ is a Python API/service that:
• collects machine metrics via “collectors” (cpu.py, memory.py, process.py)
• contains an LLM integration (llm_service.py) and a tool routing layer (tool_router.py) that likely decides when to call collectors vs. answer directly via LLM
• The app’s core value: view system status + ask questions / request diagnostics, potentially with LLM-assisted interpretation.
Given the presence of collectors/ + llm_service.py + tool_router.py, the architecture is not just “dashboard”; it’s “dashboard + intelligent assistant that can call tools to fetch live system state”.
Frontend (frontend/src/)
• App.jsx, main.jsx: application entry + composition root
• components/
• SystemStatus.jsx: likely the main metrics panel
• DataVisualizer.jsx: orchestrates chart rendering
• InputBox.jsx, MessageBubble.jsx: implies a chat-like UI
• components/charts/ (CpuChart.jsx, MemoryChart.jsx, ProcessChart.jsx): explicit visualization modules
Backend (backend/)
• main.py: likely the API server entrypoint (FastAPI/Flask). Treat this as the API surface.
• collectors/: system data acquisition layer (calls OS APIs / psutil-like libraries)
• tool_router.py: orchestration between LLM and collectors (tool selection / dispatch)
• llm_service.py: integration to external LLM provider (OpenAI, local model, etc.)
• requirements.txt: confirms this is a deployable Python service with explicit dependencies
Frontend SPA (React/Vite)
• key submodules: UI components + Charts + api.js
Backend Python API Service
• API endpoints (in main.py)
• orchestration (tool_router.py)
• system collectors (collectors/*.py)
• LLM integration (llm_service.py)
Host Operating System
• source of CPU/memory/process metrics (what collectors read)
External LLM Provider
• network dependency used by llm_service.py
Metrics/Status flow (dashboard)
• Browser → React UI (SystemStatus, charts)
• React UI → src/services/api.js
• api.js → Backend API (main.py) via HTTP (REST-style is most likely)
• Backend (main.py) → collectors/* (CPU, memory, process)
• Collectors → OS (read system stats)
• Response returns back:
• Backend → Frontend → Charts render
“Ask diagnostics” / chat + LLM tool calling
• Browser → React chat UI (InputBox, MessageBubble)
• React → api.js → Backend API (main.py)
• Backend → tool_router.py
• tool_router.py decides:
• call llm_service.py (LLM completion)
• and/or call collectors as “tools” to fetch live data
• llm_service.py → External LLM Provider (network call)
• Collectors → OS (live metrics)
• Backend assembles final message → Frontend chat UI
Important architectural pattern to highlight
• API Layer: main.py (request/response boundary)
• Orchestration/Tooling Layer: tool_router.py (decides which capability to invoke)
• Integrations:
• System integration: collectors/* (reads OS metrics)
• External AI integration: llm_service.py (calls LLM provider)
Frontend similarly has a clean separation:
• Presentation components vs chart components vs API client (api.js)
This is worth showing either as:
Get System Status
• UI → api.js → backend route → collector → OS → collector → backend → UI → chart render
Chat/Diagnostics with tool usage
• UI → backend → tool_router → (LLM call) → (collector call) → compose answer → UI
Don’t overthink it: split into as many components as possible
For this repo, the “maximally separated but still accurate” decomposition is:
Frontend
• App shell (App.jsx)
• System status panel (SystemStatus.jsx)
• Visualizer (DataVisualizer.jsx)
• Charts (CpuChart, MemoryChart, ProcessChart)
• Chat UI (InputBox, MessageBubble)
• API client (services/api.js)
Backend
• API entry/routes (main.py)
• Tool dispatcher (tool_router.py)
• LLM client (llm_service.py)
• Collectors (cpu.py, memory.py, process.py)
• Dependencies (requirements.txt)
External
• Host OS (metrics source)
• LLM provider (network)