# yuturuishi/rebucca architecture

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

- Interactive diagram: https://gitdiagram.com/yuturuishi/rebucca
- Repository: https://github.com/yuturuishi/rebucca

## Overview

Rebucca is a multi-camera video access and intelligent surveillance platform. Its main user workflow is to add a camera, configure detection and business algorithms, draw and bind monitoring zones, start analysis, and review alarms. Runtime analysis runs per-camera pipelines, applies detection and tracking plus zone rules, and sends alarm events for persistence. The graph also preserves documented stream management, recording, ONVIF discovery, large-model review, and operations capabilities. Several view, streaming, and integration implementations were not excerpted; documented relationships use the README as evidence.

Main entry points: [`app/models.py`](https://github.com/yuturuishi/rebucca/blob/main/app/models.py) (Platform models), [`app/analysis/pipeline.py`](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/pipeline.py) (Camera pipeline), [`app/analysis/engines/factory.py`](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/factory.py) (Engine factory), [`app/views/StreamView.py`](https://github.com/yuturuishi/rebucca/blob/main/app/views/StreamView.py) (Stream management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Video access"]
  node_web["Web interface"]
  node_stream_views["Stream management<br/>[StreamView.py]"]
  node_gb28181["GB28181 SIP"]
  node_media["ZLMediaKit<br/>[ZLMediaKitApi.py]"]
  node_onvif["ONVIF discovery<br/>[onvif_discovery.py]"]
  node_player["Video decoder"]
end

subgraph group_analysis["Analysis and rules"]
  node_algorithm_views["Model configuration<br/>[SmallModelView.py]"]
  node_biz_views["Business algorithms<br/>[AlgorithmView.py]"]
  node_zone_views["Zone configuration<br/>[AnalysisView.py]"]
  node_manager["Analysis manager<br/>[manager.py]"]
  node_pipeline["Camera pipeline<br/>[pipeline.py]"]
  node_worker_pool["Detector pool<br/>[worker_pool.py]"]
  node_factory["Engine factory<br/>[factory.py]"]
  node_base_engine["Engine interface<br/>[base.py]"]
  node_yolo_engine["YOLO PyTorch"]
  node_onnx_engine["ONNX engine<br/>[onnx_engine.py]"]
  node_openvino_engine["OpenVINO engine<br/>[openvino_engine.py]"]
  node_postprocess["YOLO postprocess"]
  node_motion["Motion analysis<br/>[motion.py]"]
  node_rules["Zone rules<br/>[biz_rules.py]"]
  node_llm["Large-model review<br/>[LLMUtils.py]"]
end

subgraph group_operations["Platform operations"]
  node_recording["Recording manager<br/>[manager.py]"]
  node_ffmpeg["FFmpeg"]
  node_control["Operations panel<br/>[ControlView.py]"]
  node_language["Language support<br/>[LanguageUtils.py]"]
end

subgraph group_persistence["Data and events"]
  node_models[("Platform models<br/>[models.py]")]
  node_alarm_bridge["Event bridge<br/>[event_bridge.py]"]
  node_alarm_service["Alarm service<br/>[alarm_service.py]"]
  node_database[("SQLite database")]
end

node_operator(("Operator"))

node_operator -->|"configures"| node_web
node_web -.->|"manages streams"| node_stream_views
node_stream_views -.->|"accepts GB28181"| node_gb28181
node_stream_views -.->|"forwards streams"| node_media
node_stream_views -.->|"discovers cameras"| node_onvif
node_operator -->|"configures models"| node_algorithm_views
node_operator -->|"defines algorithms"| node_biz_views
node_operator -->|"binds zones"| node_zone_views
node_algorithm_views -->|"stores configuration"| node_models
node_biz_views -.->|"stores configuration"| node_models
node_zone_views -.->|"stores zones"| node_models
node_operator -->|"starts analysis"| node_manager
node_manager -->|"starts pipeline"| node_pipeline
node_manager -->|"routes inference"| node_worker_pool
node_pipeline -.->|"requests detectors"| node_worker_pool
node_worker_pool -->|"creates engines"| node_factory
node_factory -->|"implements interface"| node_base_engine
node_factory -->|"dispatches to"| node_yolo_engine
node_factory -->|"dispatches to"| node_onnx_engine
node_factory -->|"dispatches to"| node_openvino_engine
node_onnx_engine -->|"uses postprocess"| node_postprocess
node_openvino_engine -->|"uses postprocess"| node_postprocess
node_pipeline -->|"analyzes motion"| node_motion
node_pipeline -->|"matches zone rules"| node_rules
node_pipeline -.->|"requests review"| node_llm
node_manager -->|"forwards events"| node_alarm_bridge
node_alarm_bridge -->|"dispatches alarms"| node_alarm_service
node_alarm_service -->|"persists alarms"| node_models
node_models -->|"stores records"| node_database
node_operator -->|"manages recording"| node_recording
node_recording -->|"records segments"| node_ffmpeg
node_recording -->|"indexes files"| node_models
node_operator -->|"monitors platform"| node_control
node_web -.->|"plays video"| node_player
node_web -.->|"uses translations"| node_language

click node_stream_views "https://github.com/yuturuishi/rebucca/blob/main/app/views/StreamView.py"
click node_gb28181 "https://github.com/yuturuishi/rebucca/blob/main/app/utils/GB28181SipServer.py"
click node_media "https://github.com/yuturuishi/rebucca/blob/main/app/utils/ZLMediaKitApi.py"
click node_onvif "https://github.com/yuturuishi/rebucca/blob/main/app/services/onvif_discovery.py"
click node_models "https://github.com/yuturuishi/rebucca/blob/main/app/models.py"
click node_algorithm_views "https://github.com/yuturuishi/rebucca/blob/main/app/views/SmallModelView.py"
click node_biz_views "https://github.com/yuturuishi/rebucca/blob/main/app/views/AlgorithmView.py"
click node_zone_views "https://github.com/yuturuishi/rebucca/blob/main/app/views/AnalysisView.py"
click node_manager "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/manager.py"
click node_pipeline "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/pipeline.py"
click node_worker_pool "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/worker_pool.py"
click node_factory "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/factory.py"
click node_base_engine "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/base.py"
click node_yolo_engine "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/yolo_pytorch_engine.py"
click node_onnx_engine "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/onnx_engine.py"
click node_openvino_engine "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/openvino_engine.py"
click node_postprocess "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/yolo_postprocess.py"
click node_motion "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/motion.py"
click node_rules "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/biz_rules.py"
click node_llm "https://github.com/yuturuishi/rebucca/blob/main/app/utils/LLMUtils.py"
click node_alarm_bridge "https://github.com/yuturuishi/rebucca/blob/main/app/analysis/event_bridge.py"
click node_alarm_service "https://github.com/yuturuishi/rebucca/blob/main/app/services/alarm_service.py"
click node_recording "https://github.com/yuturuishi/rebucca/blob/main/app/recording/manager.py"
click node_control "https://github.com/yuturuishi/rebucca/blob/main/app/views/ControlView.py"
click node_language "https://github.com/yuturuishi/rebucca/blob/main/app/utils/LanguageUtils.py"
click node_player "https://github.com/yuturuishi/rebucca/blob/main/static/lib/easyPlayer/js/decoder-pro-mt-worker.js"

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_web,node_stream_views,node_gb28181,node_media,node_onvif,node_player toneBlue
class node_algorithm_views,node_biz_views,node_zone_views,node_manager,node_pipeline,node_worker_pool,node_factory,node_base_engine,node_yolo_engine,node_onnx_engine,node_openvino_engine,node_postprocess,node_motion,node_rules,node_llm toneAmber
class node_recording,node_ffmpeg,node_control,node_language toneMint
class node_models,node_alarm_bridge,node_alarm_service,node_database toneRose
class node_operator toneIndigo
```

## Components

### Video access

- **Web interface**
- [Stream management](https://github.com/yuturuishi/rebucca/blob/main/app/views/StreamView.py): `app/views/StreamView.py`
- [GB28181 SIP](https://github.com/yuturuishi/rebucca/blob/main/app/utils/GB28181SipServer.py): `app/utils/GB28181SipServer.py`
- [ZLMediaKit](https://github.com/yuturuishi/rebucca/blob/main/app/utils/ZLMediaKitApi.py): `app/utils/ZLMediaKitApi.py`
- [ONVIF discovery](https://github.com/yuturuishi/rebucca/blob/main/app/services/onvif_discovery.py): `app/services/onvif_discovery.py`
- [Video decoder](https://github.com/yuturuishi/rebucca/blob/main/static/lib/easyPlayer/js/decoder-pro-mt-worker.js): `static/lib/easyPlayer/js/decoder-pro-mt-worker.js`

### Analysis and rules

- [Model configuration](https://github.com/yuturuishi/rebucca/blob/main/app/views/SmallModelView.py): `app/views/SmallModelView.py`
- [Business algorithms](https://github.com/yuturuishi/rebucca/blob/main/app/views/AlgorithmView.py): `app/views/AlgorithmView.py`
- [Zone configuration](https://github.com/yuturuishi/rebucca/blob/main/app/views/AnalysisView.py): `app/views/AnalysisView.py`
- [Analysis manager](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/manager.py): `app/analysis/manager.py`
- [Camera pipeline](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/pipeline.py): `app/analysis/pipeline.py`
- [Detector pool](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/worker_pool.py): `app/analysis/worker_pool.py`
- [Engine factory](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/factory.py): `app/analysis/engines/factory.py`
- [Engine interface](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/base.py): `app/analysis/engines/base.py`
- [YOLO PyTorch](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/yolo_pytorch_engine.py): `app/analysis/engines/yolo_pytorch_engine.py`
- [ONNX engine](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/onnx_engine.py): `app/analysis/engines/onnx_engine.py`
- [OpenVINO engine](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/openvino_engine.py): `app/analysis/engines/openvino_engine.py`
- [YOLO postprocess](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/engines/yolo_postprocess.py): `app/analysis/engines/yolo_postprocess.py`
- [Motion analysis](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/motion.py): `app/analysis/motion.py`
- [Zone rules](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/biz_rules.py): `app/analysis/biz_rules.py`
- [Large-model review](https://github.com/yuturuishi/rebucca/blob/main/app/utils/LLMUtils.py): `app/utils/LLMUtils.py`

### Platform operations

- [Recording manager](https://github.com/yuturuishi/rebucca/blob/main/app/recording/manager.py): `app/recording/manager.py`
- **FFmpeg**
- [Operations panel](https://github.com/yuturuishi/rebucca/blob/main/app/views/ControlView.py): `app/views/ControlView.py`
- [Language support](https://github.com/yuturuishi/rebucca/blob/main/app/utils/LanguageUtils.py): `app/utils/LanguageUtils.py`

### Data and events

- [Platform models](https://github.com/yuturuishi/rebucca/blob/main/app/models.py): `app/models.py`
- [Event bridge](https://github.com/yuturuishi/rebucca/blob/main/app/analysis/event_bridge.py): `app/analysis/event_bridge.py`
- [Alarm service](https://github.com/yuturuishi/rebucca/blob/main/app/services/alarm_service.py): `app/services/alarm_service.py`
- **SQLite database**

### Other components

- **Operator**

## Connections

- Operator → Web interface: configures
- Web interface → Stream management: manages streams
- Stream management → GB28181 SIP: accepts GB28181
- Stream management → ZLMediaKit: forwards streams
- Stream management → ONVIF discovery: discovers cameras
- Operator → Model configuration: configures models
- Operator → Business algorithms: defines algorithms
- Operator → Zone configuration: binds zones
- Model configuration → Platform models: stores configuration (evidence: `app/views/SmallModelView.py`)
- Business algorithms → Platform models: stores configuration
- Zone configuration → Platform models: stores zones
- Operator → Analysis manager: starts analysis
- Analysis manager → Camera pipeline: starts pipeline (evidence: `app/analysis/manager.py`)
- Analysis manager → Detector pool: routes inference (evidence: `app/analysis/manager.py`)
- Camera pipeline → Detector pool: requests detectors
- Detector pool → Engine factory: creates engines (evidence: `app/analysis/worker_pool.py`)
- Engine factory → Engine interface: implements interface (evidence: `app/analysis/engines/factory.py`)
- Engine factory → YOLO PyTorch: dispatches to (evidence: `app/analysis/engines/factory.py`)
- Engine factory → ONNX engine: dispatches to (evidence: `app/analysis/engines/factory.py`)
- Engine factory → OpenVINO engine: dispatches to (evidence: `app/analysis/engines/factory.py`)
- ONNX engine → YOLO postprocess: uses postprocess (evidence: `app/analysis/engines/onnx_engine.py`)
- OpenVINO engine → YOLO postprocess: uses postprocess (evidence: `app/analysis/engines/openvino_engine.py`)
- Camera pipeline → Motion analysis: analyzes motion (evidence: `app/analysis/pipeline.py`)
- Camera pipeline → Zone rules: matches zone rules (evidence: `app/analysis/pipeline.py`)
- Camera pipeline → Large-model review: requests review (evidence: `app/analysis/pipeline.py`)
- Analysis manager → Event bridge: forwards events (evidence: `app/analysis/manager.py`)
- Event bridge → Alarm service: dispatches alarms (evidence: `app/analysis/event_bridge.py`)
- Alarm service → Platform models: persists alarms (evidence: `app/services/alarm_service.py`)
- Platform models → SQLite database: stores records (evidence: `app/models.py`)
- Operator → Recording manager: manages recording
- Recording manager → FFmpeg: records segments (evidence: `app/recording/manager.py`)
- Recording manager → Platform models: indexes files (evidence: `app/recording/manager.py`)
- Operator → Operations panel: monitors platform
- Web interface → Video decoder: plays video
- Web interface → Language support: uses translations
