# mdtalalwasim/doctor-patient-portal-advancejavawebproject architecture

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

- Interactive diagram: https://gitdiagram.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject
- Repository: https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject

## Overview

##### Main Components
- Frontend (Presentation Layer):
- JSP pages and web components in the "src/main/webapp" directory.
- Separate folders and pages for Admin (e.g., admin_login.jsp, admin dashboard pages), Doctor (doctor_login.jsp, doctor dashboards, profile and comment pages), and User interfaces (user_login.jsp, signup.jsp, appointment pages).
- Backend/Controller Layer:
- Servlet classes found under packages for admin, doctor, and user (e.g., AdminLoginServlet, DoctorLoginServlet, AppointmentServlet, etc.). These handle the request routing, session management, and other business logic.
- Business/Data Access Layer:
- DAO classes (DoctorDAO, UserDAO, AppointmentDAO, SpecialistDAO) that encapsulate the database interactions.
- Entity classes (Doctor, User, Appointment, Specialist) that represent the data model.
- Database Connectivity:
- A dedicated DBConnection class for establishing connections to the MySQL database.
- Build and Configuration:
- Maven’s pom.xml for dependency management and build rules.
- web.xml for servlet configurations.

##### Relationships and Interactions
- HTTP requests enter through the browser to the appropriate servlet based on user role.
- Controller Servlets interact with DAO components to perform CRUD operations on the database via DBConnection.
- Once processed, responses are forwarded to the corresponding JSP pages to generate the HTML that the user sees.

##### Architectural Patterns & Design Principles
- MVC (Model-View-Controller) is the core pattern used.
- Views: JSP pages organized in the webapp directory.
- Controllers: Servlets located in the admin, doctor, and user packages.
- Models: Entity classes and DAO layer.
- Separation of concerns is maintained:
- Different user roles have their own dedicated packages (com.hms/admin, com.hms/doctor, com.hms/user), which makes the system modular and easier to understand.

##### Relevant Technologies & Frameworks
- Java Servlets/JSP for dynamic content generation.
- JSTL and Bootstrap 5 for view design and responsiveness.
- MySQL for persistent data storage.
- Maven for build and dependency management.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Entity
    Browser("Web Browser"):::external

    %% Presentation Layer
    subgraph "Presentation Layer"
        AdminJSP("Admin JSP Pages"):::presentation
        DoctorJSP("Doctor JSP Pages"):::presentation
        UserJSP("User JSP Pages"):::presentation
    end

    %% Controller Layer
    subgraph "Controller Layer"
        AdminServlet("Admin Login Servlet"):::controller
        DoctorServlet("Doctor Login Servlet"):::controller
        UserServlet("User Login Servlet/Appointment Servlet"):::controller
    end

    %% Business/Data Access Layer
    subgraph "Business/Data Access Layer"
        DAO("DAO Classes (DoctorDAO, UserDAO, AppointmentDAO, SpecialistDAO)"):::data
        Entity("Entity Classes (Doctor, User, Appointment, Specialist)"):::data
    end

    %% Database Connectivity
    subgraph "Database Connectivity"
        DBConn("DBConnection"):::data
        MySQL("MySQL Database"):::database
    end

    %% Build & Configuration
    subgraph "Build & Configuration"
        POM("pom.xml"):::config
        WebXML("web.xml"):::config
    end

    %% Data Flow
    Browser -->|"Request"| AdminJSP
    Browser -->|"Request"| DoctorJSP
    Browser -->|"Request"| UserJSP

    AdminJSP -->|"Forward"| AdminServlet
    DoctorJSP -->|"Forward"| DoctorServlet
    UserJSP -->|"Forward"| UserServlet

    AdminServlet -->|"Calls"| DAO
    DoctorServlet -->|"Calls"| DAO
    UserServlet -->|"Calls"| DAO

    DAO -->|"Uses"| DBConn
    DBConn -->|"Connects"| MySQL

    %% Configuration Relationships
    AdminServlet ---|"ConfiguredBy"| WebXML
    DoctorServlet ---|"ConfiguredBy"| WebXML
    UserServlet ---|"ConfiguredBy"| WebXML
    POM ---|"Builds"| WebXML

    %% Click Events
    click AdminJSP "https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject/tree/main/Doctor-Patient-Portal/src/main/webapp/admin"
    click DoctorJSP "https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject/tree/main/Doctor-Patient-Portal/src/main/webapp/doctor"
    click UserJSP "https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject/tree/main/Doctor-Patient-Portal/src/main/webapp"
    click AdminServlet "https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject/tree/main/Doctor-Patient-Portal/src/main/java/com/hms/admin/servlet"
    click DoctorServlet "https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject/tree/main/Doctor-Patient-Portal/src/main/java/com/hms/doctor/servlet"
    click UserServlet "https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject/tree/main/Doctor-Patient-Portal/src/main/java/com/hms/user/servlet"
    click DAO "https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject/tree/main/Doctor-Patient-Portal/src/main/java/com/hms/dao"
    click Entity "https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject/tree/main/Doctor-Patient-Portal/src/main/java/com/hms/entity"
    click DBConn "https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject/blob/main/Doctor-Patient-Portal/src/main/java/com/hms/db/DBConnection.java"
    click POM "https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject/blob/main/Doctor-Patient-Portal/pom.xml"
    click WebXML "https://github.com/mdtalalwasim/doctor-patient-portal-advancejavawebproject/blob/main/Doctor-Patient-Portal/src/main/webapp/WEB-INF/web.xml"

    %% Styles
    classDef presentation fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef controller fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef data fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
    classDef config fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef database fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef external fill:#FDFEFE,stroke:#5D6D7E,stroke-width:2px;
```
