# arka79/dropwire architecture

> Architecture diagram of the GitHub repository arka79/dropwire, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arka79/dropwire
- Repository: https://github.com/arka79/dropwire

## Overview

Dropwire is a browser-to-browser file-sharing application: devices create or join temporary rooms, discover one another through a Socket.IO signaling service, establish WebRTC connections, then send files directly between peers. The signaling server brokers room state and connection handshakes; file bytes travel over the peer data channel. The graph follows the room UI through session coordination, signaling, peer setup, and transfer handling, with room storage and transfer controls as separate stages. Some features are documented but their implementation was not sampled; those branches use README evidence or are left unconnected where wiring is unknown.

Main entry points: [`components/room/room-screen.tsx`](https://github.com/arka79/dropwire/blob/main/components/room/room-screen.tsx) (Room screen), [`lib/room/session.ts`](https://github.com/arka79/dropwire/blob/main/lib/room/session.ts) (Room session), [`server/signaling/server.ts`](https://github.com/arka79/dropwire/blob/main/server/signaling/server.ts) (Signaling service), [`lib/webrtc/transfer.ts`](https://github.com/arka79/dropwire/blob/main/lib/webrtc/transfer.ts) (Transfer engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry"]
  node_landing["Landing page<br/>[landing.tsx]"]
  node_room_route["Room route<br/>[page.tsx]"]
end

subgraph group_room["Room experience"]
  node_room_ui["Room screen<br/>[room-screen.tsx]"]
  node_sharing_ui["Room sharing<br/>[room-dialogs.tsx]"]
  node_participants["Participants<br/>[participants.tsx]"]
  node_file_picker["File selection<br/>[drop-zone.tsx]"]
  node_transfer_ui["Transfer controls<br/>[transfer-row.tsx]"]
end

subgraph group_coordination["Session coordination"]
  node_session_hook["Session hook"]
  node_room_session["Room session<br/>[session.ts]"]
  node_device_identity["Device identity<br/>[identity.ts]"]
end

subgraph group_signaling["Room signaling"]
  node_signaling_client["Signaling client<br/>[socket.ts]"]
  node_signaling_server["Signaling service<br/>[server.ts]"]
  node_room_store[("Room state<br/>[rooms.ts]")]
  node_server_config["Signaling config<br/>[config.ts]"]
end

subgraph group_transfer["Peer transfer"]
  node_peer_connection["WebRTC peer link<br/>[peer.ts]"]
  node_transfer_engine["Transfer engine<br/>[transfer.ts]"]
  node_chunk_protocol["Chunk framing<br/>[chunks.ts]"]
  node_incoming_files["Incoming offers<br/>[incoming-panel.tsx]"]
end

node_device(("Device user"))
node_peer(("Other devices"))

node_device -->|"opens app"| node_landing
node_landing -->|"opens room dialogs"| node_sharing_ui
node_sharing_ui -->|"creates room"| node_room_session
node_sharing_ui -->|"requests signaling"| node_signaling_client
node_device -->|"opens room link"| node_room_route
node_room_route -->|"renders screen"| node_room_ui
node_room_ui -->|"starts session hook"| node_session_hook
node_session_hook -->|"creates session"| node_room_session
node_room_session -->|"loads identity"| node_device_identity
node_room_session -->|"joins and signals"| node_signaling_client
node_signaling_client -->|"sends room events"| node_signaling_server
node_signaling_server -->|"reads and updates rooms"| node_room_store
node_signaling_server -->|"uses settings"| node_server_config
node_signaling_server -->|"relays handshakes"| node_signaling_client
node_room_session -->|"creates peer links"| node_peer_connection
node_peer_connection -->|"connects directly or relayed"| node_peer
node_room_session -->|"manages transfers"| node_transfer_engine
node_transfer_engine -->|"sends file bytes"| node_peer
node_transfer_engine -->|"frames file chunks"| node_chunk_protocol
node_room_ui -->|"accepts selected files"| node_file_picker
node_room_ui -->|"shows room peers"| node_participants
node_room_ui -->|"shows transfer state"| node_transfer_ui
node_room_ui -->|"shows incoming offers"| node_incoming_files
node_incoming_files -->|"accepts or rejects offers"| node_transfer_engine

click node_landing "https://github.com/arka79/dropwire/blob/main/components/landing/landing.tsx"
click node_room_route "https://github.com/arka79/dropwire/blob/main/app/room/%5BroomId%5D/page.tsx"
click node_room_ui "https://github.com/arka79/dropwire/blob/main/components/room/room-screen.tsx"
click node_sharing_ui "https://github.com/arka79/dropwire/blob/main/components/landing/room-dialogs.tsx"
click node_participants "https://github.com/arka79/dropwire/blob/main/components/room/participants.tsx"
click node_file_picker "https://github.com/arka79/dropwire/blob/main/components/room/drop-zone.tsx"
click node_transfer_ui "https://github.com/arka79/dropwire/blob/main/components/transfer/transfer-row.tsx"
click node_session_hook "https://github.com/arka79/dropwire/blob/main/hooks/use-room-session.ts"
click node_room_session "https://github.com/arka79/dropwire/blob/main/lib/room/session.ts"
click node_device_identity "https://github.com/arka79/dropwire/blob/main/lib/identity.ts"
click node_signaling_client "https://github.com/arka79/dropwire/blob/main/lib/signaling/socket.ts"
click node_signaling_server "https://github.com/arka79/dropwire/blob/main/server/signaling/server.ts"
click node_room_store "https://github.com/arka79/dropwire/blob/main/server/signaling/rooms.ts"
click node_server_config "https://github.com/arka79/dropwire/blob/main/server/signaling/config.ts"
click node_peer_connection "https://github.com/arka79/dropwire/blob/main/lib/webrtc/peer.ts"
click node_transfer_engine "https://github.com/arka79/dropwire/blob/main/lib/webrtc/transfer.ts"
click node_chunk_protocol "https://github.com/arka79/dropwire/blob/main/lib/webrtc/chunks.ts"
click node_incoming_files "https://github.com/arka79/dropwire/blob/main/components/transfer/incoming-panel.tsx"

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_room_route,node_device toneBlue
class node_room_ui,node_sharing_ui,node_participants,node_file_picker,node_transfer_ui toneAmber
class node_session_hook,node_room_session,node_device_identity toneMint
class node_signaling_client,node_signaling_server,node_room_store,node_server_config toneRose
class node_peer_connection,node_transfer_engine,node_chunk_protocol,node_incoming_files,node_peer toneIndigo
```

## Components

### Web entry

- [Landing page](https://github.com/arka79/dropwire/blob/main/components/landing/landing.tsx): `components/landing/landing.tsx`
- [Room route](https://github.com/arka79/dropwire/blob/main/app/room/%5BroomId%5D/page.tsx): `app/room/[roomId]/page.tsx`

### Room experience

- [Room screen](https://github.com/arka79/dropwire/blob/main/components/room/room-screen.tsx): `components/room/room-screen.tsx`
- [Room sharing](https://github.com/arka79/dropwire/blob/main/components/landing/room-dialogs.tsx): `components/landing/room-dialogs.tsx`
- [Participants](https://github.com/arka79/dropwire/blob/main/components/room/participants.tsx): `components/room/participants.tsx`
- [File selection](https://github.com/arka79/dropwire/blob/main/components/room/drop-zone.tsx): `components/room/drop-zone.tsx`
- [Transfer controls](https://github.com/arka79/dropwire/blob/main/components/transfer/transfer-row.tsx): `components/transfer/transfer-row.tsx`

### Session coordination

- [Session hook](https://github.com/arka79/dropwire/blob/main/hooks/use-room-session.ts): `hooks/use-room-session.ts`
- [Room session](https://github.com/arka79/dropwire/blob/main/lib/room/session.ts): `lib/room/session.ts`
- [Device identity](https://github.com/arka79/dropwire/blob/main/lib/identity.ts): `lib/identity.ts`

### Room signaling

- [Signaling client](https://github.com/arka79/dropwire/blob/main/lib/signaling/socket.ts): `lib/signaling/socket.ts`
- [Signaling service](https://github.com/arka79/dropwire/blob/main/server/signaling/server.ts): `server/signaling/server.ts`
- [Room state](https://github.com/arka79/dropwire/blob/main/server/signaling/rooms.ts): `server/signaling/rooms.ts`
- [Signaling config](https://github.com/arka79/dropwire/blob/main/server/signaling/config.ts): `server/signaling/config.ts`

### Peer transfer

- [WebRTC peer link](https://github.com/arka79/dropwire/blob/main/lib/webrtc/peer.ts): `lib/webrtc/peer.ts`
- [Transfer engine](https://github.com/arka79/dropwire/blob/main/lib/webrtc/transfer.ts): `lib/webrtc/transfer.ts`
- [Chunk framing](https://github.com/arka79/dropwire/blob/main/lib/webrtc/chunks.ts): `lib/webrtc/chunks.ts`
- [Incoming offers](https://github.com/arka79/dropwire/blob/main/components/transfer/incoming-panel.tsx): `components/transfer/incoming-panel.tsx`

### Other components

- **Device user**
- **Other devices**

## Connections

- Device user → Landing page: opens app
- Landing page → Room sharing: opens room dialogs (evidence: `components/landing/landing.tsx`)
- Room sharing → Room session: creates room (evidence: `components/landing/room-dialogs.tsx`)
- Room sharing → Signaling client: requests signaling (evidence: `components/landing/room-dialogs.tsx`)
- Device user → Room route: opens room link
- Room route → Room screen: renders screen (evidence: `app/room/[roomId]/page.tsx`)
- Room screen → Session hook: starts session hook (evidence: `components/room/room-screen.tsx`)
- Session hook → Room session: creates session (evidence: `hooks/use-room-session.ts`)
- Room session → Device identity: loads identity (evidence: `lib/room/session.ts`)
- Room session → Signaling client: joins and signals (evidence: `lib/room/session.ts`)
- Signaling client → Signaling service: sends room events
- Signaling service → Room state: reads and updates rooms (evidence: `server/signaling/server.ts`)
- Signaling service → Signaling config: uses settings (evidence: `server/signaling/server.ts`)
- Signaling service → Signaling client: relays handshakes
- Room session → WebRTC peer link: creates peer links (evidence: `lib/room/session.ts`)
- WebRTC peer link → Other devices: connects directly or relayed
- Room session → Transfer engine: manages transfers (evidence: `lib/room/session.ts`)
- Transfer engine → Other devices: sends file bytes
- Transfer engine → Chunk framing: frames file chunks (evidence: `lib/webrtc/transfer.ts`)
- Room screen → File selection: accepts selected files (evidence: `components/room/room-screen.tsx`)
- Room screen → Participants: shows room peers (evidence: `components/room/room-screen.tsx`)
- Room screen → Transfer controls: shows transfer state (evidence: `components/room/room-screen.tsx`)
- Room screen → Incoming offers: shows incoming offers (evidence: `components/room/room-screen.tsx`)
- Incoming offers → Transfer engine: accepts or rejects offers (evidence: `components/transfer/incoming-panel.tsx`)
