# vantezzen/blymp-io architecture

> Architecture diagram of the GitHub repository vantezzen/blymp-io, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vantezzen/blymp-io
- Repository: https://github.com/vantezzen/blymp-io

## Overview

##### Project type and purpose
- blymp.io is a full-stack web application (PWA) for peer-to-peer file transfers across devices.
- It uses React/TypeScript on the frontend, Node.js/Express on the backend, WebSockets for signaling, WebRTC DataChannels for file transfer, and zlib for optional compression.

##### File structure
- Top-level:
- src/client/ — React/TypeScript frontend
- src/server/ — Node/Express signaling server (socket.js)
- Configuration: Dockerfile, fly.toml, webpack.config.js, babel, ESLint, Tailwind, tsconfig.json
- Patterns:
- Client organized into components, pages (Next.js-style routes), and service classes (Connection, UploadService, DownloadService, compression processors)
- Server is a lightweight signaling endpoint using WebSockets (socket.js)

##### README for additional insights
- Confirms use of WebRTC, WebSockets, PWA, zlib compression, no persistent database.
- Explains build flow: webpack → dist, server serves both API and static assets.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        A1["PWA Client (React/TypeScript)"]:::frontend
        A2["Static Assets & PWA Shell"]:::frontend
        A3["Frontend Entry Point"]:::frontend
        A4["Application Routing & Pages"]:::frontend
        A5["UI Components"]:::frontend
        A6["Service Worker Registration"]:::frontend
        A7["Connection (Signaling & PeerConnection Logic)"]:::frontend
        A8["Transfer Orchestration"]:::frontend
        A9["Upload Service"]:::frontend
        A10["Download Service"]:::frontend
        A11["Compression Layer (Upload)"]:::peer
        A12["Upload Providers"]:::frontend
        A13["Decompression Layer (Download)"]:::peer
        A14["Download Processors"]:::frontend
    end

    %% Server Layer
    subgraph "Server Layer"
        direction TB
        B1["Signaling Server (Express + WebSockets)"]:::backend
        B2["Socket Handlers"]:::backend
        B3["Webpack Build & Static Hosting"]:::infra
        B4["Docker & Deployment Config"]:::infra
        B5["TypeScript & Linting Config"]:::infra
    end

    %% Peer-to-Peer Layer
    subgraph "Peer-to-Peer Layer"
        direction TB
        C1["WebRTC PeerConnection"]:::peer
        C2["WebRTC DataChannel"]:::peer
    end

    %% Relationships
    A1 -->|"loads via HTTP"| A2
    A1 -->|"executes"| A3
    A3 -->|"uses"| A4
    A4 -->|"renders"| A5
    A1 -->|"registers"| A6
    A7 -->|"WebSocket ↔ Signaling"| B1
    B1 -->|"routes to"| B2
    A7 -->|"negotiates SDP/ICE"| C1
    C1 -->|"opens"| C2
    A8 -->|"manages"| C2
    A9 -->|"chunks & optionally compress"| A11
    A11 -->|"sends via"| C2
    C2 -->|"receives"| A13
    A13 -->|"passes to"| A10
    A10 -->|"processes via"| A14

    %% Config & Infra links
    B3 -->|"builds client"| A2
    B3 -->|"serves assets"| A1
    B4 -->|"defines deployment"| B3
    B5 -->|"configures"| A1 & B1

    %% Click Events
    click A1 "https://github.com/vantezzen/blymp-io/tree/master/src/client/"
    click A2 "https://github.com/vantezzen/blymp-io/tree/master/public/"
    click A3 "https://github.com/vantezzen/blymp-io/blob/master/src/client/index.tsx"
    click A4 "https://github.com/vantezzen/blymp-io/blob/master/src/client/Routes.tsx"
    click A5 "https://github.com/vantezzen/blymp-io/tree/master/src/client/components/"
    click A6 "https://github.com/vantezzen/blymp-io/blob/master/src/client/register-worker.tsx"
    click A7 "https://github.com/vantezzen/blymp-io/blob/master/src/client/classes/Connection.ts"
    click A8 "https://github.com/vantezzen/blymp-io/blob/master/src/client/classes/Transfer.ts"
    click A9 "https://github.com/vantezzen/blymp-io/blob/master/src/client/classes/UploadService.ts"
    click A10 "https://github.com/vantezzen/blymp-io/blob/master/src/client/classes/DownloadService.ts"
    click A11 "https://github.com/vantezzen/blymp-io/blob/master/src/client/classes/uploadProviders/CompressionUploadProvider.ts"
    click A12 "https://github.com/vantezzen/blymp-io/blob/master/src/client/classes/uploadProviders/UploadProvider.ts"
    click A12 "https://github.com/vantezzen/blymp-io/blob/master/src/client/classes/uploadProviders/FileInputUploadProvider.ts"
    click A13 "https://github.com/vantezzen/blymp-io/blob/master/src/client/classes/downloadProcessors/DecompressProcessor.ts"
    click A14 "https://github.com/vantezzen/blymp-io/blob/master/src/client/classes/downloadProcessors/DownloadProcessor.ts"
    click A14 "https://github.com/vantezzen/blymp-io/blob/master/src/client/classes/downloadProcessors/DefaultProcessor.ts"
    click B1 "https://github.com/vantezzen/blymp-io/blob/master/src/server/index.js"
    click B2 "https://github.com/vantezzen/blymp-io/blob/master/src/server/socket.js"
    click B3 "https://github.com/vantezzen/blymp-io/blob/master/webpack.config.js"
    click B4 "https://github.com/vantezzen/blymp-io/tree/master/Dockerfile"
    click B4 "https://github.com/vantezzen/blymp-io/blob/master/fly.toml"
    click B5 "https://github.com/vantezzen/blymp-io/blob/master/tsconfig.json"
    click B5 "https://github.com/vantezzen/blymp-io/blob/master/.eslintrc.json"
    click B5 "https://github.com/vantezzen/blymp-io/blob/master/.babelrc"
    click B5 "https://github.com/vantezzen/blymp-io/blob/master/tailwind.config.js"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef peer fill:#FFA500,stroke:#333,stroke-width:1px
    classDef infra fill:#D3D3D3,stroke:#333,stroke-width:1px
```
