# rio219/webapp_3rdyear architecture

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

- Interactive diagram: https://gitdiagram.com/rio219/webapp_3rdyear
- Repository: https://github.com/rio219/webapp_3rdyear

## Overview

##### Project type and purpose
- This is a Java-based full-stack web application (“Webapp_3rdYear”) packaged as a WAR, built with Maven, running on Apache Tomcat, using Jakarta EE, JSP/JSTL for the view layer, and MySQL for persistence.
- It implements a classic layered MVC architecture to support user-facing pages (home, login, signup, cart, product detail), role-based portals (admin, seller, shipper), and back-end management services.

##### File structure
- Top-level build files: pom.xml (Maven build & dependencies), README.md, .gitignore.
- src/main/java/com/webapp3rdyear
- configs: DBConnectSQL.java, JPAConfig.java → database connection & JPA setup
- controller: packages for admin, seller, shipper, web → servlet controllers handling HTTP requests
- dto: data-transfer objects used between layers
- entity: JPA entity models mapped to database tables
- repository: Spring Data / JPA repositories or DAOs for CRUD operations
- service: business-logic services (login, signup, user operations)
- utils: helper classes (email, password hashing)
- src/main/resources/META-INF/persistence.xml → JPA persistence unit
- src/main/webapp → web content
- WEB-INF: sitemesh & decorators configurations, web.xml
- template, views: JSP pages, static assets (CSS, JS, images), taglibs
- target/Webapp_3rdYear-0.0.1-SNAPSHOT.war → generated deployable artifact

##### README for additional insights
- Core technologies: Java 22, Jakarta EE 10, Tomcat 10.1, MySQL 8.0
- Uses JSP/JSTL for views, Maven for build automation, MySQL Connector/J for JDBC
- Confirms the intended deployment environment and packaging

## Diagram (Mermaid)

