# medconnect1024/mediconnect architecture

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

- Interactive diagram: https://gitdiagram.com/medconnect1024/mediconnect
- Repository: https://github.com/medconnect1024/mediconnect

## Overview

##### Main System Components

Frontend Layer:
- Public Routes (/app/(public))
- Home page
- About page
- AI Assist features
- Blog
- Medical Team pages
- Private Routes (/app/(private))
- Dashboard
- Appointment management
- Consultation
- Hospital management
- Patient management
- Registration desk
- UI Components Layer (/components)
- Shared components
- UI elements
- Page-specific components

Backend Services:
- Convex Backend (/convex)
- Authentication
- Database operations
- Real-time updates
- API Routes (/app/api)
- QR generation
- IoT data handling
- AI/ML services
- Embeddings generation

External Services:
- OpenAI integration (for AI features)
- WhatsApp integration (via WATI)
- IoT devices connection

**[Client Browsers/Devices] → [CDN/Edge Network]**

**[Next.js Frontend]**
- Public Routes
- Private Routes
- UI Components

**[Backend Services]**
- Convex Backend
- API Routes
- External Services

**[Databases]**
- Convex Database
- File Storage

##### Important Relationships to Highlight

- Authentication flow between public and private routes
- Real-time data flow through Convex
- Demonstrate the AI/ML pipeline for the AI-assist feature
- Appointment scheduling flow
- Integration points with external services

##### Technical Stack Indicators

- Next.js 13+
- React
- Convex
- TypeScript
- Tailwind CSS
- OpenAI
- WhatsApp Business API
- IoT Protocols

##### Data Flow Patterns

- Client-server communication
- Real-time updates
- Authentication flow
- File upload/download paths
- External API interactions

- Appointment scheduling system
- Patient management flow
- AI-assisted diagnosis
- Hospital management system

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
        IoTDev["IoT Devices"]
    end

    subgraph "Frontend Application"
        subgraph "Public Routes"
            PublicRoutes["/Public Routes"]:::frontend
            Home["Home Page"]:::frontend
            AIAssist["AI Assist"]:::frontend
            MedTeam["Medical Team"]:::frontend
        end

        subgraph "Private Routes"
            PrivateRoutes["/Private Routes"]:::frontend
            Dashboard["Dashboard"]:::frontend
            Appointments["Appointment Management"]:::frontend
            Hospital["Hospital Management"]:::frontend
            Patient["Patient Management"]:::frontend
            RegDesk["Registration Desk"]:::frontend
            Videos["Video Management"]:::frontend
            Prescriptions["Prescription System"]:::frontend
        end

        subgraph "UI Components"
            UILayer["/Components"]:::frontend
            SharedUI["Shared Components"]:::frontend
            PageUI["Page Components"]:::frontend
            VideoPlayer["Video Player"]:::frontend
        end
    end

    subgraph "Backend Services"
        subgraph "Convex Backend"
            ConvexDB["Convex Database"]:::database
            Auth["Authentication"]:::security
            RealTime["Real-time Updates"]:::backend
            ConvexAPI["Convex API"]:::backend
        end

        subgraph "API Routes"
            QRGen["QR Generation"]:::api
            IoTAPI["IoT Data Handler"]:::api
            AIML["AI/ML Services"]:::api
            Embeddings["Embeddings Generation"]:::api
        end
    end

    subgraph "External Services"
        OpenAI["OpenAI"]:::external
        WhatsApp["WhatsApp/WATI"]:::external
    end

    %% Relationships
    Browser --> PublicRoutes
    Browser --> PrivateRoutes
    IoTDev --> IoTAPI
    
    PublicRoutes --> ConvexAPI
    PrivateRoutes --> ConvexAPI
    
    ConvexAPI --> ConvexDB
    Auth --> ConvexDB
    
    AIML --> OpenAI
    ConvexAPI --> WhatsApp
    
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#9b59b6,stroke:#8e44ad,color:white
    classDef api fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#e74c3c,stroke:#c0392b,color:white

    %% Click Events
    click PublicRoutes "https://github.com/medconnect1024/MediConnect/tree/main/app/(public)"
    click PrivateRoutes "https://github.com/medconnect1024/MediConnect/tree/main/app/(private)"
    click UILayer "https://github.com/medconnect1024/MediConnect/tree/main/components"
    click ConvexAPI "https://github.com/medconnect1024/MediConnect/tree/main/convex"
    click AIML "https://github.com/medconnect1024/MediConnect/tree/main/app/api/getEmbeddings"
    click AIAssist "https://github.com/medconnect1024/MediConnect/tree/main/app/(public)/ai-assist"
    click Appointments "https://github.com/medconnect1024/MediConnect/tree/main/app/(private)/(main)/appointmment"
    click Hospital "https://github.com/medconnect1024/MediConnect/tree/main/app/(private)/(main)/hospitals"
    click Patient "https://github.com/medconnect1024/MediConnect/tree/main/app/(private)/(main)/patientinfo"
    click RegDesk "https://github.com/medconnect1024/MediConnect/tree/main/app/(private)/(main)/registrationdesk"
    click IoTAPI "https://github.com/medconnect1024/MediConnect/tree/main/app/api/iot-data"
    click Auth "https://github.com/medconnect1024/MediConnect/blob/main/convex/auth.config.ts"
    click MedTeam "https://github.com/medconnect1024/MediConnect/tree/main/app/(public)/medical-team"
    click Videos "https://github.com/medconnect1024/MediConnect/tree/main/app/(private)/(main)/videospage"
    click VideoPlayer "https://github.com/medconnect1024/MediConnect/blob/main/components/VideoPlayer.tsx"
    click Prescriptions "https://github.com/medconnect1024/MediConnect/blob/main/components/pages/Prescription.tsx"
```
