# youssef-reda440/cse3-iot-labs architecture

> Architecture diagram of the GitHub repository youssef-reda440/cse3-iot-labs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/youssef-reda440/cse3-iot-labs
- Repository: https://github.com/youssef-reda440/cse3-iot-labs

## Overview

This lab is a small browser-based IoT lamp dashboard. A user opens the dashboard, which displays lamp controls and sends lamp commands over WebSocket; the server hosts the page and accepts WebSocket connections. The sampled WebSocket handler only logs commands and replies with acknowledgements—it does not control hardware. The lamp and log service files are empty in the excerpts, so no behavior is attributed to them. The HTML is served by the HTTP app, but its script wiring was not sampled.

Main entry points: [`labs/lab-01/websocket/websocket.js`](https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/websocket/websocket.js) (WebSocket handler), [`labs/lab-01/index.js`](https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/index.js) (Runtime entry), [`labs/lab-01/server/server.js`](https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/server/server.js) (HTTP app), [`labs/lab-01/views/index.html`](https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/views/index.html) (Dashboard page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server runtime"]
  node_entry["Runtime entry<br/>[index.js]"]
  node_http["HTTP app<br/>[server.js]"]
end

subgraph group_web["Browser dashboard"]
  node_page["Dashboard page<br/>[index.html]"]
  node_dashboard["Dashboard controls<br/>[dashboard.js]"]
end

subgraph group_transport["WebSocket transport"]
  node_ws["WebSocket handler<br/>[websocket.js]"]
end

node_user(("User"))

node_user -->|"opens"| node_page
node_entry -->|"creates server"| node_http
node_entry -->|"attaches handler"| node_ws
node_http -->|"serves"| node_page
node_dashboard -.->|"sends commands"| node_ws
node_ws -->|"replies to client"| node_user

click node_entry "https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/index.js"
click node_http "https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/server/server.js"
click node_page "https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/views/index.html"
click node_dashboard "https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/views/js/dashboard.js"
click node_ws "https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/websocket/websocket.js"

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_entry,node_http,node_user toneBlue
class node_page,node_dashboard toneAmber
class node_ws toneMint
```

## Components

### Server runtime

- [Runtime entry](https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/index.js): `labs/lab-01/index.js`
- [HTTP app](https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/server/server.js): `labs/lab-01/server/server.js`

### Browser dashboard

- [Dashboard page](https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/views/index.html): `labs/lab-01/views/index.html`
- [Dashboard controls](https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/views/js/dashboard.js): `labs/lab-01/views/js/dashboard.js`

### WebSocket transport

- [WebSocket handler](https://github.com/youssef-reda440/cse3-iot-labs/blob/main/labs/lab-01/websocket/websocket.js): `labs/lab-01/websocket/websocket.js`

### Other components

- **User**

## Connections

- User → Dashboard page: opens
- Runtime entry → HTTP app: creates server (evidence: `labs/lab-01/index.js`)
- Runtime entry → WebSocket handler: attaches handler (evidence: `labs/lab-01/index.js`)
- HTTP app → Dashboard page: serves (evidence: `labs/lab-01/server/server.js`)
- Dashboard controls → WebSocket handler: sends commands
- WebSocket handler → User: replies to client (evidence: `labs/lab-01/websocket/websocket.js`)
