# reallynotbaka/ibvap architecture

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

- Interactive diagram: https://gitdiagram.com/reallynotbaka/ibvap
- Repository: https://github.com/reallynotbaka/ibvap

## Overview

IBVAP ingests camera, mobile, or recorded video, analyzes frames for objects, faces, and plates, tracks targets, and evaluates perimeter rules. Alerts and forensic evidence are exposed through the API and operator dashboard, with optional C2 relay documented in the README. The graph combines sampled pipeline and application wiring with README-described capabilities; several route and subsystem internals were not sampled, so their detailed call relationships are omitted.

Main entry points: [`src/ibvap/core/pipeline.py`](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/pipeline.py) (Per-camera pipeline), [`src/ibvap/services/stream_worker.py`](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/services/stream_worker.py) (Stream worker), [`src/ibvap/api/routes`](https://github.com/reallynotbaka/ibvap/tree/main/src/ibvap/api/routes) (Product API routes), [`src/ibvap/events/outbox.py`](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/events/outbox.py) (Event dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Video ingestion"]
  node_worker["Stream worker<br/>[stream_worker.py]"]
  node_media["Media gateway<br/>[media_gateway.py]"]
end

subgraph group_analysis["Analytics"]
  node_pipeline["Per-camera pipeline<br/>[pipeline.py]"]
  node_detector["Object detection<br/>[detector.py]"]
  node_face["Face biometrics<br/>[face.py]"]
  node_tracker["Target tracking<br/>[tracker.py]"]
  node_anpr["Plate recognition<br/>[anpr.py]"]
  node_ocr["OCR matching<br/>[ocr_worker.py]"]
  node_rules["Fence rules<br/>[zone_engine.py]"]
  node_watchlist["Watchlist matching<br/>[watchlist.py]"]
  node_radar["BEV projection<br/>[homography.py]"]
  node_models["Model management<br/>[model_manager.py]"]
end

subgraph group_events["Events and evidence"]
  node_evidence["Evidence capture<br/>[evidence.py]"]
  node_outbox["Event dispatch<br/>[outbox.py]"]
  node_database[("Event persistence<br/>[db.py]")]
end

subgraph group_interface["API and dashboard"]
  node_api["FastAPI application<br/>[app.py]"]
  node_routes["Product API routes"]
  node_app["Dashboard shell<br/>[App.tsx]"]
  node_pages["Operator pages"]
  node_client["API client<br/>[api.ts]"]
end

node_sources(("Video sources"))
node_c2(("C2 webhook"))
node_operator(("Operator"))

node_sources -->|"provides video"| node_worker
node_worker -->|"opens streams"| node_media
node_worker -->|"submits frames"| node_pipeline
node_pipeline -->|"detects objects"| node_detector
node_pipeline -->|"detects faces"| node_face
node_pipeline -->|"tracks targets"| node_tracker
node_worker -->|"requests plate analysis"| node_anpr
node_worker -->|"matches OCR results"| node_ocr
node_pipeline -->|"checks intrusion"| node_rules
node_pipeline -->|"checks identities"| node_watchlist
node_pipeline -->|"attaches evidence"| node_evidence
node_pipeline -->|"writes events"| node_outbox
node_outbox -->|"persists events"| node_database
node_outbox -.->|"relays events"| node_c2
node_worker -->|"projects positions"| node_radar
node_models -->|"supplies model"| node_detector
node_operator -->|"uses dashboard"| node_app
node_app -->|"routes views"| node_pages
node_app -->|"loads camera data"| node_client
node_client -->|"requests data"| node_api
node_api -->|"dispatches requests"| node_routes
node_routes -->|"reads and writes"| node_database
node_routes -->|"controls cameras"| node_worker
node_routes -->|"serves evidence"| node_evidence

click node_worker "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/services/stream_worker.py"
click node_media "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/media_gateway.py"
click node_pipeline "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/pipeline.py"
click node_detector "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/detector.py"
click node_face "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/face.py"
click node_tracker "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/tracker.py"
click node_anpr "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/anpr.py"
click node_ocr "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/ocr_worker.py"
click node_rules "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/zone_engine.py"
click node_watchlist "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/watchlist.py"
click node_radar "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/homography.py"
click node_models "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/model_manager.py"
click node_evidence "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/evidence.py"
click node_outbox "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/events/outbox.py"
click node_database "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/db.py"
click node_api "https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/api/app.py"
click node_routes "https://github.com/reallynotbaka/ibvap/tree/main/src/ibvap/api/routes"
click node_app "https://github.com/reallynotbaka/ibvap/blob/main/frontend/src/App.tsx"
click node_pages "https://github.com/reallynotbaka/ibvap/tree/main/frontend/src/pages"
click node_client "https://github.com/reallynotbaka/ibvap/blob/main/frontend/src/lib/api.ts"

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_worker,node_media toneBlue
class node_pipeline,node_detector,node_face,node_tracker,node_anpr,node_ocr,node_rules,node_watchlist,node_radar,node_models toneAmber
class node_evidence,node_outbox,node_database,node_c2 toneMint
class node_api,node_routes,node_app,node_pages,node_client toneRose
class node_sources,node_operator toneIndigo
```

## Components

### Video ingestion

- [Stream worker](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/services/stream_worker.py): `src/ibvap/services/stream_worker.py`
- [Media gateway](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/media_gateway.py): `src/ibvap/core/media_gateway.py`

### Analytics

- [Per-camera pipeline](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/pipeline.py): `src/ibvap/core/pipeline.py`
- [Object detection](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/detector.py): `src/ibvap/core/detector.py`
- [Face biometrics](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/face.py): `src/ibvap/core/face.py`
- [Target tracking](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/tracker.py): `src/ibvap/core/tracker.py`
- [Plate recognition](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/anpr.py): `src/ibvap/core/anpr.py`
- [OCR matching](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/ocr_worker.py): `src/ibvap/core/ocr_worker.py`
- [Fence rules](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/zone_engine.py): `src/ibvap/core/zone_engine.py`
- [Watchlist matching](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/watchlist.py): `src/ibvap/core/watchlist.py`
- [BEV projection](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/homography.py): `src/ibvap/core/homography.py`
- [Model management](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/model_manager.py): `src/ibvap/core/model_manager.py`

### Events and evidence

- [Evidence capture](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/core/evidence.py): `src/ibvap/core/evidence.py`
- [Event dispatch](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/events/outbox.py): `src/ibvap/events/outbox.py`
- [Event persistence](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/db.py): `src/ibvap/db.py`

### API and dashboard

- [FastAPI application](https://github.com/reallynotbaka/ibvap/blob/main/src/ibvap/api/app.py): `src/ibvap/api/app.py`
- [Product API routes](https://github.com/reallynotbaka/ibvap/tree/main/src/ibvap/api/routes): `src/ibvap/api/routes`
- [Dashboard shell](https://github.com/reallynotbaka/ibvap/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Operator pages](https://github.com/reallynotbaka/ibvap/tree/main/frontend/src/pages): `frontend/src/pages`
- [API client](https://github.com/reallynotbaka/ibvap/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Other components

- **Video sources**
- **C2 webhook**
- **Operator**

## Connections

- Video sources → Stream worker: provides video
- Stream worker → Media gateway: opens streams
- Stream worker → Per-camera pipeline: submits frames
- Per-camera pipeline → Object detection: detects objects
- Per-camera pipeline → Face biometrics: detects faces
- Per-camera pipeline → Target tracking: tracks targets
- Stream worker → Plate recognition: requests plate analysis
- Stream worker → OCR matching: matches OCR results
- Per-camera pipeline → Fence rules: checks intrusion
- Per-camera pipeline → Watchlist matching: checks identities
- Per-camera pipeline → Evidence capture: attaches evidence
- Per-camera pipeline → Event dispatch: writes events
- Event dispatch → Event persistence: persists events
- Event dispatch → C2 webhook: relays events
- Stream worker → BEV projection: projects positions
- Model management → Object detection: supplies model
- Operator → Dashboard shell: uses dashboard
- Dashboard shell → Operator pages: routes views
- Dashboard shell → API client: loads camera data
- API client → FastAPI application: requests data
- FastAPI application → Product API routes: dispatches requests
- Product API routes → Event persistence: reads and writes
- Product API routes → Stream worker: controls cameras
- Product API routes → Evidence capture: serves evidence
