File size: 17,929 Bytes
b190b45 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
# 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
|