# amine-31/droplocal architecture

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

- Interactive diagram: https://gitdiagram.com/amine-31/droplocal
- Repository: https://github.com/amine-31/droplocal

## Overview

DropLocal lets nearby browsers discover one another and send files directly over WebRTC. A device opens the web app, joins a network-scoped room, sees peers, and selects or drops files; the receiver can accept or decline, and both sides see transfer progress and completion. The server handles presence and signaling, not file bytes. The client also owns peer-connection setup and the queued, backpressure-aware transfer protocol. Client implementation details are sampled only in part, so unsampled UI and reconnect links follow README descriptions.

Main entry points: [`public/client.js`](https://github.com/amine-31/droplocal/blob/main/public/client.js) (Browser client), [`public/index.html`](https://github.com/amine-31/droplocal/blob/main/public/index.html) (App page), [`server.js`](https://github.com/amine-31/droplocal/blob/main/server.js) (Web server), [`public/styles.css`](https://github.com/amine-31/droplocal/blob/main/public/styles.css) (Responsive styles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser app"]
  node_page["App page<br/>[index.html]"]
  node_styles["Responsive styles<br/>[styles.css]"]
  node_client["Browser client<br/>[client.js]"]
end

subgraph group_lobby["Presence and signaling"]
  node_server["Web server<br/>[server.js]"]
  node_rooms[("Room presence<br/>[server.js]")]
  node_relay["Signal relay<br/>[server.js]"]
end

subgraph group_transfer["Peer transfer"]
  node_peer["WebRTC connection<br/>[client.js]"]
  node_files["File transfer<br/>[client.js]"]
end

node_device(("User device"))
node_stun["Google STUN"]

node_device -->|"opens"| node_page
node_page -->|"loads"| node_client
node_page -->|"uses"| node_styles
node_client -->|"joins /ws"| node_server
node_server -->|"tracks presence"| node_rooms
node_server -->|"routes signals"| node_relay
node_client -->|"sends signaling"| node_relay
node_relay -->|"forwards signaling"| node_peer
node_client -->|"creates connection"| node_peer
node_peer -.->|"queries ICE"| node_stun
node_client -->|"queues transfers"| node_files
node_files -->|"uses data channel"| node_peer
node_peer -->|"carries file bytes"| node_files

click node_page "https://github.com/amine-31/droplocal/blob/main/public/index.html"
click node_styles "https://github.com/amine-31/droplocal/blob/main/public/styles.css"
click node_client "https://github.com/amine-31/droplocal/blob/main/public/client.js"
click node_server "https://github.com/amine-31/droplocal/blob/main/server.js"
click node_rooms "https://github.com/amine-31/droplocal/blob/main/server.js"
click node_relay "https://github.com/amine-31/droplocal/blob/main/server.js"
click node_peer "https://github.com/amine-31/droplocal/blob/main/public/client.js"
click node_files "https://github.com/amine-31/droplocal/blob/main/public/client.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_page,node_styles,node_client,node_device toneBlue
class node_server,node_rooms,node_relay toneAmber
class node_peer,node_files toneMint
class node_stun toneIndigo
```

## Components

### Browser app

- [App page](https://github.com/amine-31/droplocal/blob/main/public/index.html): `public/index.html`
- [Responsive styles](https://github.com/amine-31/droplocal/blob/main/public/styles.css): `public/styles.css`
- [Browser client](https://github.com/amine-31/droplocal/blob/main/public/client.js): `public/client.js`

### Presence and signaling

- [Web server](https://github.com/amine-31/droplocal/blob/main/server.js): `server.js`
- [Room presence](https://github.com/amine-31/droplocal/blob/main/server.js): `server.js`
- [Signal relay](https://github.com/amine-31/droplocal/blob/main/server.js): `server.js`

### Peer transfer

- [WebRTC connection](https://github.com/amine-31/droplocal/blob/main/public/client.js): `public/client.js`
- [File transfer](https://github.com/amine-31/droplocal/blob/main/public/client.js): `public/client.js`

### Other components

- **User device**
- **Google STUN**

## Connections

- User device → App page: opens (evidence: `README.md`)
- App page → Browser client: loads (evidence: `README.md`)
- App page → Responsive styles: uses (evidence: `README.md`)
- Browser client → Web server: joins /ws (evidence: `README.md`)
- Web server → Room presence: tracks presence (evidence: `server.js`)
- Web server → Signal relay: routes signals (evidence: `server.js`)
- Browser client → Signal relay: sends signaling (evidence: `README.md`)
- Signal relay → WebRTC connection: forwards signaling (evidence: `server.js`)
- Browser client → WebRTC connection: creates connection (evidence: `public/client.js`)
- WebRTC connection → Google STUN: queries ICE (evidence: `README.md`)
- Browser client → File transfer: queues transfers (evidence: `public/client.js`)
- File transfer → WebRTC connection: uses data channel (evidence: `README.md`)
- WebRTC connection → File transfer: carries file bytes (evidence: `README.md`)
