# azlanajju/multidevice-cam-streamer architecture

> Architecture diagram of the GitHub repository azlanajju/multidevice-cam-streamer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/azlanajju/multidevice-cam-streamer
- Repository: https://github.com/azlanajju/multidevice-cam-streamer

## Overview

CamDeck turns phones into camera sources: a host creates a room, phones join by code or QR, and the host previews and selects a live feed. WebRTC carries media directly between each phone and the host; the backend handles room state, authentication, signaling, and control rather than video. The graph preserves the documented preview-to-program quality switch and the REST, WebSocket, and ICE configuration surfaces. Some frontend wiring is documented but its source excerpts were not provided, so those relationships are marked unverified.

Main entry points: [`frontend/src/hooks/useHostRoom.ts`](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/hooks/useHostRoom.ts) (Host room state), [`backend/src/http.ts`](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/http.ts) (HTTP API), [`backend/src/signaling.ts`](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/signaling.ts) (Socket signaling), [`frontend/src/components/HostDashboard.tsx`](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/HostDashboard.tsx) (Host dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_landing["Room entry<br/>[LandingActions.tsx]"]
  node_hostui["Host dashboard<br/>[HostDashboard.tsx]"]
  node_cards["Camera cards<br/>[CameraCard.tsx]"]
  node_monitor["Program monitor<br/>[MainVideo.tsx]"]
  node_qr["Join QR<br/>[QrPanel.tsx]"]
  node_joinui["Camera join UI<br/>[JoinRoomScreen.tsx]"]
  node_hostroom["Host room state<br/>[useHostRoom.ts]"]
end

subgraph group_capture["Camera and media"]
  node_camera["Camera device state<br/>[useCameraDevice.ts]"]
  node_sender["Camera WebRTC sender<br/>[CameraSender.ts]"]
  node_receiver["Host WebRTC receiver<br/>[HostReceiver.ts]"]
  node_media["Capture and quality<br/>[media.ts]"]
  node_peerutils["Peer utilities<br/>[peerUtils.ts]"]
end

subgraph group_signaling["Room signaling"]
  node_api["REST client<br/>[api.ts]"]
  node_config["Endpoint config<br/>[config.ts]"]
  node_socket["Socket client<br/>[socket.ts]"]
  node_protocol["Shared protocol<br/>[index.ts]"]
end

subgraph group_runtime["Backend runtime"]
  node_http["HTTP API<br/>[http.ts]"]
  node_signalserver["Socket signaling<br/>[signaling.ts]"]
  node_rooms[("Room and presence state<br/>[rooms.ts]")]
  node_ids["Identity and tokens<br/>[ids.ts]"]
  node_ice["ICE configuration<br/>[ice.ts]"]
  node_server["Server composition<br/>[server.ts]"]
end

node_host(("Host operator"))
node_phone(("Camera phone"))

node_host -->|"creates room"| node_landing
node_phone -->|"joins room"| node_joinui
node_landing -.->|"starts session"| node_hostroom
node_joinui -.->|"sets up camera"| node_camera
node_hostroom -.->|"supplies room state"| node_hostui
node_camera -.->|"provides media"| node_sender
node_hostui -->|"renders"| node_cards
node_hostui -->|"renders"| node_monitor
node_hostui -->|"renders"| node_qr
node_sender -->|"sets send quality"| node_media
node_sender -->|"uses"| node_peerutils
node_receiver -->|"uses"| node_peerutils
node_sender -->|"sends media"| node_receiver
node_hostroom -.->|"switches feed"| node_receiver
node_api -->|"reads endpoints"| node_config
node_hostroom -.->|"requests room"| node_api
node_camera -.->|"signals session"| node_socket
node_hostroom -.->|"sends control"| node_socket
node_api -->|"calls REST API"| node_http
node_socket -->|"exchanges events"| node_signalserver
node_http -->|"creates and joins"| node_rooms
node_http -->|"normalizes codes"| node_ids
node_signalserver -->|"authenticates and updates"| node_rooms
node_signalserver -->|"gets ICE servers"| node_ice
node_signalserver -.->|"uses message types"| node_protocol
node_http -.->|"uses response types"| node_protocol
node_server -->|"creates app"| node_http
node_server -->|"creates socket server"| node_signalserver
node_server -->|"sweeps rooms"| node_rooms
node_rooms -->|"generates credentials"| node_ids

click node_landing "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/LandingActions.tsx"
click node_hostui "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/HostDashboard.tsx"
click node_cards "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/CameraCard.tsx"
click node_monitor "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/MainVideo.tsx"
click node_qr "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/QrPanel.tsx"
click node_joinui "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/JoinRoomScreen.tsx"
click node_hostroom "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/hooks/useHostRoom.ts"
click node_camera "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/hooks/useCameraDevice.ts"
click node_sender "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/webrtc/CameraSender.ts"
click node_receiver "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/webrtc/HostReceiver.ts"
click node_media "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/webrtc/media.ts"
click node_peerutils "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/webrtc/peerUtils.ts"
click node_api "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/api.ts"
click node_config "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/config.ts"
click node_socket "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/socket.ts"
click node_protocol "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/shared/src/index.ts"
click node_http "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/http.ts"
click node_signalserver "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/signaling.ts"
click node_rooms "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/rooms.ts"
click node_ids "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/ids.ts"
click node_ice "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/ice.ts"
click node_server "https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/server.ts"

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_landing,node_hostui,node_cards,node_monitor,node_qr,node_joinui,node_hostroom toneBlue
class node_camera,node_sender,node_receiver,node_media,node_peerutils toneAmber
class node_api,node_config,node_socket,node_protocol toneMint
class node_http,node_signalserver,node_rooms,node_ids,node_ice,node_server toneRose
class node_host,node_phone toneIndigo
```

## Components

### Frontend experience

- [Room entry](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/LandingActions.tsx): `frontend/src/components/LandingActions.tsx`
- [Host dashboard](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/HostDashboard.tsx): `frontend/src/components/HostDashboard.tsx`
- [Camera cards](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/CameraCard.tsx): `frontend/src/components/CameraCard.tsx`
- [Program monitor](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/MainVideo.tsx): `frontend/src/components/MainVideo.tsx`
- [Join QR](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/QrPanel.tsx): `frontend/src/components/QrPanel.tsx`
- [Camera join UI](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/components/JoinRoomScreen.tsx): `frontend/src/components/JoinRoomScreen.tsx`
- [Host room state](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/hooks/useHostRoom.ts): `frontend/src/hooks/useHostRoom.ts`

### Camera and media

- [Camera device state](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/hooks/useCameraDevice.ts): `frontend/src/hooks/useCameraDevice.ts`
- [Camera WebRTC sender](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/webrtc/CameraSender.ts): `frontend/src/lib/webrtc/CameraSender.ts`
- [Host WebRTC receiver](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/webrtc/HostReceiver.ts): `frontend/src/lib/webrtc/HostReceiver.ts`
- [Capture and quality](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/webrtc/media.ts): `frontend/src/lib/webrtc/media.ts`
- [Peer utilities](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/webrtc/peerUtils.ts): `frontend/src/lib/webrtc/peerUtils.ts`

### Room signaling

- [REST client](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Endpoint config](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/config.ts): `frontend/src/lib/config.ts`
- [Socket client](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/frontend/src/lib/socket.ts): `frontend/src/lib/socket.ts`
- [Shared protocol](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/shared/src/index.ts): `shared/src/index.ts`

### Backend runtime

- [HTTP API](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/http.ts): `backend/src/http.ts`
- [Socket signaling](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/signaling.ts): `backend/src/signaling.ts`
- [Room and presence state](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/rooms.ts): `backend/src/rooms.ts`
- [Identity and tokens](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/ids.ts): `backend/src/ids.ts`
- [ICE configuration](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/ice.ts): `backend/src/ice.ts`
- [Server composition](https://github.com/azlanajju/multidevice-cam-streamer/blob/main/backend/src/server.ts): `backend/src/server.ts`

### Other components

- **Host operator**
- **Camera phone**

## Connections

- Host operator → Room entry: creates room
- Camera phone → Camera join UI: joins room
- Room entry → Host room state: starts session
- Camera join UI → Camera device state: sets up camera
- Host room state → Host dashboard: supplies room state
- Camera device state → Camera WebRTC sender: provides media
- Host dashboard → Camera cards: renders (evidence: `frontend/src/components/HostDashboard.tsx`)
- Host dashboard → Program monitor: renders (evidence: `frontend/src/components/HostDashboard.tsx`)
- Host dashboard → Join QR: renders (evidence: `frontend/src/components/HostDashboard.tsx`)
- Camera WebRTC sender → Capture and quality: sets send quality (evidence: `frontend/src/lib/webrtc/CameraSender.ts`)
- Camera WebRTC sender → Peer utilities: uses (evidence: `frontend/src/lib/webrtc/CameraSender.ts`)
- Host WebRTC receiver → Peer utilities: uses (evidence: `frontend/src/lib/webrtc/HostReceiver.ts`)
- Camera WebRTC sender → Host WebRTC receiver: sends media
- Host room state → Host WebRTC receiver: switches feed
- REST client → Endpoint config: reads endpoints (evidence: `frontend/src/lib/api.ts`)
- Host room state → REST client: requests room
- Camera device state → Socket client: signals session
- Host room state → Socket client: sends control
- REST client → HTTP API: calls REST API
- Socket client → Socket signaling: exchanges events
- HTTP API → Room and presence state: creates and joins (evidence: `backend/src/http.ts`)
- HTTP API → Identity and tokens: normalizes codes (evidence: `backend/src/http.ts`)
- Socket signaling → Room and presence state: authenticates and updates (evidence: `backend/src/signaling.ts`)
- Socket signaling → ICE configuration: gets ICE servers (evidence: `backend/src/signaling.ts`)
- Socket signaling → Shared protocol: uses message types
- HTTP API → Shared protocol: uses response types
- Server composition → HTTP API: creates app (evidence: `backend/src/server.ts`)
- Server composition → Socket signaling: creates socket server (evidence: `backend/src/server.ts`)
- Server composition → Room and presence state: sweeps rooms (evidence: `backend/src/server.ts`)
- Room and presence state → Identity and tokens: generates credentials (evidence: `backend/src/rooms.ts`)
