# fmeringdal/nettu-meet architecture

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

- Interactive diagram: https://gitdiagram.com/fmeringdal/nettu-meet
- Repository: https://github.com/fmeringdal/nettu-meet

## Overview

##### And group the main components
- Frontend Application
– React/TypeScript SPA
– Served via Nginx in Docker
– Feature modules: account, chat, canvas (whiteboard), media manager, meeting flow, file upload, graph plotter
- Backend API Server
– Node.js/TypeScript Express (HTTP + WebSocket)
– Clean architecture layers: HTTP controllers → DTOs → Use-Case interactors → Domain models → Repositories (Mongo implementations)
– Mediasoup SFU service for real-time media routing
– Integrations: MongoDB (persistent storage), Redis (signaling, session), optional email and file-storage services
- Infrastructure
– Docker Compose orchestration (MongoDB, Redis, server container, frontend container)
– CI/CD workflows (.github/workflows)
- External/Third-Party Services
– Email provider (SMTP)
– Storage (for uploaded files)
– Swagger for API docs

##### Relationships and data flows
- User’s Browser ↔ Nginx ↔ React SPA
- React SPA → HTTP REST calls → Express API (e.g., account creation, meeting management, chat history)
- React SPA ↔ WebSocket → Express WebSocket endpoints for chat signaling, canvas updates
- React SPA ↔ WebRTC (via client-side MediaManager and PeersManager) → Mediasoup SFU (deployed within the server container) for audio/video streams
- Express Use-Cases → MongoDB (via mongo…Repo implementations) for persisting users, meetings, canvas data, chat logs
- Signaling messages for WebRTC routed via Redis pub/sub
- Email-verification flows: UseCase → email service → user’s mailbox

