# adityasinh-sodha/airlink architecture

> Architecture diagram of the GitHub repository adityasinh-sodha/airlink, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adityasinh-sodha/airlink
- Repository: https://github.com/adityasinh-sodha/airlink

## Overview

##### Main System Components
- Frontend Client: Represent the user’s browser rendering HTML from the index.html template. This also loads CSS (static/styles.css) and JavaScript (static/script.js). The static/assets directory contains all media and font assets.
- Backend Server: The core is the Flask application (app.py), which handles HTTP requests, routes, and template rendering.
- Real-Time Communication Module: Since Socket.IO is used for enabling real-time file transfers and messaging, include this as a distinct module integrated within the backend.
- Network & Device Discovery: Highlight that part of the logic (likely in both backend and frontend code) detects devices on the same network and handles file routing.
- External Dependencies: Include external libraries such as Flask and Socket.IO (as well as any Python dependencies defined in requirements.txt).

##### Out Relationships and Interactions
- The User Browser sends HTTP GET requests to the Flask server.
- The server responds with rendered HTML and associated static content.
- Once loaded, the JavaScript on the client establishes a Socket.IO connection to the backend.
- Real-time events (such as file sending and messaging) flow between devices via the server’s Socket.IO endpoints.
- The frontend displays available devices and any communication via dynamic updates that are pushed from the server.

##### Architectural Patterns and Design Principles
- Minimal but clear modular breakdown: Since the project isn’t split into many subdirectories (e.g., no separate backend and frontend folders), show that while the structure is simple, the components serve specific clear purposes.

– “Web Browser” that connects to the “Flask Server.”
– Within the Flask Server, indicate two integrated modules: (1) API/HTTP Handler (for serving pages and static files) and (2) Real-Time Socket.IO Handler.
– From the Web Browser to the Flask Server labeled “HTTP Requests” and “Page Rendering.”
- If relevant, a separate section can note “Device Discovery Logic” (this could either be a part of the JavaScript on the client or a background process in the server) to indicate how devices on the network are detected.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Client Subgraph
    subgraph "Frontend Client"
        UI["User Browser"]:::frontend
        HTML["Index.html"]:::frontend
        CSS["styles.css"]:::frontend
        JS["script.js"]:::frontend
        ASSETS["Assets"]:::frontend
        DISCOVERY["Device Discovery"]:::frontend
    end

    %% Backend Server Subgraph
    subgraph "Backend Server"
        HTTP["HTTP Handler"]:::backend
        SOCKET["Socket.IO Handler"]:::backend
    end

    %% External Dependencies
    EXT["External Dependencies"]:::external

    %% Relationships - HTTP Request/Response
    UI -->|"HTTP Requests"| HTTP
    HTTP -->|"Page Rendering"| UI

    %% Relationships - Real-Time Communication
    UI <-->|"Real-Time Events"| SOCKET

    %% Relationship - Static Assets loading
    UI -->|"LoadsContent"| ASSETS

    %% Relationship - Device Discovery
    DISCOVERY -->|"DiscoversDevices"| SOCKET

    %% Relationships - External Dependencies usage
    HTTP -->|"Uses"| EXT
    SOCKET -->|"Uses"| EXT

    %% Click Events
    click HTML "https://github.com/adityasinh-sodha/airlink/blob/main/templates/index.html"
    click CSS "https://github.com/adityasinh-sodha/airlink/blob/main/static/styles.css"
    click JS "https://github.com/adityasinh-sodha/airlink/blob/main/static/script.js"
    click ASSETS "https://github.com/adityasinh-sodha/airlink/tree/main/static/assets/"
    click HTTP "https://github.com/adityasinh-sodha/airlink/blob/main/app.py"
    click SOCKET "https://github.com/adityasinh-sodha/airlink/blob/main/app.py"
    click EXT "https://github.com/adityasinh-sodha/airlink/blob/main/requirements.txt"

    %% Styles
    classDef frontend fill:#A2D5F2,stroke:#1B4F72,stroke-width:2px;
    classDef backend fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef external fill:#C39BD3,stroke:#6C3483,stroke-width:2px;
```
