| # Complete Site Map - Crypto Monitor ULTIMATE | |
| ## π Table of Contents | |
| 1. [Frontend Pages & Routes](#frontend-pages--routes) | |
| 2. [Backend API Endpoints](#backend-api-endpoints) | |
| 3. [Static Assets](#static-assets) | |
| 4. [Backend Services](#backend-services) | |
| 5. [Database Files](#database-files) | |
| 6. [Configuration Files](#configuration-files) | |
| 7. [System Monitor Components](#system-monitor-components) | |
| --- | |
| ## π Frontend Pages & Routes | |
| ### Main Application Pages | |
| | Route | File Path | Description | Access URL | | |
| |-------|-----------|-------------|------------| | |
| | `/` | `static/pages/dashboard/index.html` | Main Dashboard | `http://localhost:7860/` | | |
| | `/dashboard` | `static/pages/dashboard/index.html` | Dashboard Page | `http://localhost:7860/dashboard` | | |
| | `/market` | `static/pages/market/index.html` | Market Data Page | `http://localhost:7860/market` | | |
| | `/models` | `static/pages/models/index.html` | AI Models Page | `http://localhost:7860/models` | | |
| | `/sentiment` | `static/pages/sentiment/index.html` | Sentiment Analysis | `http://localhost:7860/sentiment` | | |
| | `/ai-analyst` | `static/pages/ai-analyst/index.html` | AI Analyst Tool | `http://localhost:7860/ai-analyst` | | |
| | `/technical-analysis` | `static/pages/technical-analysis/index.html` | Technical Analysis | `http://localhost:7860/technical-analysis` | | |
| | `/trading-assistant` | `static/pages/trading-assistant/index.html` | Trading Assistant | `http://localhost:7860/trading-assistant` | | |
| | `/news` | `static/pages/news/index.html` | Crypto News | `http://localhost:7860/news` | | |
| | `/providers` | `static/pages/providers/index.html` | Data Providers | `http://localhost:7860/providers` | | |
| | `/system-monitor` | `static/pages/system-monitor/index.html` | **System Monitor** | `http://localhost:7860/system-monitor` | | |
| | `/help` | `static/pages/help/index.html` | Help & Documentation | `http://localhost:7860/help` | | |
| | `/api-explorer` | `static/pages/api-explorer/index.html` | API Explorer | `http://localhost:7860/api-explorer` | | |
| | `/crypto-api-hub` | `static/pages/crypto-api-hub/index.html` | Crypto API Hub | `http://localhost:7860/crypto-api-hub` | | |
| | `/diagnostics` | `static/pages/diagnostics/index.html` | System Diagnostics | `http://localhost:7860/diagnostics` | | |
| ### Static File Structure | |
| ``` | |
| static/ | |
| βββ pages/ | |
| β βββ dashboard/ | |
| β β βββ index.html | |
| β β βββ dashboard.js | |
| β β βββ dashboard.css | |
| β βββ system-monitor/ β System Monitor | |
| β β βββ index.html β Main page HTML | |
| β β βββ system-monitor.js β JavaScript logic | |
| β β βββ system-monitor.css β Styling | |
| β β βββ README.md β Documentation | |
| β βββ market/ | |
| β βββ models/ | |
| β βββ sentiment/ | |
| β βββ ai-analyst/ | |
| β βββ technical-analysis/ | |
| β βββ trading-assistant/ | |
| β βββ news/ | |
| β βββ providers/ | |
| β βββ help/ | |
| β βββ api-explorer/ | |
| β βββ crypto-api-hub/ | |
| βββ shared/ | |
| β βββ layouts/ | |
| β β βββ sidebar.html β Main sidebar (includes System Monitor link) | |
| β β βββ sidebar-modern.html β Modern sidebar variant | |
| β βββ js/ | |
| β β βββ core/ | |
| β β β βββ layout-manager.js β Loads sidebar/header | |
| β β β βββ api-client.js β API client | |
| β β β βββ models-client.js β Models API client | |
| β β βββ sidebar-manager.js | |
| β βββ css/ | |
| β βββ design-system.css | |
| β βββ global.css | |
| β βββ components.css | |
| β βββ layout.css | |
| βββ assets/ | |
| βββ icons/ | |
| βββ crypto-icons.js β Crypto SVG icons | |
| ``` | |
| --- | |
| ## π Backend API Endpoints | |
| ### System Monitor API Endpoints | |
| | Endpoint | Method | File Location | Description | | |
| |----------|--------|---------------|-------------| | |
| | `/api/monitoring/status` | GET | `backend/routers/realtime_monitoring_api.py:40` | Get comprehensive system status | | |
| | `/api/monitoring/ws` | WebSocket | `backend/routers/realtime_monitoring_api.py:188` | Real-time WebSocket updates | | |
| | `/api/monitoring/sources/detailed` | GET | `backend/routers/realtime_monitoring_api.py:138` | Get detailed source information | | |
| | `/api/monitoring/requests/recent` | GET | `backend/routers/realtime_monitoring_api.py:171` | Get recent API requests | | |
| | `/api/monitoring/requests/log` | POST | `backend/routers/realtime_monitoring_api.py:181` | Log an API request | | |
| ### Core API Endpoints | |
| | Endpoint | Method | File Location | Description | | |
| |----------|--------|---------------|-------------| | |
| | `/api/health` | GET | `hf_unified_server.py` | Health check | | |
| | `/api/status` | GET | `hf_unified_server.py` | System status | | |
| | `/api/models/summary` | GET | `hf_unified_server.py:1226` | Models summary with categories | | |
| | `/api/models/status` | GET | `hf_unified_server.py:814` | Models status | | |
| | `/api/models/list` | GET | `hf_unified_server.py:786` | List all models | | |
| | `/api/resources` | GET | `hf_unified_server.py` | Resources statistics | | |
| | `/api/resources/summary` | GET | `hf_unified_server.py` | Resources summary | | |
| | `/api/resources/categories` | GET | `hf_unified_server.py` | Resources by category | | |
| ### Router Endpoints | |
| All routers are included in `hf_unified_server.py`: | |
| 1. **Unified Service API** (`backend/routers/unified_service_api.py`) | |
| - `/api/service/rate` | |
| - `/api/service/rate/batch` | |
| - `/api/service/pair/{pair}` | |
| - `/api/service/sentiment` | |
| - `/api/service/history` | |
| - `/api/service/market-status` | |
| 2. **Real Data API** (`backend/routers/real_data_api.py`) | |
| - `/api/models/list` | |
| - `/api/models/initialize` | |
| - `/api/sentiment/analyze` | |
| - `/api/providers` | |
| 3. **Direct API** (`backend/routers/direct_api.py`) | |
| - `/api/v1/coingecko/price` | |
| - `/api/v1/binance/klines` | |
| - `/api/v1/hf/sentiment` | |
| - `/api/v1/hf/models` | |
| 4. **Crypto API Hub** (`backend/routers/crypto_api_hub_router.py`) | |
| - `/api/crypto-hub/*` | |
| 5. **AI API** (`backend/routers/ai_api.py`) | |
| - `/api/ai/*` | |
| 6. **Market API** (`backend/routers/market_api.py`) | |
| - `/api/market/*` | |
| 7. **Technical Analysis API** (`backend/routers/technical_analysis_api.py`) | |
| - `/api/technical/*` | |
| 8. **Real-Time Monitoring API** (`backend/routers/realtime_monitoring_api.py`) β | |
| - `/api/monitoring/*` - **System Monitor endpoints** | |
| --- | |
| ## π¨ Static Assets | |
| ### CSS Files | |
| | File | Path | Used By | | |
| |------|------|---------| | |
| | Design System | `static/shared/css/design-system.css` | All pages | | |
| | Global Styles | `static/shared/css/global.css` | All pages | | |
| | Components | `static/shared/css/components.css` | All pages | | |
| | Layout | `static/shared/css/layout.css` | All pages | | |
| | Dashboard | `static/pages/dashboard/dashboard.css` | Dashboard page | | |
| | **System Monitor** | `static/pages/system-monitor/system-monitor.css` | **System Monitor page** | | |
| ### JavaScript Files | |
| | File | Path | Purpose | | |
| |------|------|---------| | |
| | Layout Manager | `static/shared/js/core/layout-manager.js` | Loads sidebar/header | | |
| | API Client | `static/shared/js/core/api-client.js` | API communication | | |
| | Models Client | `static/shared/js/core/models-client.js` | Models API client | | |
| | **System Monitor** | `static/pages/system-monitor/system-monitor.js` | **System Monitor logic** | | |
| | Crypto Icons | `static/assets/icons/crypto-icons.js` | SVG icons library | | |
| --- | |
| ## βοΈ Backend Services | |
| ### Service Files | |
| | Service | File Path | Used By | | |
| |---------|-----------|---------| | |
| | AI Models Monitor | `backend/services/ai_models_monitor.py` | System Monitor, Models API | | |
| | Source Pool Manager | `monitoring/source_pool_manager.py` | System Monitor | | |
| | Database Manager | `database/db_manager.py` | All services | | |
| | Backtesting Service | `backend/services/backtesting_service.py` | Trading API | | |
| | ML Training Service | `backend/services/ml_training_service.py` | AI API | | |
| ### Main Application File | |
| | File | Path | Purpose | | |
| |------|------|---------| | |
| | FastAPI Server | `hf_unified_server.py` | Main application entry point | | |
| | Server Runner | `main.py` | Start server with uvicorn | | |
| | AI Models Registry | `ai_models.py` | Model management | | |
| --- | |
| ## πΎ Database Files | |
| | Database | Path | Purpose | | |
| |----------|------|---------| | |
| | AI Models DB | `data/ai_models.db` | AI models monitoring data | | |
| | Main Database | SQLite via `database/db_manager.py` | Providers, sources, pools | | |
| ### Database Models | |
| | Model | File Path | Description | | |
| |-------|-----------|-------------| | |
| | Provider | `database/models.py` | Data provider information | | |
| | SourcePool | `database/models.py` | Source pool management | | |
| | PoolMember | `database/models.py` | Pool member details | | |
| --- | |
| ## π Configuration Files | |
| | File | Path | Purpose | | |
| |------|------|---------| | |
| | Environment | `.env` | Environment variables | | |
| | Config | `config.py` | Application configuration | | |
| | Requirements | `requirements.txt` | Python dependencies | | |
| | Package | `package.json` | Node.js dependencies (if any) | | |
| --- | |
| ## π― System Monitor Components | |
| ### Frontend Components | |
| #### HTML Structure | |
| ``` | |
| static/pages/system-monitor/index.html | |
| βββ <head> | |
| β βββ Meta tags | |
| β βββ Theme CSS (design-system, global, components, layout) | |
| β βββ System Monitor CSS | |
| βββ <body> | |
| β βββ app-container | |
| β β βββ sidebar-container (injected by LayoutManager) | |
| β β βββ main-content | |
| β β βββ header-container (injected by LayoutManager) | |
| β β βββ page-content | |
| β β βββ page-header (title, status badge, refresh button) | |
| β β βββ stats-grid (4 stat cards) | |
| β β β βββ Database Status Card | |
| β β β βββ AI Models Card | |
| β β β βββ Data Sources Card | |
| β β β βββ Active Requests Card | |
| β β βββ network-section | |
| β β βββ section-header (title + legend) | |
| β β βββ network-canvas-container | |
| β β βββ #network-canvas | |
| β βββ connection-status (fixed bottom-right) | |
| β βββ toast-container | |
| βββ <script> | |
| βββ LayoutManager.init('system-monitor') | |
| βββ SystemMonitor class initialization | |
| ``` | |
| #### JavaScript Class Structure | |
| ``` | |
| static/pages/system-monitor/system-monitor.js | |
| βββ SystemMonitor class | |
| βββ constructor() | |
| βββ init() | |
| βββ setupCanvas() | |
| βββ connectWebSocket() β /api/monitoring/ws | |
| βββ startPolling() β /api/monitoring/status | |
| βββ fetchSystemStatus() | |
| βββ updateSystemStatus(data) | |
| βββ updateHeader() | |
| βββ updateDatabaseStatus() | |
| βββ updateAIModels() | |
| βββ updateDataSources() | |
| βββ updateRequests() | |
| βββ updateNetworkNodes() | |
| βββ createPacket() | |
| βββ startAnimation() | |
| βββ draw() (canvas rendering) | |
| βββ destroy() | |
| ``` | |
| #### CSS Structure | |
| ``` | |
| static/pages/system-monitor/system-monitor.css | |
| βββ Page Header Styles | |
| βββ Stats Grid Layout | |
| βββ Stat Cards | |
| βββ Status Indicators | |
| βββ Network Section | |
| βββ Canvas Container | |
| βββ Connection Status | |
| βββ Responsive Media Queries | |
| ``` | |
| ### Backend Components | |
| #### API Router | |
| ``` | |
| backend/routers/realtime_monitoring_api.py | |
| βββ Router: APIRouter(prefix="/api/monitoring") | |
| βββ Endpoints: | |
| β βββ GET /status β get_system_status() | |
| β βββ GET /sources/detailed β get_detailed_sources() | |
| β βββ GET /requests/recent β get_recent_requests() | |
| β βββ POST /requests/log β log_request() | |
| β βββ WebSocket /ws β websocket_endpoint() | |
| βββ Dependencies: | |
| βββ ai_models_db (AI models database) | |
| βββ db_manager (Main database) | |
| βββ SourcePoolManager (Source pool management) | |
| ``` | |
| #### Data Flow | |
| ``` | |
| Frontend (system-monitor.js) | |
| β | |
| βββ WebSocket: /api/monitoring/ws | |
| β βββ Real-time updates every 2 seconds | |
| β | |
| βββ HTTP Polling: /api/monitoring/status | |
| βββ Fallback if WebSocket fails | |
| Backend (realtime_monitoring_api.py) | |
| β | |
| βββ AI Models Monitor Service | |
| β βββ Get models status, health, metrics | |
| β | |
| βββ Database Manager | |
| β βββ Get providers, sources, pools | |
| β | |
| βββ Request Log (in-memory) | |
| βββ Recent API requests tracking | |
| ``` | |
| --- | |
| ## π Execution Flow | |
| ### Server Startup | |
| 1. **Entry Point**: `main.py` | |
| ```bash | |
| python main.py | |
| ``` | |
| 2. **Server File**: `hf_unified_server.py` | |
| - Loads all routers | |
| - Includes `realtime_monitoring_router` | |
| - Sets up middleware | |
| - Starts uvicorn server on port 7860 | |
| 3. **Routes Registered**: | |
| - All page routes (`/system-monitor`, `/dashboard`, etc.) | |
| - All API routes (`/api/*`) | |
| - WebSocket routes (`/api/monitoring/ws`) | |
| ### System Monitor Page Load | |
| 1. **User navigates to**: `http://localhost:7860/system-monitor` | |
| 2. **FastAPI serves**: `static/pages/system-monitor/index.html` | |
| 3. **HTML loads**: | |
| - LayoutManager initializes | |
| - Sidebar injected from `static/shared/layouts/sidebar.html` | |
| - Header injected | |
| - System Monitor CSS loaded | |
| 4. **JavaScript executes**: | |
| - `SystemMonitor` class instantiated | |
| - Canvas setup | |
| - WebSocket connection to `/api/monitoring/ws` | |
| - HTTP polling to `/api/monitoring/status` (every 2s) | |
| 5. **Data updates**: | |
| - Backend gathers status from: | |
| - AI Models Monitor DB | |
| - Main Database (providers, sources) | |
| - Request log | |
| - Returns JSON to frontend | |
| - Frontend updates UI and canvas animation | |
| --- | |
| ## π Complete File Tree | |
| ``` | |
| crypto-dt-source-main/ | |
| βββ hf_unified_server.py β Main FastAPI application | |
| βββ main.py β Server entry point | |
| βββ ai_models.py β AI models registry | |
| βββ config.py β Configuration | |
| βββ requirements.txt β Dependencies | |
| β | |
| βββ static/ | |
| β βββ pages/ | |
| β β βββ system-monitor/ β System Monitor | |
| β β β βββ index.html | |
| β β β βββ system-monitor.js | |
| β β β βββ system-monitor.css | |
| β β β βββ README.md | |
| β β βββ dashboard/ | |
| β β βββ market/ | |
| β β βββ models/ | |
| β β βββ ... (other pages) | |
| β β | |
| β βββ shared/ | |
| β β βββ layouts/ | |
| β β β βββ sidebar.html β Includes System Monitor link | |
| β β β βββ sidebar-modern.html | |
| β β βββ js/ | |
| β β β βββ core/ | |
| β β β β βββ layout-manager.js | |
| β β β β βββ api-client.js | |
| β β β β βββ models-client.js | |
| β β β βββ sidebar-manager.js | |
| β β βββ css/ | |
| β β βββ design-system.css | |
| β β βββ global.css | |
| β β βββ components.css | |
| β β βββ layout.css | |
| β β | |
| β βββ assets/ | |
| β βββ icons/ | |
| β βββ crypto-icons.js | |
| β | |
| βββ backend/ | |
| β βββ routers/ | |
| β β βββ realtime_monitoring_api.py β System Monitor API | |
| β β βββ unified_service_api.py | |
| β β βββ real_data_api.py | |
| β β βββ direct_api.py | |
| β β βββ ai_api.py | |
| β β βββ market_api.py | |
| β β βββ ... (other routers) | |
| β β | |
| β βββ services/ | |
| β βββ ai_models_monitor.py β Used by System Monitor | |
| β βββ backtesting_service.py | |
| β βββ ml_training_service.py | |
| β | |
| βββ database/ | |
| β βββ db_manager.py β Used by System Monitor | |
| β βββ models.py β Provider, SourcePool, etc. | |
| β | |
| βββ monitoring/ | |
| β βββ source_pool_manager.py β Used by System Monitor | |
| β | |
| βββ data/ | |
| βββ ai_models.db β AI models monitoring database | |
| ``` | |
| --- | |
| ## π Quick Reference | |
| ### Access System Monitor | |
| - **URL**: `http://localhost:7860/system-monitor` | |
| - **Route Handler**: `hf_unified_server.py:409` β `system_monitor_page()` | |
| - **HTML File**: `static/pages/system-monitor/index.html` | |
| ### API Endpoints | |
| - **Status**: `GET http://localhost:7860/api/monitoring/status` | |
| - **WebSocket**: `WS ws://localhost:7860/api/monitoring/ws` | |
| - **Recent Requests**: `GET http://localhost:7860/api/monitoring/requests/recent` | |
| ### Key Files | |
| - **Frontend**: `static/pages/system-monitor/index.html` | |
| - **JavaScript**: `static/pages/system-monitor/system-monitor.js` | |
| - **CSS**: `static/pages/system-monitor/system-monitor.css` | |
| - **Backend API**: `backend/routers/realtime_monitoring_api.py` | |
| - **Sidebar**: `static/shared/layouts/sidebar.html` (line ~157) | |
| --- | |
| ## π Notes | |
| - All paths are relative to project root: `crypto-dt-source-main/` | |
| - Server runs on port **7860** by default (configurable via `PORT` env var) | |
| - System Monitor uses both WebSocket and HTTP polling for reliability | |
| - Sidebar is injected by `LayoutManager` on page load | |
| - Theme is applied via CSS variables defined in `design-system.css` | |
| --- | |
| **Last Updated**: 2025-12-08 | |
| **Version**: 2.0 | |