# 648540858/wvp-gb28181-pro architecture

> Architecture diagram of the GitHub repository 648540858/wvp-gb28181-pro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/648540858/wvp-gb28181-pro
- Repository: https://github.com/648540858/wvp-gb28181-pro

## Overview

##### Main Components
- Frontend Web UI: Represented by the “web_src” folder. This layer is responsible for providing the user interface (web pages, dashboards, and interactive components such as live view, playback, and device configuration).
– GB28181 protocol implementation (handling SIP signaling, device registration, heartbeat, command control, etc.)
– Other protocol support (such as JT1078 for video and custom handlers)
– Media and streaming logic (integrating with ZLMediaKit for transmission, recording, and real‑time streaming)
– Security, API endpoints, and Redis-based messaging (note the “conf/security” and “conf/redis” packages)
– Data persistence via relational databases (MySQL, PostgreSQL, KingBase) as reflected by the numerous database scripts and DAO layers in “storager”
– Session management and event bus/message listeners for push notifications and command responses.
- Media/Streaming Server Integration: Although the actual media server is provided by ZLMediaKit (an external dependency integrated via REST hooks and configuration), include a dedicated “Media Server” component that interacts with the backend (using RESTful APIs, event hooks, etc.). Indicate that the backend can also deploy its own media nodes for load balancing.
- Third-party Libraries/Dependencies: Optionally add smaller components for JDBC libraries (in “libs”) and external front‑end components such as the Jessibuca player and MediaServerUI.

##### Relationships and Interactions
- The backend communicates with the Media Server (and may automatically configure and manage it, as mentioned) for media processing and stream distribution.
- The Frontend (web client) consumes RESTful APIs (and may also use WebSockets for live stream notifications) provided by the backend.
- Internal messaging: Show interactions with Redis, which is used both for caching and for RPC-style messaging between components (as seen in the “conf/redis” and “service/redisMsg” packages).

##### Architectural Patterns and Principles
- Modular design with clear separation between protocol handling (GB28181, JT1078), business service logic, media processing, and user interface.
- Use a layered (or MVC-like) structure for the backend: presentation (API/web controllers), business service layer, data access layer (DAO and storager).
- Use of asynchronous event handling and messaging (e.g., the event, task, session, and transmit packages) which are critical for handling real‑time video, SIP sessions, and server push notifications.
- Support for containerized deployment via Docker and the multi‑architecture (x86 and ARM) support.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Interfaces
    subgraph "External Interfaces"
        ED["External Video Devices (IP Cameras, NVRs, etc.)"]:::external
        MS["Media Server (ZLMediaKit)"]:::external
    end

    %% Deployment & Infrastructure
    subgraph "Deployment & Infrastructure"
        Dock["Docker & Deployment"]:::infra
        Libs["Third-party Libraries"]:::infra
    end

    %% Frontend Layer
    subgraph "Frontend Layer"
        FE["Frontend UI (web_src)"]:::frontend
    end

    %% Backend Application Server and its Modules
    subgraph "Backend API Server (Java/Spring Boot)"
        BE["Backend Application Server"]:::backend
        subgraph "Backend Modules"
            GB["GB28181 Module"]:::backendModule
            JT["JT1078 Module"]:::backendModule
            MM["Media & Streaming Module"]:::backendModule
            SEC["Security/API & Redis Messaging"]:::backendModule
            DP["Data Persistence/Storager Module"]:::backendModule
        end
    end

    %% Database and Redis Messaging
    DB["Database"]:::db
    Redis["Redis Cache/Messaging"]:::messaging

    %% Data Flows and Relationships
    ED -->|"GB28181/RTSP/RTMP-signaling"| BE
    FE -->|"HTTP/HTTPSRESTcalls"| BE
    BE -->|"MediaStreamConfig"| MS
    BE -->|"CRUDoperations"| DB
    SEC -->|"UsesRedis"| Redis
    Dock --> BE
    Dock --> Redis
    Libs --> BE

    %% Linking backend modules back to the core application server
    GB --> BE
    JT --> BE
    MM --> BE
    SEC --> BE
    DP --> BE

    %% Click Events
    click FE "https://github.com/648540858/wvp-gb28181-pro/tree/master/web_src/"
    click BE "https://github.com/648540858/wvp-gb28181-pro/tree/master/src/main/java/com/genersoft/iot/vmp/"
    click GB "https://github.com/648540858/wvp-gb28181-pro/tree/master/src/main/java/com/genersoft/iot/vmp/gb28181/"
    click JT "https://github.com/648540858/wvp-gb28181-pro/tree/master/src/main/java/com/genersoft/iot/vmp/jt1078/"
    click MM "https://github.com/648540858/wvp-gb28181-pro/tree/master/src/main/java/com/genersoft/iot/vmp/media/"
    click MM "https://github.com/648540858/wvp-gb28181-pro/tree/master/src/main/java/com/genersoft/iot/vmp/media/zlm/"
    click SEC "https://github.com/648540858/wvp-gb28181-pro/tree/master/src/main/java/com/genersoft/iot/vmp/conf/security/"
    click SEC "https://github.com/648540858/wvp-gb28181-pro/tree/master/src/main/java/com/genersoft/iot/vmp/conf/redis/"
    click DP "https://github.com/648540858/wvp-gb28181-pro/tree/master/src/main/java/com/genersoft/iot/vmp/storager/"
    click Dock "https://github.com/648540858/wvp-gb28181-pro/tree/master/docker/"
    click Libs "https://github.com/648540858/wvp-gb28181-pro/tree/master/libs/"

    %% Styles
    classDef external fill:#f9e79f,stroke:#d68910,stroke-width:2px;
    classDef frontend fill:#aed6f1,stroke:#5dade2,stroke-width:2px;
    classDef backend fill:#abebc6,stroke:#45b39d,stroke-width:2px;
    classDef backendModule fill:#f5cba7,stroke:#e67e22,stroke-width:2px;
    classDef infra fill:#d7bde2,stroke:#af7ac5,stroke-width:2px;
    classDef db fill:#fad7a0,stroke:#f39c12,stroke-width:2px;
    classDef messaging fill:#bb8fce,stroke:#8e44ad,stroke-width:2px;
```