##### Architectural patterns and principles
- Clean/Hexagonal architecture in server: isolates business rules (Use-Cases) from HTTP and DB details
- Feature-based modular structure in frontend: each module encapsulates components, services, state, interactors
- Single SPA served behind Nginx for caching/static assets
- Docker for environment consistency; CI/CD workflows automate builds

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Layer
    subgraph "Frontend (React SPA)" 
        direction TB
        Nginx["Nginx Reverse Proxy<br/>(80/443)"]:::infra
        FSPAF["React/TypeScript SPA"]:::frontend
        Nginx --> FSPAF
        FSPAF -->|"HTTP REST"| APIv1
        FSPAF -->|"WebSocket (WS)"| AppConfig
        FSPAF -->|"WebRTC Media"| SFU

        AccountMod["Account Module"]:::frontend
        ChatMod["Chat Module"]:::frontend
        CanvasMod["Canvas Module"]:::frontend
        MediaMod["Media Manager Module"]:::frontend
        MeetingMod["Meeting Flow Module"]:::frontend
        FileUploadComp["FileUploadModal Component"]:::frontend
        GraphUI["GraphCreatorModal Component"]:::frontend

        FSPAF --> AccountMod
        FSPAF --> ChatMod
        FSPAF --> CanvasMod
        FSPAF --> MediaMod
        FSPAF --> MeetingMod
        FSPAF --> FileUploadComp
        FSPAF --> GraphUI
    end

    %% Backend Layer
    subgraph "Backend (Express API + Mediasoup)" 
        direction TB
        APIEntrypoint["Entry Point<br/>server/src/index.ts"]:::backend
        AppConfig["App Config<br/>(HTTP & WS)"]:::backend
        APIv1["API Routing v1"]:::backend

        APIEntrypoint --> AppConfig
        AppConfig --> APIv1

        %% Account Feature
        subgraph "Account Feature"
            direction TB
            AccController["Create/UpdateAccountController"]:::controller
            AccUseCase["Create/UpdateAccountUseCase"]:::usecase
            AccRepo["accountRepo Interface"]:::repo
            AccMongoRepo["mongoAccountRepo"]:::datasource

            APIv1 --> AccController
            AccController --> AccUseCase
            AccUseCase --> AccRepo
            AccRepo --> AccMongoRepo
            AccMongoRepo --> MongoDB
            AccUseCase --> EmailService
        end

        %% Chat Feature
        subgraph "Chat Feature"
            direction TB
            ChatController["Get/SendChatController"]:::controller
            ChatUseCase["Get/SendChatUseCase"]:::usecase
            ChatRepo["chatRepo Interface"]:::repo
            ChatMongoRepo["mongoChatRepo"]:::datasource

            AppConfig --> ChatController
            ChatController --> ChatUseCase
            ChatUseCase --> ChatRepo
            ChatRepo --> ChatMongoRepo
            ChatMongoRepo --> MongoDB
            AppConfig --> Redis
        end

        %% Meeting Feature
        subgraph "Meeting Feature"
            direction TB
            MeetController["Create/GetMeetingController & CanvasController"]:::controller
            MeetUseCase["Create/GetMeetingUseCase"]:::usecase
            MeetRepo["meetingRepo Interface"]:::repo
            MeetMongoRepo["mongoMeetingRepo & mongoCanvasRepo"]:::datasource

            APIv1 --> MeetController
            MeetController --> MeetUseCase
            MeetUseCase --> MeetRepo
            MeetRepo --> MeetMongoRepo
            MeetMongoRepo --> MongoDB
            MeetUseCase --> FileStorage
        end

        %% Mediasoup Service
        SFU["Mediasoup SFU Service"]:::service
        AppConfig --> SFU
        SFU --> FSPAF
    end

    %% Infrastructure & External
    subgraph "Infrastructure & CI/CD"
        direction TB
        DockerCompose["Docker Compose"]:::infra
        CI1["GitHub Actions<br/>frontend-docker.yml"]:::infra
        CI2["GitHub Actions<br/>server.yml"]:::infra

        DockerCompose --> MongoDB
        DockerCompose --> Redis
        DockerCompose --> APIEntrypoint
        DockerCompose --> Nginx
        CI1 --> DockerCompose
        CI2 --> DockerCompose
    end

    subgraph "Data Stores & Services"
        direction TB
        MongoDB["MongoDB"]:::db
        Redis["Redis Pub/Sub"]:::db
        EmailService["Email Service (SMTP)"]:::external
        FileStorage["File Storage Service"]:::external
        Swagger["Swagger Docs"]:::external
    end

    APIv1 --> Swagger

    %% Click Events
    click FSPAF "https://github.com/fmeringdal/nettu-meet/tree/main/frontend/src"
    click Nginx "https://github.com/fmeringdal/nettu-meet/blob/main/frontend/docker/nginx.conf"
    click AccountMod "https://github.com/fmeringdal/nettu-meet/tree/main/frontend/src/modules/account"
    click ChatMod "https://github.com/fmeringdal/nettu-meet/tree/main/frontend/src/modules/chat"
    click CanvasMod "https://github.com/fmeringdal/nettu-meet/tree/main/frontend/src/modules/canvas"
    click MediaMod "https://github.com/fmeringdal/nettu-meet/tree/main/frontend/src/modules/media"
    click MeetingMod "https://github.com/fmeringdal/nettu-meet/tree/main/frontend/src/modules/meeting"
    click FileUploadComp "https://github.com/fmeringdal/nettu-meet/blob/main/frontend/src/shared/components/FileUploadModal.tsx"
    click GraphUI "https://github.com/fmeringdal/nettu-meet/blob/main/frontend/src/modules/canvas/components/GraphCreatorModal.tsx"
    click APIEntrypoint "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/index.ts"
    click AppConfig "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/shared/infra/http/app.ts"
    click APIv1 "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/shared/infra/http/api/v1.ts"
    click AccController "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/account/useCases/**/CreateAccountController.ts"
    click AccUseCase "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/account/useCases/**/CreateAccountUseCase.ts"
    click AccRepo "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/account/repos/accountRepo.ts"
    click AccMongoRepo "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/account/repos/implementations/mongoAccountRepo.ts"
    click ChatController "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/chat/useCases/**/GetChatController.ts"
    click ChatUseCase "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/chat/useCases/**/GetChatUseCase.ts"
    click ChatRepo "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/chat/repos/chatRepo.ts"
    click ChatMongoRepo "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/chat/repos/implementations/mongoChatRepo.ts"
    click MeetController "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/meeting/useCases/**/CreateMeetingController.ts"
    click MeetUseCase "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/meeting/useCases/**/CreateMeetingUseCase.ts"
    click MeetRepo "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/meeting/repos/meetingRepo.ts"
    click MeetMongoRepo "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/meeting/repos/implementations/mongoMeetingRepo.ts"
    click SFU "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/modules/meeting/services/mediasoup/server.ts"
    click MongoDB "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/shared/infra/db/connection.ts"
    click Redis "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/shared/services/redis/redisConnection.ts"
    click EmailService "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/shared/services/email/email.ts"
    click FileStorage "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/shared/services/filestorage/fileStorage.ts"
    click Swagger "https://github.com/fmeringdal/nettu-meet/blob/main/server/src/docs/swagger.yaml"
    click DockerCompose "https://github.com/fmeringdal/nettu-meet/blob/main/server/integrations/docker-compose.yml"
    click CI1 "https://github.com/fmeringdal/nettu-meet/blob/main/.github/workflows/frontend-docker.yml"
    click CI2 "https://github.com/fmeringdal/nettu-meet/blob/main/.github/workflows/server.yml"

    %% Styles
    classDef frontend fill:#f9f,stroke:#333,stroke-width:1px
    classDef backend fill:#bbf,stroke:#333,stroke-width:1px
    classDef controller fill:#aaf,stroke:#333
    classDef usecase fill:#aff,stroke:#333
    classDef repo fill:#fea,stroke:#333
    classDef datasource fill:#dfd,stroke:#333
    classDef service fill:#fbf,stroke:#333
    classDef infra fill:#ffe,stroke:#333
    classDef db fill:#bfb,stroke:#333
    classDef external fill:#ffb,stroke:#333
```
