# bekirbostanci/vda5050_visualizer architecture

> Architecture diagram of the GitHub repository bekirbostanci/vda5050_visualizer, 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/bekirbostanci/vda5050_visualizer
- Repository: https://github.com/bekirbostanci/vda5050_visualizer

## Overview

##### And Define the Main Components
- Frontend/UI:
- The Vue-based application is found under the src directory (e.g., App.vue, views, and components like skeleton-card.vue and vda5050-agv-card components). These components render the data visualizations.
- Controllers & MQTT Management:
- Controllers (in src/controllers such as vda5050-agv.controller.ts, vda5050-visualizer.controller.ts, and vda5050.controller.ts) manage the business logic and routing of the MQTT messages.
- A shared MQTT client exists in the utils folder (shared-mqtt-client.ts and shared-mqtt-example.ts), which encapsulates the connection logic and ensures that the application maintains a single MQTT connection (via WebSocket or Electron IPC).
- Communication & Configuration:
- The application supports two connection types. One is the WebSocket connection (direct to an MQTT broker) and the other is the Electron IPC method for the desktop app; these are configured via settings and observable in the README.
- Desktop Integration:
- The Electron folder (electron/main.js and electron/preload.js) contains the code needed to package and run the web application inside an Electron shell for native desktop execution.
- Additional Elements:
- Public assets (in the public directory) and style/configuration files (like Dockerfiles, ESLint, and tsconfig configurations) round out the project structure.

##### Diagramming the Relationships
- Optionally, include a “MQTT Broker” external component to indicate real-world interactions.

- Data Flow and Interactions:
- Controllers to the shared MQTT client which, in turn, interacts outward to the MQTT Broker.

- Architectural Patterns:
- The separation of concerns (UI, controllers, and utility functions) should be visually clear, reinforcing the MVC-like or layered architecture.

##### Technology and Frameworks
- That the frontend is built with Vue (using Vite for building/running in development).
- Electron layer for desktop application support.
- MQTT as the key technology for communication, and note the dual connection modes (WebSocket and IPC).
- Optionally, mention Docker (the Dockerfile.dev and Dockerfile.prod) as part of the deployment/infrastructure layer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        A["App.vue"]:::frontend
        B["vda5050-visualizer (views)"]:::frontend
        C["UI Components (src/components)"]:::frontend
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        D["VDA5050 Controllers"]:::backend
        E["Shared MQTT Client<br/>(Singleton)"]:::backend
    end

    %% Integration Layer
    subgraph "Integration Layer"
        F["MQTT Broker"]:::integration
    end

    %% Desktop Integration
    subgraph "Desktop Integration"
        G["Electron Shell"]:::desktop
    end

    %% Configuration & Assets
    subgraph "Configuration & Assets"
        H["Public Assets & Configuration"]:::config
    end

    %% Data Flow Connections
    A -->|"sends_data"| D
    B -->|"sends_data"| D
    C -->|"sends_data"| D
    D -->|"routes_MQTT"| E
    E -->|"via_WebSocket"| F
    G -->|"via_IPC"| E
    H -->|"supplies_assets"| A
    H -->|"supplies_assets"| B
    H -->|"supplies_assets"| C

    %% Click Events
    click A "https://github.com/bekirbostanci/vda5050_visualizer/blob/main/src/App.vue"
    click B "https://github.com/bekirbostanci/vda5050_visualizer/tree/main/src/views/vda5050-visualizer"
    click C "https://github.com/bekirbostanci/vda5050_visualizer/tree/main/src/components"
    click D "https://github.com/bekirbostanci/vda5050_visualizer/tree/main/src/controllers"
    click E "https://github.com/bekirbostanci/vda5050_visualizer/blob/main/src/utils/shared-mqtt-client.ts"
    click G "https://github.com/bekirbostanci/vda5050_visualizer/tree/main/electron"
    click H "https://github.com/bekirbostanci/vda5050_visualizer/tree/main/public"

    %% Styles
    classDef frontend fill:#a2d2ff,stroke:#000,stroke-width:2px;
    classDef backend fill:#ffafcc,stroke:#000,stroke-width:2px;
    classDef integration fill:#caffbf,stroke:#000,stroke-width:2px;
    classDef desktop fill:#ffd6a5,stroke:#000,stroke-width:2px;
    classDef config fill:#d0f4de,stroke:#000,stroke-width:2px;
```
