# cianmawhinney/visca-camera-controller architecture

> Architecture diagram of the GitHub repository cianmawhinney/visca-camera-controller, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cianmawhinney/visca-camera-controller
- Repository: https://github.com/cianmawhinney/visca-camera-controller

## Overview

##### Project type and purpose
- This is a Node.js‐based controller for VISCA‐compatible pan-tilt-zoom cameras.
- It provides three input methods—joystick, web UI, and serial commands—and queues and dispatches VISCA commands to the camera over a serial port.

##### File structure
- Top‐level: Docker/devcontainer files, CI workflows, configuration, package.json, README.
- src/inputs: three input adapters (joystick.js, serial.js, web/…): each feeds camera commands into the system.
- src/requestQueue.js: central queueing and rate-limiting for outgoing VISCA commands.
- src/camera.js: VISCA protocol implementation.
- src/server.js: HTTP server and WebSocket or API endpoints serving the web UI and orchestrating inputs.
- src/config.js & config/config.json(.example): central configuration.
- src/helperFunctions.js: shared utilities.
- test/: unit tests for camera logic.

##### README for insights
- Implements specific VISCA commands (Pan/Tilt, Zoom, Presets, Iris, etc.).
- Describes joystick mapping and planned future web-UI configurability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Layer
    subgraph "Input Layer"
        JS["Joystick Adapter"]:::input
        SC["Serial-Command Adapter"]:::input
        WAE["Web UI Adapter"]:::input
        SA["Web UI Static Assets"]:::input
    end

    %% Server & Core Logic
    subgraph "Server & Core Logic"
        SRV["HTTP/Express Server & Endpoints"]:::core
        Q["Request Queue (rate limiting & dispatch)"]:::core
        CAM["VISCA Driver / Camera Protocol"]:::core
        CFG["Configuration Module"]:::core
        CF1["Config Files"]:::core
        HLP["Helper Utilities"]:::core
    end

    %% External Systems
    subgraph "External Systems"
        JD["Joystick Device"]:::ext
        WB["Web Browser"]:::ext
        PC["Physical Camera"]:::ext
    end

    %% Deployment & CI & Docs
    subgraph "Deployment & Docs"
        DOCKER["Docker & Devcontainer Setup"]:::deployment
        CI["CI Workflow"]:::deployment
        PKG["Package Manifest & Dependencies"]:::docs
        RD["Project Documentation (README)"]:::docs
        TEST["Unit Tests for Camera Logic"]:::docs
    end

    %% Connections
    JD --> JS
    WB --> WAE
    SRV --> SA
    SA --> WB
    JS --> SRV
    SC --> SRV
    WAE --> SRV
    SRV --> Q
    Q --> CAM
    CAM --> PC
    PC --> CAM
    CAM --> SRV
    CFG --> SRV
    CFG --> Q
    CFG --> CAM
    HLP --> SRV
    HLP --> Q
    HLP --> CAM

    %% Deployment & Docs connections
    DOCKER --> SRV
    DOCKER --> CAM
    CI --> SRV
    PKG --> SRV
    RD --> SRV
    TEST --> CAM

    %% Click Events
    click JS "https://github.com/cianmawhinney/visca-camera-controller/blob/master/src/inputs/joystick.js"
    click SC "https://github.com/cianmawhinney/visca-camera-controller/blob/master/src/inputs/serial.js"
    click WAE "https://github.com/cianmawhinney/visca-camera-controller/blob/master/src/inputs/web.js"
    click SA "https://github.com/cianmawhinney/visca-camera-controller/tree/master/src/inputs/web/"
    click SRV "https://github.com/cianmawhinney/visca-camera-controller/blob/master/src/server.js"
    click Q "https://github.com/cianmawhinney/visca-camera-controller/blob/master/src/requestQueue.js"
    click CAM "https://github.com/cianmawhinney/visca-camera-controller/blob/master/src/camera.js"
    click CFG "https://github.com/cianmawhinney/visca-camera-controller/blob/master/src/config.js"
    click CF1 "https://github.com/cianmawhinney/visca-camera-controller/blob/master/config/config.json"
    click HLP "https://github.com/cianmawhinney/visca-camera-controller/blob/master/src/helperFunctions.js"
    click TEST "https://github.com/cianmawhinney/visca-camera-controller/blob/master/test/camera-generic.test.js"
    click DOCKER "https://github.com/cianmawhinney/visca-camera-controller/tree/master/Dockerfile"
    click DOCKER "https://github.com/cianmawhinney/visca-camera-controller/blob/master/docker-compose.yml"
    click DOCKER "https://github.com/cianmawhinney/visca-camera-controller/blob/master/.devcontainer/devcontainer.json"
    click DOCKER "https://github.com/cianmawhinney/visca-camera-controller/blob/master/.devcontainer/docker-compose.yml"
    click CI "https://github.com/cianmawhinney/visca-camera-controller/blob/master/.github/workflows/ci.yaml"
    click PKG "https://github.com/cianmawhinney/visca-camera-controller/blob/master/package.json"
    click RD "https://github.com/cianmawhinney/visca-camera-controller/blob/master/README.md"

    %% Styles
    classDef input fill:#ADD8E6,stroke:#000;
    classDef core fill:#90EE90,stroke:#000;
    classDef ext fill:#FFA500,stroke:#000;
    classDef deployment fill:#D3D3D3,stroke:#000;
    classDef docs fill:#FFFACD,stroke:#000;
```
