# nikhill969/pcapdroid-analyzer architecture

> Architecture diagram of the GitHub repository nikhill969/pcapdroid-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nikhill969/pcapdroid-analyzer
- Repository: https://github.com/nikhill969/pcapdroid-analyzer

## Overview

PCAPdroid Analyzer is a local FastAPI/SQLite application for importing PCAPdroid CSV exports and exploring traffic without sending data off-device. The main workflow is browser upload → CSV normalization and duplicate handling → storage and aggregate refresh → analysis APIs → dashboard and investigation views. Separate capabilities cover app/domain/DNS/privacy analysis, filtered search and timelines, and configurable overnight analysis with baselines and bursts; session management supports retention and exports. Connections among sampled components follow their visible calls; feature routes and analytics not sampled are included only where documented by the README or tree.

Main entry points: [`static/js/app.js`](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/static/js/app.js) (Analyzer UI), [`app/database.py`](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/database.py) (SQLite access), [`app/services/analytics.py`](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/services/analytics.py) (Analytics engine), [`app/routers/import_router.py`](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/import_router.py) (CSV import API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Import and storage"]
  node_import_api["CSV import API<br/>[import_router.py]"]
  node_parser["CSV parser<br/>[csv_parser.py]"]
  node_db_access["SQLite access<br/>[database.py]"]
  node_database[("Local SQLite")]
  node_sessions["Session management<br/>[session_router.py]"]
end

subgraph group_analysis["Traffic analysis"]
  node_analytics["Analytics engine<br/>[analytics.py]"]
  node_dashboard["Dashboard API"]
  node_apps["App analysis API<br/>[apps_router.py]"]
  node_domains["Domain analysis API<br/>[domains_router.py]"]
  node_dns["DNS analysis API<br/>[dns_router.py]"]
  node_privacy["Privacy metrics API<br/>[privacy_router.py]"]
  node_search["Search API<br/>[search_router.py]"]
end

subgraph group_overnight["Overnight analysis"]
  node_overnight_api["Overnight API"]
  node_overnight_engine["Overnight engine<br/>[overnight.py]"]
end

subgraph group_web["Web interface"]
  node_ui["Analyzer UI<br/>[app.js]"]
  node_page["Web page<br/>[index.html]"]
  node_app["FastAPI application<br/>[main.py]"]
end

node_visitor(("Local user"))

node_visitor -->|"uses"| node_ui
node_app -->|"serves"| node_page
node_page -->|"loads"| node_ui
node_ui -->|"uploads CSV"| node_import_api
node_ui -->|"requests views"| node_dashboard
node_ui -->|"requests app data"| node_apps
node_ui -->|"requests domain data"| node_domains
node_ui -->|"requests DNS data"| node_dns
node_ui -->|"requests metrics"| node_privacy
node_ui -->|"searches traffic"| node_search
node_ui -->|"requests night views"| node_overnight_api
node_ui -->|"manages sessions"| node_sessions
node_import_api -->|"parses CSV"| node_parser
node_import_api -->|"stores and refreshes"| node_analytics
node_import_api -->|"opens connection"| node_db_access
node_dashboard -->|"queries analytics"| node_analytics
node_apps -->|"queries app stats"| node_analytics
node_domains -->|"queries domain stats"| node_analytics
node_domains -->|"refreshes aggregates"| node_analytics
node_dns -->|"queries DNS data"| node_analytics
node_privacy -->|"queries metrics"| node_analytics
node_search -->|"searches and timelines"| node_analytics
node_dashboard -->|"opens connection"| node_db_access
node_apps -->|"opens connection"| node_db_access
node_domains -->|"opens connection"| node_db_access
node_dns -->|"opens connection"| node_db_access
node_privacy -->|"opens connection"| node_db_access
node_search -->|"opens connection"| node_db_access
node_db_access -->|"reads and writes"| node_database
node_overnight_api -->|"computes analysis"| node_overnight_engine
node_overnight_api -->|"opens connection"| node_db_access
node_overnight_engine -->|"queries traffic and settings"| node_database
node_sessions -->|"opens connection"| node_db_access
node_sessions -->|"exports analysis"| node_overnight_engine
node_sessions -->|"refreshes aggregates"| node_analytics

click node_ui "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/static/js/app.js"
click node_page "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/templates/index.html"
click node_app "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/main.py"
click node_import_api "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/import_router.py"
click node_parser "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/services/csv_parser.py"
click node_analytics "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/services/analytics.py"
click node_db_access "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/database.py"
click node_dashboard "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/dashboard_router.py"
click node_apps "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/apps_router.py"
click node_domains "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/domains_router.py"
click node_dns "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/dns_router.py"
click node_privacy "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/privacy_router.py"
click node_search "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/search_router.py"
click node_overnight_api "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/overnight_router.py"
click node_overnight_engine "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/services/overnight.py"
click node_sessions "https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/session_router.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_import_api,node_parser,node_db_access,node_database,node_sessions,node_visitor toneBlue
class node_analytics,node_dashboard,node_apps,node_domains,node_dns,node_privacy,node_search toneAmber
class node_overnight_api,node_overnight_engine toneMint
class node_ui,node_page,node_app toneRose
```

## Components

### Import and storage

- [CSV import API](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/import_router.py): `app/routers/import_router.py`
- [CSV parser](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/services/csv_parser.py): `app/services/csv_parser.py`
- [SQLite access](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/database.py): `app/database.py`
- **Local SQLite**
- [Session management](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/session_router.py): `app/routers/session_router.py`

### Traffic analysis

- [Analytics engine](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/services/analytics.py): `app/services/analytics.py`
- [Dashboard API](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/dashboard_router.py): `app/routers/dashboard_router.py`
- [App analysis API](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/apps_router.py): `app/routers/apps_router.py`
- [Domain analysis API](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/domains_router.py): `app/routers/domains_router.py`
- [DNS analysis API](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/dns_router.py): `app/routers/dns_router.py`
- [Privacy metrics API](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/privacy_router.py): `app/routers/privacy_router.py`
- [Search API](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/search_router.py): `app/routers/search_router.py`

### Overnight analysis

- [Overnight API](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/routers/overnight_router.py): `app/routers/overnight_router.py`
- [Overnight engine](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/app/services/overnight.py): `app/services/overnight.py`

### Web interface

- [Analyzer UI](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/static/js/app.js): `static/js/app.js`
- [Web page](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/templates/index.html): `templates/index.html`
- [FastAPI application](https://github.com/nikhill969/pcapdroid-analyzer/blob/master/main.py): `main.py`

### Other components

- **Local user**

## Connections

- Local user → Analyzer UI: uses
- FastAPI application → Web page: serves
- Web page → Analyzer UI: loads
- Analyzer UI → CSV import API: uploads CSV
- Analyzer UI → Dashboard API: requests views
- Analyzer UI → App analysis API: requests app data
- Analyzer UI → Domain analysis API: requests domain data
- Analyzer UI → DNS analysis API: requests DNS data
- Analyzer UI → Privacy metrics API: requests metrics
- Analyzer UI → Search API: searches traffic
- Analyzer UI → Overnight API: requests night views
- Analyzer UI → Session management: manages sessions
- CSV import API → CSV parser: parses CSV
- CSV import API → Analytics engine: stores and refreshes
- CSV import API → SQLite access: opens connection
- Dashboard API → Analytics engine: queries analytics
- App analysis API → Analytics engine: queries app stats
- Domain analysis API → Analytics engine: queries domain stats
- Domain analysis API → Analytics engine: refreshes aggregates
- DNS analysis API → Analytics engine: queries DNS data
- Privacy metrics API → Analytics engine: queries metrics
- Search API → Analytics engine: searches and timelines
- Dashboard API → SQLite access: opens connection
- App analysis API → SQLite access: opens connection
- Domain analysis API → SQLite access: opens connection
- DNS analysis API → SQLite access: opens connection
- Privacy metrics API → SQLite access: opens connection
- Search API → SQLite access: opens connection
- SQLite access → Local SQLite: reads and writes
- Overnight API → Overnight engine: computes analysis
- Overnight API → SQLite access: opens connection
- Overnight engine → Local SQLite: queries traffic and settings
- Session management → SQLite access: opens connection
- Session management → Overnight engine: exports analysis
- Session management → Analytics engine: refreshes aggregates
