# saadahmed1122/e-learning_web_application architecture

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

- Interactive diagram: https://gitdiagram.com/saadahmed1122/e-learning_web_application
- Repository: https://github.com/saadahmed1122/e-learning_web_application

## Overview

##### Project type and purpose
- This is a full-stack e-learning web application built on Java 8, using Java Servlets (MVC pattern) for server-side logic, JSP/HTML/CSS/Bootstrap for the front end, and PostgreSQL for data persistence.
- It supports three user roles—Admin, Teacher, Student—and implements core LMS features (course management, content upload, messaging, registration).

##### File structure
- Top-level WA-HW1 folder holds a Maven webapp:
- src/main/java/MVC/Bean → plain old Java objects (model)
- src/main/java/MVC/Controller → servlets (controller)
- src/main/java/MVC/dao → data access objects (DAO layer)
- src/main/webapp → JSP pages, static assets (CSS, JS, images, plugins)
- src/main/database → SQL schema and seed scripts
- Standard Maven POM for builds, target/ holds compiled WAR layout.
- Uses PostgreSQL JDBC driver, Tomcat 10 deployment descriptor (web.xml).

##### Key architectural patterns
- 3-Tier architecture: Presentation (JSP + static assets), Business/Controller (Servlets + Beans), Data (DAO + PostgreSQL).
- MVC pattern: request flows from browser → servlet controller → model/DAO → DB, then back to JSP view.
- DAO pattern isolates SQL and connection management (DatabaseConnection utility).

a. Main components:
- Client browser (User interface: JSP/HTML/CSS/JS, Bootstrap, Materialize)
- Web/App Server (Apache Tomcat 10) hosting the WAR
- Presentation Layer (JSPs under webapp/)
- Controller Layer (Servlets under MVC/Controller/)
- Model Layer (Beans under MVC/Bean/)
- Data Access Layer (DAO classes under MVC/dao/)
- Database (PostgreSQL instance)
- External libraries (JDBC driver, Highlight.js plugin, Bootstrap assets)
b. Relationships & data flow:
1. Client → HTTP request → Tomcat
2. Tomcat routes to a Servlet (Controller)
3. Controller invokes DAOs via JDBC (using DatabaseConnection)
4. DAO returns model objects (Beans)
5. Controller attaches Beans to request/session and forwards to JSP
6. JSP renders HTML, JS, CSS back to browser
c. Highlighted patterns:
- MVC separation of concerns
- Three-layer separation (Presentation/Business/Data)
- DAO encapsulation of persistence logic
d. Technologies & frameworks:
- Java Servlets & JSP, MVC pattern
- Maven build, Tomcat deploy
- PostgreSQL via JDBC
- Bootstrap, Materialize CSS, custom JS/CSS, Highlight.js plugin

## Diagram (Mermaid)

```mermaid
flowchart TD
    Client["Client Browser"]:::external
    Tomcat["Apache Tomcat 10 Server"]:::application

    subgraph "Presentation Tier"
        Webapp["JSP Views & Static Assets"]:::presentation
        WEBXML["Deployment Descriptor (web.xml)"]:::presentation
        CSS["Bootstrap & Custom CSS Assets"]:::presentation
        JS["Bootstrap & Custom JS Assets"]:::presentation
        PLUGIN["Highlight.js Plugin & Styles"]:::presentation
    end

    subgraph "Application Tier"
        Controllers["Controller Layer (Servlets & Utilities)"]:::application
        DBConn["DatabaseConnection Utility"]:::application
        EncUtil["Encryption/Decryption Utility"]:::application
        DAOLayer["Data Access Layer (DAO Classes)"]:::application
        Models["Model Layer (Java Beans)"]:::application
    end

    subgraph "Data Tier"
        DB["PostgreSQL Database"]:::database
    end

    subgraph "Build & Deployment"
        POM["Maven Build Descriptor (pom.xml)"]:::build
        LIBS["External Libraries (JARs)"]:::build
    end

    Client -->|HTTP Request| Tomcat
    Tomcat -->|serves| Webapp
    Webapp -->|forwards| Controllers
    Controllers -->|uses| DBConn
    Controllers -->|uses| EncUtil
    DBConn -->|calls| DAOLayer
    DAOLayer -->|JDBC| DB
    DAOLayer -->|returns Model Objects| Models
    Models -->|attached to request| Controllers
    Controllers -->|forwards| Webapp
    Webapp -->|HTTP Response| Client

    POM --> Tomcat
    POM --> LIBS
    LIBS --> Tomcat

    click Webapp "https://github.com/saadahmed1122/e-learning_web_application/tree/master/WA-HW1/src/main/webapp/"
    click Controllers "https://github.com/saadahmed1122/e-learning_web_application/tree/master/WA-HW1/src/main/java/MVC/Controller/"
    click Models "https://github.com/saadahmed1122/e-learning_web_application/tree/master/WA-HW1/src/main/java/MVC/Bean/"
    click DAOLayer "https://github.com/saadahmed1122/e-learning_web_application/tree/master/WA-HW1/src/main/java/MVC/dao/"
    click DBConn "https://github.com/saadahmed1122/e-learning_web_application/blob/master/WA-HW1/src/main/java/MVC/Controller/DatabaseConnection.java"
    click EncUtil "https://github.com/saadahmed1122/e-learning_web_application/blob/master/WA-HW1/src/main/java/MVC/Controller/Encryption_Decryption_password.java"
    click WEBXML "https://github.com/saadahmed1122/e-learning_web_application/blob/master/WA-HW1/src/main/webapp/WEB-INF/web.xml"
    click DB_SCHEMA "https://github.com/saadahmed1122/e-learning_web_application/blob/master/WA-HW1/src/main/database/db_schema.sql"
    click INSERT "https://github.com/saadahmed1122/e-learning_web_application/blob/master/WA-HW1/src/main/database/insert.sql"
    click POM "https://github.com/saadahmed1122/e-learning_web_application/blob/master/WA-HW1/pom.xml"
    click LIBS "https://github.com/saadahmed1122/e-learning_web_application/tree/master/WA-HW1/target/E-learning_project-1.0-SNAPSHOT/WEB-INF/lib/"
    click CSS "https://github.com/saadahmed1122/e-learning_web_application/tree/master/WA-HW1/src/main/webapp/assets/css/"
    click JS "https://github.com/saadahmed1122/e-learning_web_application/tree/master/WA-HW1/src/main/webapp/assets/js/"
    click PLUGIN "https://github.com/saadahmed1122/e-learning_web_application/tree/master/WA-HW1/src/main/webapp/assets/plugins/highlight/"

    classDef presentation fill:#e0f7e9,stroke:#2e7d32,color:#2e7d32
    classDef application fill:#e3f2fd,stroke:#1565c0,color:#1565c0
    classDef database fill:#eceff1,stroke:#607d8b,color:#37474f
    classDef build fill:#fff3e0,stroke:#ef6c00,color:#e65100
    classDef external fill:#f3e5f5,stroke:#6a1b9a,color:#4a148c
```
