# SeekRight DB Monitor - Project Handover ## Overview This project is a monitoring dashboard for the SeekRight infrastructure. It tracks the health of 77 different databases and verifies the synchronization of images across specific tables (`tbl_site_anomaly`, `tbl_site_anomaly_history`, `tbl_site_anomaly_history_bkp`). ## Architecture The system is cleanly separated into a decoupled backend and a static frontend: ### 1. Backend (FastAPI & Python) - **Framework**: FastAPI (`backend/main.py`) - **Background Scanner**: A highly concurrent Python asynchronous scanner (`backend/core/scanner.py`) that queries 77 MySQL databases. - **Decoupled Jobs**: - **Schema Scan**: Runs every 1 hour. Checks table structures, row counts, and column counts. - **Image Scan**: Runs every 3 hours. Verifies image availability by querying external URLs. - **State Management**: Results are saved immediately to `data/schema_results.json` and `data/image_results.json`. The frontend fetches these static JSON states, meaning the UI is lightning-fast and doesn't block on DB queries. - **CORS**: Configured to allow cross-origin requests (necessary for DevTunnels). ### 2. Frontend (HTML/CSS/Vanilla JS) - **Path**: `frontend/` (`index.html`, `styles.css`, `app.js`). - **Aesthetic**: Premium, ultra-dark "Linear/Vercel" aesthetic. No generic UI slop; high contrast, glassmorphism-free, flat design. - **Key Features**: - **Schema Health Tab**: Flattens the view so every single table across all 77 DBs is visible. Includes a dynamic "Anomaly Detector" that calculates the mode (most common column count) for every table and flags deviations in orange. - **Image Sync Tab**: Displays cards for each DB showing the % of missing/found images. - **Dynamic Pending States**: The UI knows there are 77 DBs and populates "Pending" placeholders for them while the background scan is running for the first time. - **Bulletproof Layout**: The table uses a flexbox `overflow-y` wrapper so the headers (`position: sticky`) never detach or overlap the top bar during scrolling. ## How to Resume Work If an agent is picking this up, they should: 1. Read this `HANDOVER.md` file. 2. Run the backend using `uvicorn backend.main:app --host 0.0.0.0 --port 8000`. 3. Check the frontend at `http://localhost:8000`. 4. Ensure VS Code DevTunnels are set to **Port Visibility: Public** if accessing the UI remotely.