# suyijun8182/ros-dpi architecture

> Architecture diagram of the GitHub repository suyijun8182/ros-dpi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/suyijun8182/ros-dpi
- Repository: https://github.com/suyijun8182/ros-dpi

## Overview

ROS-DPI receives RouterOS IPFIX traffic records and TZSP DNS/TLS/QUIC samples, correlates them with device/domain identity, classifies applications, and aggregates results for monitoring and audit. Users then explore traffic, hosts, people, flow, and audit views or configure rules, sites, and integrations. The graph preserves documented capabilities whose implementation was not sampled; those subsystems use their exact tree paths, and uncertain connections are omitted. Source excerpts establish core runtime wiring, but do not expose every router or integration call.

Main entry points: [`backend/app/engine.py`](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/engine.py) (Traffic engine), [`frontend/src/App.vue`](https://github.com/suyijun8182/ros-dpi/blob/main/frontend/src/App.vue) (Web shell and routing), [`frontend/src/api.js`](https://github.com/suyijun8182/ros-dpi/blob/main/frontend/src/api.js) (API client), [`backend/app/main.py`](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/main.py) (HTTP API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Collection and analysis"]
  node_ipfix["IPFIX collector<br/>[ipfix.py]"]
  node_tzsp["TZSP collector<br/>[tzsp.py]"]
  node_engine["Traffic engine<br/>[engine.py]"]
  node_classifier["Application classifier<br/>[__init__.py]"]
  node_rule_libraries["Classification libraries"]
  node_asn["ASN lookup<br/>[asn.py]"]
  node_ros_poller["RouterOS poller<br/>[ros_poller.py]"]
end

subgraph group_persistence["State and identity"]
  node_database[("Database runtime<br/>[database.py]")]
  node_models["Data models<br/>[models.py]"]
  node_stats["Statistics queries<br/>[stats.py]"]
end

subgraph group_operations["Audit and control"]
  node_audit["Audit processing<br/>[audit.py]"]
  node_notifications["Notifications<br/>[notify.py]"]
  node_rule_control["Rules and settings<br/>[admin.py]"]
  node_site_management["Site management<br/>[sites.py]"]
end

subgraph group_backend_api["Backend API"]
  node_api_router["HTTP API<br/>[main.py]"]
end

subgraph group_frontend["Web interface"]
  node_web_shell["Web shell and routing<br/>[App.vue]"]
  node_api_client["API client<br/>[api.js]"]
  node_app_views["Traffic and host views"]
  node_admin_views["Audit and settings views"]
  node_flow_people_views["Flow and people views"]
end

node_routeros(("RouterOS"))
node_routeros_api["RouterOS REST API"]
node_user(("Administrator or viewer"))

node_routeros -->|"sends IPFIX"| node_ipfix
node_routeros -->|"sends TZSP"| node_tzsp
node_ipfix -->|"decodes flows"| node_engine
node_tzsp -->|"passes samples"| node_engine
node_engine -->|"classifies traffic"| node_classifier
node_classifier -->|"loads libraries"| node_rule_libraries
node_engine -->|"persists aggregates"| node_database
node_database -->|"creates schema"| node_models
node_engine -->|"supplies traffic data"| node_stats
node_engine -->|"uses ASN data"| node_asn
node_ros_poller -.->|"polls REST"| node_routeros_api
node_api_router -->|"starts collectors"| node_ipfix
node_api_router -->|"starts polling"| node_ros_poller
node_api_router -->|"schedules audit work"| node_audit
node_audit -.->|"dispatches alerts"| node_notifications
node_rule_control -->|"reloads rules"| node_engine
node_rule_control -.->|"updates settings"| node_database
node_site_management -->|"selects site engine"| node_engine
node_user -->|"uses dashboard"| node_web_shell
node_web_shell -->|"uses API client"| node_api_client
node_web_shell -->|"routes views"| node_app_views
node_web_shell -->|"routes views"| node_admin_views
node_web_shell -->|"routes views"| node_flow_people_views
node_app_views -->|"requests statistics"| node_api_client
node_api_client -.->|"calls backend"| node_api_router
node_admin_views -.->|"requests settings"| node_api_client
node_flow_people_views -.->|"requests data"| node_api_client

click node_ipfix "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/collector/ipfix.py"
click node_tzsp "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/collector/tzsp.py"
click node_engine "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/engine.py"
click node_classifier "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/classify/__init__.py"
click node_rule_libraries "https://github.com/suyijun8182/ros-dpi/tree/main/backend/app/classify"
click node_asn "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/asn.py"
click node_database "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/database.py"
click node_models "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/models.py"
click node_stats "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/stats.py"
click node_ros_poller "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/ros_poller.py"
click node_audit "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/audit.py"
click node_notifications "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/notify.py"
click node_rule_control "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/routers/admin.py"
click node_site_management "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/sites.py"
click node_api_router "https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/main.py"
click node_web_shell "https://github.com/suyijun8182/ros-dpi/blob/main/frontend/src/App.vue"
click node_api_client "https://github.com/suyijun8182/ros-dpi/blob/main/frontend/src/api.js"
click node_app_views "https://github.com/suyijun8182/ros-dpi/tree/main/frontend/src/views"
click node_admin_views "https://github.com/suyijun8182/ros-dpi/tree/main/frontend/src/views"
click node_flow_people_views "https://github.com/suyijun8182/ros-dpi/tree/main/frontend/src/views"

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_ipfix,node_tzsp,node_engine,node_classifier,node_rule_libraries,node_asn,node_ros_poller,node_user toneBlue
class node_database,node_models,node_stats toneAmber
class node_audit,node_notifications,node_rule_control,node_site_management,node_routeros,node_routeros_api toneMint
class node_api_router toneRose
class node_web_shell,node_api_client,node_app_views,node_admin_views,node_flow_people_views toneIndigo
```

## Components

### Collection and analysis

- [IPFIX collector](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/collector/ipfix.py): `backend/app/collector/ipfix.py`
- [TZSP collector](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/collector/tzsp.py): `backend/app/collector/tzsp.py`
- [Traffic engine](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/engine.py): `backend/app/engine.py`
- [Application classifier](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/classify/__init__.py): `backend/app/classify/__init__.py`
- [Classification libraries](https://github.com/suyijun8182/ros-dpi/tree/main/backend/app/classify): `backend/app/classify`
- [ASN lookup](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/asn.py): `backend/app/asn.py`
- [RouterOS poller](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/ros_poller.py): `backend/app/ros_poller.py`

### State and identity

- [Database runtime](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/database.py): `backend/app/database.py`
- [Data models](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/models.py): `backend/app/models.py`
- [Statistics queries](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/stats.py): `backend/app/stats.py`

### Audit and control

- [Audit processing](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/audit.py): `backend/app/audit.py`
- [Notifications](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/notify.py): `backend/app/notify.py`
- [Rules and settings](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/routers/admin.py): `backend/app/routers/admin.py`
- [Site management](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/sites.py): `backend/app/sites.py`

### Backend API

- [HTTP API](https://github.com/suyijun8182/ros-dpi/blob/main/backend/app/main.py): `backend/app/main.py`

### Web interface

- [Web shell and routing](https://github.com/suyijun8182/ros-dpi/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [API client](https://github.com/suyijun8182/ros-dpi/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Traffic and host views](https://github.com/suyijun8182/ros-dpi/tree/main/frontend/src/views): `frontend/src/views`
- [Audit and settings views](https://github.com/suyijun8182/ros-dpi/tree/main/frontend/src/views): `frontend/src/views`
- [Flow and people views](https://github.com/suyijun8182/ros-dpi/tree/main/frontend/src/views): `frontend/src/views`

### Other components

- **RouterOS**
- **RouterOS REST API**
- **Administrator or viewer**

## Connections

- RouterOS → IPFIX collector: sends IPFIX
- RouterOS → TZSP collector: sends TZSP
- IPFIX collector → Traffic engine: decodes flows (evidence: `backend/app/engine.py`)
- TZSP collector → Traffic engine: passes samples (evidence: `backend/app/engine.py`)
- Traffic engine → Application classifier: classifies traffic (evidence: `backend/app/engine.py`)
- Application classifier → Classification libraries: loads libraries (evidence: `backend/app/classify/__init__.py`)
- Traffic engine → Database runtime: persists aggregates (evidence: `backend/app/engine.py`)
- Database runtime → Data models: creates schema (evidence: `backend/app/database.py`)
- Traffic engine → Statistics queries: supplies traffic data (evidence: `backend/app/engine.py`)
- Traffic engine → ASN lookup: uses ASN data (evidence: `backend/app/engine.py`)
- RouterOS poller → RouterOS REST API: polls REST
- HTTP API → IPFIX collector: starts collectors (evidence: `backend/app/main.py`)
- HTTP API → RouterOS poller: starts polling (evidence: `backend/app/main.py`)
- HTTP API → Audit processing: schedules audit work (evidence: `backend/app/main.py`)
- Audit processing → Notifications: dispatches alerts
- Rules and settings → Traffic engine: reloads rules (evidence: `backend/app/routers/admin.py`)
- Rules and settings → Database runtime: updates settings (evidence: `backend/app/routers/admin.py`)
- Site management → Traffic engine: selects site engine (evidence: `backend/app/sites.py`)
- Administrator or viewer → Web shell and routing: uses dashboard
- Web shell and routing → API client: uses API client (evidence: `frontend/src/App.vue`)
- Web shell and routing → Traffic and host views: routes views
- Web shell and routing → Audit and settings views: routes views
- Web shell and routing → Flow and people views: routes views
- Traffic and host views → API client: requests statistics (evidence: `frontend/src/views/Apps.vue`)
- API client → HTTP API: calls backend
- Audit and settings views → API client: requests settings (evidence: `frontend/src/views/Apps.vue`)
- Flow and people views → API client: requests data (evidence: `frontend/src/views/Apps.vue`)
