How harik0/dns-ad-block works
This is an AI-assisted DNS analytics dashboard: Pi-hole remains responsible for allow/block decisions, while the backend imports or accepts DNS events, enriches them with auditable explanations and advisory false-positive risk, and stores them for review. The frontend presents query counts, decision/category charts, and a log table; the README also documents WebSocket updates. The main page excerpt shows five-second polling rather than a WebSocket client, so the live WebSocket relationship is documented but its frontend implementation is not visible in the sampled code.
Main entry points: main.py Sync and ingestion · models.py DNS log model · db.py SQLite database · pihole_client.py Pi-hole client
Components 15
Event ingestion
- Pi-hole client
backend/app/pihole_client.py
Explanation and storage
- Event explanation
backend/app/ml_engine.py - DNS log model
backend/app/models.py - SQLite database
backend/app/db.py
Backend API
- Sync and ingestion
backend/app/main.py - Event schemas
backend/app/schemas.py - HTTP and WebSocket API
backend/app/main.py
Dashboard
- Dashboard view
frontend/app/page.tsx - Metric component
frontend/components/dashboard-metric.tsx - Logs table component
frontend/components/logs-table.tsx - Status badge
frontend/components/status-badge.tsx - Threat chart
frontend/components/threat-chart.tsx
Other components
- Pi-hole
- Event adapter
- Dashboard user
Connections 14
- Pi-hole client → Pi-hole: fetches queries
backend/app/pihole_client.py - Sync and ingestion → Pi-hole client: fetches queries
backend/app/main.py - Event adapter → HTTP and WebSocket API: submits events
README.md - Sync and ingestion → Event schemas: validates events
backend/app/main.py - Sync and ingestion → Event explanation: builds explanations
backend/app/main.py - Sync and ingestion → DNS log model: creates log records
backend/app/main.py - Sync and ingestion → SQLite database: commits records
backend/app/main.py - HTTP and WebSocket API → DNS log model: queries logs
backend/app/main.py - HTTP and WebSocket API → SQLite database: opens sessions
backend/app/main.py - SQLite database → DNS log model: creates tables
backend/app/db.py - DNS log model → SQLite database: uses ORM base
backend/app/models.py - Dashboard view → HTTP and WebSocket API: polls logs
frontend/app/page.tsx - HTTP and WebSocket API → Dashboard user: streams updates
README.md - Dashboard user → Dashboard view: views analytics