# asguizar/lcd-watch-testing architecture

> Architecture diagram of the GitHub repository asguizar/lcd-watch-testing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/asguizar/lcd-watch-testing
- Repository: https://github.com/asguizar/lcd-watch-testing

## Overview

##### Project type and purpose
- CareGuardian-IMU is a real-time data-visualization web application. Its primary goal is to collect inertial sensor (IMU) data—either from an actual device (e.g., QMI8658) or from a simulator—and display accelerometer and gyroscope readings live in a browser using Chart.js.
- Key technologies: Node.js, MQTT, WebSockets, Chart.js.

##### File structure
- Top‐level files:
- server.js       → Node.js HTTP & WebSocket server, MQTT client
- mqtt-simulator.js → optional script to publish IMU-like data to MQTT
- imu_data_log.jsonl → recorded sample data (optional replay or logging)
- package.json, package-lock.json → dependencies (mqtt, ws, express, chart.js, etc.)
- README.md
- No dedicated “frontend” folder—static client assets (HTML/JS) are likely served from server.js.
- No microservices: this is a single‐process backend handling both HTTP/WebSocket serving and MQTT subscription.

##### README for additional insights
- Confirms WebSocket URL ws://localhost:3000.
- Mentions real-time streaming of accelerometer/gyroscope data.
- Notes integration path: IMU hardware → MQTT → WebSocket → Chart.js.

– Labels: Component names, protocol names (MQTT, WebSocket, HTTP)
- blue for backend server,
- orange for front-end/browser.

##### Detailed breakdown
- (Optional) show “imu_data_log.jsonl” connected as a data source for Node.js

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Ingress Layer
    subgraph "Data Ingress Layer"
        direction TB
        Sensor["IMU Sensor"]:::external
        Simulator["mqtt-simulator.js"]:::external
        Sensor -->|"MQTT publish imu/data"| Broker
        Simulator -->|"MQTT publish imu/data"| Broker
    end

    Broker["MQTT Broker"]:::external

    %% Backend Processing Layer
    subgraph "Backend Processing Layer"
        direction TB
        Server["Node.js server (server.js)"]:::backend
        subgraph "Server Components"
            direction TB
            MQTTClient["MQTT Client"]:::backend
            WS["WebSocket Server"]:::backend
            HTTP["HTTP Server (static assets)"]:::backend
            Log["imu_data_log.jsonl"]:::persistence
        end
        Broker -->|"MQTT message imu/data"| MQTTClient
        MQTTClient -->|"onMessage→broadcast"| WS
        HTTP -->|"HTTP GET / static assets"| Browser
        WS -->|"ws://localhost:3000"| Browser
        Server -->|"append data"| Log
        Log -->|"read/replay"| Server
    end

    Browser["Browser + Chart.js UI"]:::frontend

    %% Dependencies
    subgraph "Dependencies"
        direction TB
        pkg["package.json"]:::config
        modules["node_modules"]:::config
    end
    Server --> pkg
    Server --> modules

    %% Click Events
    click Simulator "https://github.com/asguizar/lcd-watch-testing/blob/main/mqtt-simulator.js"
    click Server "https://github.com/asguizar/lcd-watch-testing/blob/main/server.js"
    click Log "https://github.com/asguizar/lcd-watch-testing/blob/main/imu_data_log.jsonl"
    click pkg "https://github.com/asguizar/lcd-watch-testing/blob/main/package.json"
    click modules "https://github.com/asguizar/lcd-watch-testing/tree/main/node_modules"

    %% Styles
    classDef external fill:#b2f2bb,stroke:#2f9e44,color:#1b4332;
    classDef backend fill:#9ec5fe,stroke:#228be6,color:#0c53a0;
    classDef frontend fill:#ffd8a8,stroke:#ff922b,color:#d9480f;
    classDef persistence fill:#e9ecef,stroke:#868e96,color:#495057;
    classDef config fill:#fff3bf,stroke:#fcc419,color:#854d0e;
```
