# abrarwarunkar/doctor-queue-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/abrarwarunkar/doctor-queue-management-system
- Repository: https://github.com/abrarwarunkar/doctor-queue-management-system

## Overview

##### Project type and purpose
- This is a full-stack MERN (MongoDB, Express.js, React, Node.js) web application with real-time updates powered by Socket.io.
- Purpose: Manage patient queues for a doctor’s clinic, providing role-based interfaces (Receptionist, Doctor, Patient) and a public display.

##### File structure
- Top-level folders:
- client/ – React frontend (components, pages, context, utils)
- server/ – Express backend (config, controllers, middleware, models, routes)
- standalone-queue.html – static public display fallback
- Key files:
- client/src/context/SocketContext.js – WebSocket connection provider
- client/src/utils/api.js – Axios HTTP client
- server/config/socket.js – Socket.io server setup
- server/config/dbInit.js – MongoDB connection initializer
- server/controllers/queueController.js – core queue logic
- server/routes/queueRoutes.js – REST API definitions

##### README for additional insights
- Architecture is described: separate client and server, real-time updates with Socket.io
- Technology stack is listed explicitly, no additional hidden services

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Users
    subgraph "Users"
        direction TB
        ReceptionistBrowser["Receptionist Browser"]:::external
        DoctorBrowser["Doctor Browser"]:::external
        PatientBrowser["Patient Browser"]:::external
        PublicDisplayBrowser["Public Display Browser"]:::external
    end

    %% Frontend Layer
    subgraph "React Client" 
        direction TB
        RC_Pages["Pages"]:::frontend
        subgraph "Pages"
            direction TB
            HomePage["HomePage"]:::frontend
            ReceptionistPage["ReceptionistPage"]:::frontend
            DoctorPage["DoctorPage"]:::frontend
            PatientPage["PatientPage"]:::frontend
            DisplayPage["DisplayPage"]:::frontend
        end
        RC_Components["Components"]:::frontend
        subgraph "Components"
            direction TB
            Navbar["Navbar"]:::frontend
            PatientForm["PatientForm"]:::frontend
            ReceptionistForm["ReceptionistForm"]:::frontend
            PatientList["PatientList"]:::frontend
            QueueStatus["QueueStatus"]:::frontend
            PublicDisplay["PublicDisplay"]:::frontend
        end
        SocketContext["SocketContext"]:::frontend
        APIUtil["Axios API Client"]:::frontend
    end

    %% Backend Layer
    subgraph "Express API / Socket.io Server"
        direction TB
        ServerEntry["server.js"]:::backend
        DBInit["dbInit.js"]:::backend
        SocketConfig["socket.js"]:::backend
        subgraph "Middleware"
            direction TB
            Logger["logger.js"]:::backend
            ErrorHandler["errorHandler.js"]:::backend
        end
        subgraph "Routes"
            direction TB
            QueueRoutes["queueRoutes.js"]:::backend
        end
        subgraph "Controllers"
            direction TB
            QueueController["queueController.js"]:::backend
        end
        subgraph "Models"
            direction TB
            PatientModel["Patient.js"]:::backend
            QueueModel["Queue.js"]:::backend
        end
    end

    %% Database
    MongoDB["MongoDB"]:::database

    %% Relations
    ReceptionistBrowser -->|HTTP / WebSocket| ReactClient["React Client"]
    DoctorBrowser -->|HTTP / WebSocket| ReactClient
    PatientBrowser -->|HTTP / WebSocket| ReactClient
    PublicDisplayBrowser -->|HTTP / WebSocket| ReactClient

    ReactClient -->|REST GET/POST/PATCH| ServerEntry
    ReactClient ---|WebSocket Events| SocketConfig

    ServerEntry --> DBInit
    ServerEntry --> SocketConfig
    ServerEntry --> Logger
    ServerEntry --> ErrorHandler
    ServerEntry --> QueueRoutes

    QueueRoutes --> QueueController
    QueueController --> PatientModel
    QueueController --> QueueModel
    PatientModel --> MongoDB
    QueueModel --> MongoDB

    SocketConfig --> QueueController
    SocketConfig ---|emit/joinQueue| ReactClient

    %% Click Events - Frontend
    click HomePage "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/pages/HomePage.js"
    click ReceptionistPage "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/pages/ReceptionistPage.js"
    click DoctorPage "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/pages/DoctorPage.js"
    click PatientPage "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/pages/PatientPage.js"
    click DisplayPage "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/pages/DisplayPage.js"
    click Navbar "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/components/Navbar.js"
    click PatientForm "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/components/PatientForm.js"
    click ReceptionistForm "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/components/ReceptionistForm.js"
    click PatientList "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/components/PatientList.js"
    click QueueStatus "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/components/QueueStatus.js"
    click PublicDisplay "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/components/PublicDisplay.js"
    click SocketContext "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/context/SocketContext.js"
    click APIUtil "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/client/src/utils/api.js"
    click ReactClient "https://github.com/abrarwarunkar/doctor-queue-management-system/tree/main/client/src"

    %% Click Events - Static Public Display
    click PublicDisplayBrowser "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/standalone-queue.html"

    %% Click Events - Backend
    click ServerEntry "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/server/server.js"
    click DBInit "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/server/config/dbInit.js"
    click SocketConfig "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/server/config/socket.js"
    click Logger "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/server/middleware/logger.js"
    click ErrorHandler "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/server/middleware/errorHandler.js"
    click QueueRoutes "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/server/routes/queueRoutes.js"
    click QueueController "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/server/controllers/queueController.js"
    click PatientModel "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/server/models/Patient.js"
    click QueueModel "https://github.com/abrarwarunkar/doctor-queue-management-system/blob/main/server/models/Queue.js"

    %% Styles
    classDef external fill:#eeeeee,stroke:#999,stroke-width:1px
    classDef frontend fill:#cce5ff,stroke:#4da3ff,stroke-width:2px
    classDef backend fill:#d4edda,stroke:#28a745,stroke-width:2px
    classDef database fill:#fff3cd,stroke:#ffcd39,stroke-width:2px
```
