# luisnguyen1/dappmeeting architecture

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

- Interactive diagram: https://gitdiagram.com/luisnguyen1/dappmeeting
- Repository: https://github.com/luisnguyen1/dappmeeting

## Overview

##### Project Type & Purpose
- The project is a decentralized meeting application that combines blockchain (via smart contracts) and WebRTC for secure and private video conferencing.
- The primary purpose is to manage meeting rooms, authenticate participants using smart contracts, and provide a real-time communication interface using WebRTC, with some advanced frontend effects (like background blur and face mask filters).

##### Key Components Identified
a. Smart Contract:
- Located in the "bin/smartconstract" directory and further documented under "documents/SmartConstract.md".
- Handles room management, participant authentication, and event propagation.
b. Backend:
- Found in the "Backend" directory, with Go language files (e.g., main.go, MyContract.go, EventHandler.go).
- Acts as the bridge between blockchain events and WebRTC sessions. It also integrates with Cloudflare services for handling media sessions (as indicated by cloudflareService.go and integration details in "documents/Backend.md").
c. Frontend:
- The "frontend" directory contains HTML pages, JavaScript files, CSS, and assets.
- It supplies the user interface and manages interactions with both the smart contract (via blockchain calls) and WebRTC (for media streaming and additional effects).
d. External Services:
- Blockchain network (hosting the deployed smart contract).
- Cloudflare (used for media handling and signaling for WebRTC sessions).

##### Relationships & Interactions
- The Frontend interacts with:
- The smart contract (for room creation, joining meetings, and verifying participants) via blockchain connection.
- The Backend API to facilitate WebRTC session setup and real-time events.
- The Backend:
- Listens to events from the smart contract.
- Manages interactions with Cloudflare for media transmission and session management.
- Acts as the communication hub between blockchain events and frontend notifications.
- The Smart Contract:
- Serves as a decentralized authentication and room management service, providing a secure mechanism to manage meeting parameters and participant data.

##### Architectural Patterns & Design Principles
- Separation of Concerns: The project clearly divides responsibilities between the frontend (user experience), backend (logic and integration), and smart contract (decentralized authentication and state management).
- Modular Architecture: Different directories (Backend, frontend, bin, documents) indicate a modular design where each component is independently maintainable.
- Event-Driven Communication: The backend’s event listener and contract event handling illustrate an event-driven model to propagate changes from the blockchain to the application.
- Use of Industry Standards: Go for backend processing, JavaScript/HTML/CSS for frontend, and smart contracts for blockchain integration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Subgraphs
    subgraph "Blockchain Layer"
        SC["Smart Contract (Blockchain)"]:::blockchain
    end

    subgraph "Backend Service Layer"
        BE["Backend Service"]:::backend
        MG["main.go"]:::backendFile
        MC["MyContract.go"]:::backendFile
        EH["EventHandler.go"]:::backendFile
        SM["SMCall.go"]:::backendFile
        CSB["Cloudflare Service (Backend)"]:::backendFile
        BDOC["Backend Documentation"]:::backendFile
    end

    subgraph "Frontend Client Layer"
        FE["Frontend Client"]:::frontend
        IDX["index.html"]:::frontendFile
        JOIN["join.html"]:::frontendFile
        ROOM["room.html"]:::frontendFile
        CSS["CSS (frontend/css)"]:::frontendFile
        CEL["contractEventListener.js"]:::frontendFile
        SCI["smartContractIntegration.js"]:::frontendFile
        AUTH["auth.js"]:::frontendFile
        BB["backgroundBlur.js"]:::frontendFile
        FMF["FaceMaskFilter.js"]:::frontendFile
        CFC["CloudflareCalls.js"]:::frontendFile
    end

    subgraph "External Services"
        BNET["Blockchain Network"]:::externalService
        CF["Cloudflare Service (External)"]:::externalService
    end

    %% Relationships & Data Flow
    FE -->|"API_calls"| BE
    FE -->|"Blockchain_calls"| SC
    BE -->|"Event_listening"| SC
    SC -->|"hosted_on"| BNET
    BE -->|"media_management"| CF
    CFC -->|"cloudflare_integration"| CF

    %% Click Events - Smart Contract
    click SC "https://github.com/luisnguyen1/dappmeeting/tree/main/bin/smartconstract"
    
    %% Click Events - Backend Service
    click BE "https://github.com/luisnguyen1/dappmeeting/tree/main/Backend"
    click MG "https://github.com/luisnguyen1/dappmeeting/blob/main/Backend/main.go"
    click MC "https://github.com/luisnguyen1/dappmeeting/blob/main/Backend/constract/MyContract.go"
    click EH "https://github.com/luisnguyen1/dappmeeting/blob/main/Backend/handle/EventHandler.go"
    click SM "https://github.com/luisnguyen1/dappmeeting/blob/main/Backend/handle/SMCall.go"
    click CSB "https://github.com/luisnguyen1/dappmeeting/blob/main/Backend/handle/cloudflareService.go"
    click BDOC "https://github.com/luisnguyen1/dappmeeting/blob/main/documents/Backend.md"

    %% Click Events - Frontend Client
    click FE "https://github.com/luisnguyen1/dappmeeting/tree/main/frontend"
    click IDX "https://github.com/luisnguyen1/dappmeeting/blob/main/frontend/index.html"
    click JOIN "https://github.com/luisnguyen1/dappmeeting/blob/main/frontend/join.html"
    click ROOM "https://github.com/luisnguyen1/dappmeeting/blob/main/frontend/room.html"
    click CSS "https://github.com/luisnguyen1/dappmeeting/tree/main/frontend/css"
    click CEL "https://github.com/luisnguyen1/dappmeeting/blob/main/frontend/contractEventListener.js"
    click SCI "https://github.com/luisnguyen1/dappmeeting/blob/main/frontend/smartContractIntegration.js"
    click AUTH "https://github.com/luisnguyen1/dappmeeting/blob/main/frontend/auth.js"
    click BB "https://github.com/luisnguyen1/dappmeeting/blob/main/frontend/backgroundBlur.js"
    click FMF "https://github.com/luisnguyen1/dappmeeting/blob/main/frontend/FaceMaskFilter.js"
    click CFC "https://github.com/luisnguyen1/dappmeeting/blob/main/frontend/js/CloudflareCalls.js"
    
    %% Click Events - Smart Contract Documentation
    click SC "https://github.com/luisnguyen1/dappmeeting/blob/main/documents/SmartConstract.md"

    %% Style Definitions
    classDef frontend fill:#C7F9CC,stroke:#2B9348,stroke-width:2px;
    classDef backend fill:#BDE0FE,stroke:#3A86FF,stroke-width:2px;
    classDef blockchain fill:#FEC8D8,stroke:#FF006E,stroke-width:2px;
    classDef externalService fill:#FFF5BA,stroke:#F4D35E,stroke-width:2px;
    classDef frontendFile fill:#EAF4F4,stroke:#1985A1,stroke-width:1px,stroke-dasharray: 4 2;
    classDef backendFile fill:#E3FDFD,stroke:#0D3B66,stroke-width:1px,stroke-dasharray: 4 2;
```
