# zoom/videosdk-web-telehealth architecture

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

- Interactive diagram: https://gitdiagram.com/zoom/videosdk-web-telehealth
- Repository: https://github.com/zoom/videosdk-web-telehealth

## Overview

##### Main System Components

A. Frontend Layer
- Next.js Pages (src/pages)
- React Components hierarchy:
- Core Components (BloodGroup, Doctor, Patient)
- Video Components (VideocallContainer, Videocall)
- UI Components (shadcn/ui components)
- Chat Components
- Relationship with Zoom Video SDK

B. API Layer
- tRPC Router structure (src/server/api/routers)
- Session Router
- User Router
- Zoom Router
- S3 Router
- NextAuth Authentication flow
- API Routes

C. External Services
- Zoom Video SDK
- S3 Storage
- Database (Prisma)

##### Component Relationships

- Double lines: Data streaming (video/audio)

##### Specific Implementation Details

A. Authentication Flow
- NextAuth integration with the frontend
- How session management works

B. Video Communication
- Demonstrate Zoom Video SDK integration
- Flow of video/audio streaming
- Recording and transcription features

C. Data Flow
- How patient/doctor data moves through the system
- File upload/download paths to S3
- Demonstrate database interactions through Prisma

##### Technical Stack Highlights

- Next.js/React
- tRPC
- Prisma
- Zoom Video SDK
- NextAuth
- Tailwind CSS
- TypeScript

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        NextPages["Next.js Pages"]
        CoreComp["Core Components"]
        VideoComp["Video Components"]
        UIComp["UI Components"]
        ChatComp["Chat Components"]
        
        NextPages --> CoreComp
        NextPages --> VideoComp
        NextPages --> UIComp
        NextPages --> ChatComp
        
        subgraph Core["Core Components"]
            Patient["Patient Management"]:::component
            Doctor["Doctor Management"]:::component
            BloodGroup["Blood Group"]:::component
        end
        
        subgraph Video["Video Components"]
            VContainer["Video Container"]:::component
            VCall["Video Interface"]:::component
            Record["Recording"]:::component
            Trans["Transcription"]:::component
        end
        
        subgraph Chat["Chat System"]
            ChatInt["Chat Interface"]:::component
        end
        
        subgraph UI["UI Components"]
            Header["Header"]:::component
            Footer["Footer"]:::component
            CommonUI["Common UI Elements"]:::component
        end
    end
    
    subgraph API["API Layer"]
        TRPC["tRPC Root"]:::component
        
        subgraph Routers["tRPC Routers"]
            SessionR["Session Router"]:::component
            UserR["User Router"]:::component
            ZoomR["Zoom Router"]:::component
            S3R["S3 Router"]:::component
        end
        
        Auth["NextAuth"]:::component
        AuthUtils["Auth Utilities"]:::component
    end
    
    subgraph External["External Services"]
        ZoomSDK["Zoom Video SDK"]
        S3["S3 Storage"]:::component
        DB["Database"]:::component
        JWT["JWT Signing"]:::component
    end
    
    %% Connections
    Frontend -.-> API
    API --> External
    Auth --> Frontend
    ZoomSDK --> VideoComp
    S3 --> S3R
    DB --> TRPC
    
    %% Click Events
    click Patient "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/components/Patient.tsx"
    click Doctor "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/components/Doctor.tsx"
    click BloodGroup "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/components/BloodGroup.tsx"
    click VContainer "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/components/videocall/VideocallContainer.tsx"
    click VCall "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/components/videocall/Videocall.tsx"
    click Record "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/components/videocall/RecordingButton.tsx"
    click Trans "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/components/videocall/Transcript.tsx"
    click ChatInt "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/components/chat/Chat.tsx"
    click TRPC "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/server/api/root.ts"
    click SessionR "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/server/api/routers/session.ts"
    click UserR "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/server/api/routers/user.ts"
    click ZoomR "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/server/api/routers/zoom.ts"
    click S3R "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/server/api/routers/S3.ts"
    click Auth "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/pages/api/auth/[...nextauth].ts"
    click AuthUtils "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/server/auth.ts"
    click S3 "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/utils/set-s3-policy.ts"
    click DB "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/server/db.ts"
    click JWT "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/utils/signJwt.ts"
    click Header "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/components/ui/header.tsx"
    click Footer "https://github.com/zoom/VideoSDK-Web-Telehealth/blob/main/src/components/ui/footer.tsx"
    click CommonUI "https://github.com/zoom/VideoSDK-Web-Telehealth/tree/main/src/components/ui"
    
    %% Styles
    classDef component fill:#f9f,stroke:#333,stroke-width:2px
    classDef frontend fill:#ddf,stroke:#333
    classDef api fill:#dfd,stroke:#333
    classDef external fill:#ffd,stroke:#333
    
    %% Legend
    subgraph Legend
        L1["Frontend Component"]:::frontend
        L2["API Component"]:::api
        L3["External Service"]:::external
    end
```
