# zenithreddyp/p2p_file_sharing_platform architecture

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

- Interactive diagram: https://gitdiagram.com/zenithreddyp/p2p_file_sharing_platform
- Repository: https://github.com/zenithreddyp/p2p_file_sharing_platform

## Overview

Velosync is a browser-based peer-to-peer file-sharing application. A sender creates a temporary session and shares its link or QR code; a receiver joins through the signaling server, peers negotiate WebRTC and exchange ECDH public keys, then transfer encrypted file data directly over a data channel. The server handles signaling, rate limiting, and audit events, not file storage. The graph also preserves the informational pages and network visualization. Some session and transfer details are documented in the README; only the shown source excerpts and index references were used for implementation relationships.

Main entry points: [`frontend/src/App.jsx`](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/App.jsx) (Routes), [`frontend/src/webrtc.js`](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/webrtc.js) (WebRTC and socket client), [`frontend/src/pages/SessionCreate.jsx`](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/SessionCreate.jsx) (Create and share session), [`backend/routes/websocket.js`](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/backend/routes/websocket.js) (Signaling and rooms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Web application"]
  node_entry["React entry<br/>[main.jsx]"]
  node_router["Routes<br/>[App.jsx]"]
  node_networkviz["Network visualization<br/>[P2PNetwork.jsx]"]
  node_header["Navigation header<br/>[Header.jsx]"]
end

subgraph group_connection["Session and connection"]
  node_session["Create and share session<br/>[SessionCreate.jsx]"]
  node_loading["Join and handshake<br/>[LoadingPage.jsx]"]
  node_rtc["WebRTC and socket client<br/>[webrtc.js]"]
end

subgraph group_transfer["Secure transfer"]
  node_keys["ECDH key exchange<br/>[Encryption.js]"]
  node_files["File transfer<br/>[FileTransfer.jsx]"]
end

subgraph group_server["Signaling services"]
  node_signaling["Signaling and rooms<br/>[websocket.js]"]
  node_serverentry["HTTP server<br/>[server.js]"]
  node_audit["Audit logging<br/>[auditlogger.js]"]
end

subgraph group_information["Information pages"]
  node_about["About page<br/>[About.jsx]"]
  node_how["How it works page<br/>[HowItWorks.jsx]"]
  node_privacy["Privacy page<br/>[Privacy.jsx]"]
end

node_user(("User"))
node_peer(("Receiving peer"))
node_stun["STUN and TURN"]

node_user -->|"opens app"| node_entry
node_entry -->|"renders"| node_router
node_router -->|"routes to"| node_session
node_router -->|"routes to"| node_files
node_router -->|"routes to"| node_loading
node_router -->|"renders"| node_networkviz
node_router -->|"routes to"| node_about
node_router -->|"routes to"| node_how
node_router -->|"routes to"| node_privacy
node_session -->|"uses signaling"| node_rtc
node_loading -->|"uses signaling"| node_rtc
node_session -->|"exchanges keys"| node_keys
node_loading -->|"derives key"| node_keys
node_files -->|"transfers over"| node_rtc
node_files -->|"uses session key"| node_keys
node_serverentry -->|"starts"| node_signaling
node_signaling -->|"records events"| node_audit
node_session -->|"creates room"| node_signaling
node_loading -->|"joins room"| node_signaling
node_signaling -->|"relays negotiation"| node_rtc
node_rtc -->|"negotiates connection"| node_peer
node_rtc -->|"uses traversal"| node_stun
node_files -->|"sends encrypted data"| node_peer
node_session -->|"shares link or QR"| node_user
node_about -->|"renders"| node_header
node_how -->|"renders"| node_header
node_privacy -->|"renders"| node_header

click node_entry "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/main.jsx"
click node_router "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/App.jsx"
click node_networkviz "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/P2PNetwork.jsx"
click node_header "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/components/Header.jsx"
click node_session "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/SessionCreate.jsx"
click node_loading "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/LoadingPage.jsx"
click node_rtc "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/webrtc.js"
click node_signaling "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/backend/routes/websocket.js"
click node_serverentry "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/backend/server.js"
click node_audit "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/backend/utils/auditlogger.js"
click node_keys "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/Encryption.js"
click node_files "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/FileTransfer.jsx"
click node_about "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/About.jsx"
click node_how "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/HowItWorks.jsx"
click node_privacy "https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/Privacy.jsx"

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_router,node_networkviz,node_header,node_user toneBlue
class node_session,node_loading,node_rtc toneAmber
class node_keys,node_files toneMint
class node_signaling,node_serverentry,node_audit toneRose
class node_about,node_how,node_privacy,node_peer,node_stun toneIndigo
```

## Components

### Web application

- [React entry](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Routes](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Network visualization](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/P2PNetwork.jsx): `frontend/src/pages/P2PNetwork.jsx`
- [Navigation header](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/components/Header.jsx): `frontend/src/components/Header.jsx`

### Session and connection

- [Create and share session](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/SessionCreate.jsx): `frontend/src/pages/SessionCreate.jsx`
- [Join and handshake](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/LoadingPage.jsx): `frontend/src/pages/LoadingPage.jsx`
- [WebRTC and socket client](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/webrtc.js): `frontend/src/webrtc.js`

### Secure transfer

- [ECDH key exchange](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/Encryption.js): `frontend/src/Encryption.js`
- [File transfer](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/FileTransfer.jsx): `frontend/src/pages/FileTransfer.jsx`

### Signaling services

- [Signaling and rooms](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/backend/routes/websocket.js): `backend/routes/websocket.js`
- [HTTP server](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/backend/server.js): `backend/server.js`
- [Audit logging](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/backend/utils/auditlogger.js): `backend/utils/auditlogger.js`

### Information pages

- [About page](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/About.jsx): `frontend/src/pages/About.jsx`
- [How it works page](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/HowItWorks.jsx): `frontend/src/pages/HowItWorks.jsx`
- [Privacy page](https://github.com/zenithreddyp/p2p_file_sharing_platform/blob/main/frontend/src/pages/Privacy.jsx): `frontend/src/pages/Privacy.jsx`

### Other components

- **User**
- **Receiving peer**
- **STUN and TURN**

## Connections

- User → React entry: opens app (evidence: `frontend/src/main.jsx`)
- React entry → Routes: renders (evidence: `frontend/src/main.jsx`)
- Routes → Create and share session: routes to (evidence: `frontend/src/App.jsx`)
- Routes → File transfer: routes to (evidence: `frontend/src/App.jsx`)
- Routes → Join and handshake: routes to (evidence: `frontend/src/App.jsx`)
- Routes → Network visualization: renders (evidence: `frontend/src/App.jsx`)
- Routes → About page: routes to (evidence: `frontend/src/App.jsx`)
- Routes → How it works page: routes to (evidence: `frontend/src/App.jsx`)
- Routes → Privacy page: routes to (evidence: `frontend/src/App.jsx`)
- Create and share session → WebRTC and socket client: uses signaling (evidence: `frontend/src/pages/SessionCreate.jsx`)
- Join and handshake → WebRTC and socket client: uses signaling (evidence: `frontend/src/pages/LoadingPage.jsx`)
- Create and share session → ECDH key exchange: exchanges keys (evidence: `frontend/src/pages/SessionCreate.jsx`)
- Join and handshake → ECDH key exchange: derives key (evidence: `frontend/src/pages/LoadingPage.jsx`)
- File transfer → WebRTC and socket client: transfers over (evidence: `frontend/src/pages/FileTransfer.jsx`)
- File transfer → ECDH key exchange: uses session key (evidence: `frontend/src/pages/FileTransfer.jsx`)
- HTTP server → Signaling and rooms: starts (evidence: `backend/server.js`)
- Signaling and rooms → Audit logging: records events (evidence: `backend/routes/websocket.js`)
- Create and share session → Signaling and rooms: creates room (evidence: `README.md`)
- Join and handshake → Signaling and rooms: joins room (evidence: `README.md`)
- Signaling and rooms → WebRTC and socket client: relays negotiation (evidence: `backend/routes/websocket.js`)
- WebRTC and socket client → Receiving peer: negotiates connection (evidence: `README.md`)
- WebRTC and socket client → STUN and TURN: uses traversal (evidence: `frontend/src/webrtc.js`)
- File transfer → Receiving peer: sends encrypted data (evidence: `README.md`)
- Create and share session → User: shares link or QR (evidence: `README.md`)
- About page → Navigation header: renders (evidence: `frontend/src/pages/About.jsx`)
- How it works page → Navigation header: renders (evidence: `frontend/src/pages/HowItWorks.jsx`)
- Privacy page → Navigation header: renders (evidence: `frontend/src/pages/Privacy.jsx`)