```mermaid
flowchart TB
  classDef frontend fill:#E0F7FA,stroke:#006064,color:#004D40
  classDef service fill:#E8F5E9,stroke:#1B5E20,color:#2E7D32
  classDef dao fill:#FFFDE7,stroke:#F9A825,color:#F57F17
  classDef database fill:#CFD8DC,stroke:#455A64,color:#37474F
  classDef config fill:#F3E5F5,stroke:#6A1B9A,color:#4A148C
  classDef external fill:#ECEFF1,stroke:#607D8B,color:#455A64
  classDef infra fill:#FFEBEE,stroke:#C62828,color:#B71C1C

  Browser["Client Browser"]:::frontend
  Browser -->|"HTTP/HTTPS 80/8080"| Tomcat["Apache Tomcat Servlet Container"]:::infra
  
  subgraph "Servlet Container"
    SiteMesh["SiteMesh Filter/Decorator"]:::frontend
    Tomcat --> SiteMesh
    subgraph "Presentation Layer"
      subgraph "Web Controllers"
        HC_web["HomeController"]:::frontend
        LC_web["LoginController"]:::frontend
        SC_web["SignupController"]:::frontend
        CartC["CartController"]:::frontend
        PD_web["ProductDetailController"]:::frontend
        FP_web["ForgetPassController"]:::frontend
        CP_web["ChangePassController"]:::frontend
        EP_web["EditProfileController"]:::frontend
      end
      subgraph "Admin Controllers"
        HC_admin["Admin HomeController"]:::frontend
      end
      subgraph "Seller Controllers"
        HC_seller["Seller HomeController"]:::frontend
        AddS["AddSellerController"]:::frontend
        DelS["DeleteSellerController"]:::frontend
      end
      subgraph "Shipper Controllers"
        HC_shipper["Shipper HomeController"]:::frontend
        AddSh["AddShipperController"]:::frontend
        DelSh["DeleteShipperController"]:::frontend
      end
    end
  end
  
  SiteMesh --> HC_web
  SiteMesh --> LC_web
  SiteMesh --> SC_web
  SiteMesh --> CartC
  SiteMesh --> PD_web
  SiteMesh --> FP_web
  SiteMesh --> CP_web
  SiteMesh --> EP_web
  SiteMesh --> HC_admin
  SiteMesh --> HC_seller
  SiteMesh --> AddS
  SiteMesh --> DelS
  SiteMesh --> HC_shipper
  SiteMesh --> AddSh
  SiteMesh --> DelSh

  subgraph "Business Layer"
    LoginService["LoginService"]:::service
    SignupService["SignupService"]:::service
    AddService["AddService"]:::service
    UserService["UserService"]:::service
  end

  HC_web --> LoginService
  LC_web --> LoginService
  SC_web --> SignupService
  CartC --> AddService
  PD_web --> AddService
  HC_admin --> UserService
  HC_seller --> UserService
  HC_shipper --> UserService

  LoginService --> AccountRepo["AccountRepository"]:::dao
  UserService --> UserRepo["UserRepository"]:::dao
  AddService --> ProductRepo["ProductRepository"]:::dao
  AddService --> CartRepo["CartReponsitory"]:::dao

  subgraph "Data Access Layer"
    AccountRepo
    UserRepo
    ProductRepo
    CartRepo
  end

  AccountRepo --> DB["MySQL 8.0"]:::database
  UserRepo --> DB
  ProductRepo --> DB
  CartRepo --> DB

  subgraph "Configuration"
    DBConnectSQL["DBConnectSQL"]:::config
    JPAConfig["JPAConfig"]:::config
    PersistenceXML["persistence.xml"]:::config
  end

  DBConnectSQL --> PersistenceXML
  JPAConfig --> PersistenceXML
  PersistenceXML --> AccountRepo
  PersistenceXML --> UserRepo
  PersistenceXML --> ProductRepo
  PersistenceXML --> CartRepo

  subgraph "Utilities & External"
    EmailUtils["EmailUtils"]:::external
    PasswordUtils["PasswordUtils"]:::external
    SMTP["Email SMTP Service"]:::external
  end

  LoginService --> PasswordUtils
  SignupService --> EmailUtils
  EmailUtils -->|"SMTP"| SMTP

  class Browser,HC_web,LC_web,SC_web,CartC,PD_web,FP_web,CP_web,EP_web,HC_admin,HC_seller,AddS,DelS,HC_shipper,AddSh,DelSh frontend
  class LoginService,SignupService,AddService,UserService service
  class AccountRepo,UserRepo,ProductRepo,CartRepo dao
  class DB database
  class DBConnectSQL,JPAConfig,PersistenceXML config
  class EmailUtils,PasswordUtils,SMTP external
  class Tomcat infra

  %% Click Events
  click DBConnectSQL "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/configs/DBConnectSQL.java"
  click JPAConfig "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/configs/JPAConfig.java"
  click PersistenceXML "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/resources/META-INF/persistence.xml"
  click HC_web "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/web/HomeController.java"
  click LC_web "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/web/LoginController.java"
  click SC_web "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/web/SignupController.java"
  click CartC "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/web/CartController.java"
  click PD_web "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/web/ProductDetailController.java"
  click FP_web "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/web/ForgetPassController.java"
  click CP_web "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/web/ChangePassController.java"
  click EP_web "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/web/EditProfileController.java"
  click HC_admin "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/admin/HomeController.java"
  click HC_seller "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/seller/HomeController.java"
  click AddS "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/seller/AddSellerController.java"
  click DelS "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/seller/DeleteSellerController.java"
  click HC_shipper "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/shipper/HomeController.java"
  click AddSh "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/shipper/AddShipperController.java"
  click DelSh "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/controller/shipper/DeleteShipperController.java"
  click LoginService "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/service/LoginService.java"
  click SignupService "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/service/SignupService.java"
  click AddService "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/service/AddService.java"
  click UserService "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/service/UserService.java"
  click AccountRepo "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/repository/AccountRepository.java"
  click UserRepo "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/repository/UserRepository.java"
  click ProductRepo "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/repository/ProductRepository.java"
  click CartRepo "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/repository/CartReponsitory.java"
  click EmailUtils "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/utils/EmailUtils.java"
  click PasswordUtils "https://github.com/rio219/webapp_3rdyear/blob/main/src/main/java/com/webapp3rdyear/utils/PasswordUtils.java"
```
