# tejask28/cs336-flight-reservation-full-stack-web-app architecture

> Architecture diagram of the GitHub repository tejask28/cs336-flight-reservation-full-stack-web-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tejask28/cs336-flight-reservation-full-stack-web-app
- Repository: https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app

## Overview

##### Project type and purpose
- This is a Java-based dynamic web application (three-tier architecture) built on Tomcat (Java Servlet container) with JSP for the view layer, Java Servlets and helper classes for the controller/business layer, and MySQL as the persistence layer.
- Purpose: airline flight search and reservation system with user Q&A, wait-list management, reporting, and administrative/customer-rep management.

##### File structure
- Top level:
- src/main/java – all Java classes and servlets
- src/main/webapp – JSP pages, static assets (css/js), web.xml, lib (connectors)
- build – compiled classes
- .settings, README, project config for Eclipse/Tomcat
- Patterns:
- MVC-style: JSP (View) → Servlets (Controller) → MySQL.java + model classes (Domain + DAO) → MySQL DB (Model)
- Feature modules grouped by servlet names: search, reservation, reporting, user/Q&A, admin, customer-rep.

##### README for additional insights
- Stack: Java 17, Tomcat 11, Dynamic Web Module 6.1, MySQL connector, Jakarta Servlet API
- Runtime flow: JSPs submit requests to Servlets via annotations; Servlets use MySQL.java to open JDBC connections, run SQL, populate responses, forward/redirect back to JSPs.

##### Detail without over-splitting
- Logical group of servlets as a module rather than every single servlet class
- DAO/Model layer collectively, then highlight MySQL.java and key domain objects
- Flow of data and control is clearly visible from client to DB and back

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    ClientBrowser["Client Browser"]:::external

    %% Tomcat Container
    subgraph "Tomcat Container"
        direction TB

        %% Presentation Tier
        subgraph "Presentation Tier"
            direction TB
            JSPViews["JSP Views"]:::frontend
            CSS["CSS (styles.css)"]:::frontend
            JS["JavaScript"]:::frontend
        end

        %% Controller Layer
        subgraph "Servlet Controllers"
            direction TB
            SearchFlightsServlet["SearchFlightsServlet"]:::backend
            ReservationServlet["ReservationServlet"]:::backend
            PurchaseTicket["PurchaseTicket"]:::backend
            CancelTicket["CancelTicket"]:::backend
            JoinWaitlist["JoinWaitlist"]:::backend
            PurchaseWaitlistedFlight["PurchaseWaitlistedFlight"]:::backend
            SalesReportServlet["SalesReportServlet"]:::backend
            ReservationReportServlet["ReservationReportServlet"]:::backend
            RevenueReportServlet["RevenueReportServlet"]:::backend
            ListQuestionsServlet["ListQuestionsServlet"]:::backend
            PostQuestionServlet["PostQuestionServlet"]:::backend
            PostAnswerServlet["PostAnswerServlet"]:::backend
            SearchQuestionsServlet["SearchQuestionsServlet"]:::backend
            MyQuestionsServlet["MyQuestionsServlet"]:::backend
            ViewQuestionServlet["ViewQuestionServlet"]:::backend
            Login["Login"]:::backend
            Logout["Logout"]:::backend
            AdminStatsServlet["AdminStatsServlet"]:::backend
            Admin["Admin"]:::backend
            CustRep["CustRep"]:::backend
        end

        %% Data Access Tier
        subgraph "Data Access (DAO)"
            direction TB
            MySQLUtil["MySQL.java"]:::dao
            User["User.java"]:::dao
            Customer["Customer.java"]:::dao
        end
    end

    %% Database and External
    MySQLDB["MySQL Database"]:::db
    EmailService["Email/Notification Service"]:::external

    %% Relationships
    ClientBrowser -->|"HTTP Request"| JSPViews
    JSPViews -->|"form submit"| SearchFlightsServlet
    JSPViews --> ReservationServlet
    JSPViews -->|"report request"| SalesReportServlet
    JSPViews --> ListQuestionsServlet
    JSPViews --> Login
    SearchFlightsServlet --> MySQLUtil
    ReservationServlet --> MySQLUtil
    PurchaseTicket --> MySQLUtil
    CancelTicket --> MySQLUtil
    JoinWaitlist --> MySQLUtil
    PurchaseWaitlistedFlight --> MySQLUtil
    SalesReportServlet --> MySQLUtil
    ReservationReportServlet --> MySQLUtil
    RevenueReportServlet --> MySQLUtil
    ListQuestionsServlet --> MySQLUtil
    PostQuestionServlet --> MySQLUtil
    PostAnswerServlet --> MySQLUtil
    SearchQuestionsServlet --> MySQLUtil
    MyQuestionsServlet --> MySQLUtil
    ViewQuestionServlet --> MySQLUtil
    AdminStatsServlet --> MySQLUtil
    Admin --> MySQLUtil
    CustRep --> MySQLUtil
    MySQLUtil --> MySQLDB
    MySQLDB --> MySQLUtil
    MySQLUtil -->|"trigger alerts"| EmailService
    SearchFlightsServlet -->|"forward/redirect"| JSPViews
    ReservationServlet --> JSPViews
    SalesReportServlet --> JSPViews
    ListQuestionsServlet --> JSPViews
    Login --> JSPViews

    %% Click Events
    click JSPViews "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/tree/main/src/main/webapp"
    click CSS "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/webapp/css/styles.css"
    click JS "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/tree/main/src/main/webapp/js"
    click SearchFlightsServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/SearchFlightsServlet.java"
    click ReservationServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/ReservationServlet.java"
    click PurchaseTicket "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/PurchaseTicket.java"
    click CancelTicket "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/CancelTicket.java"
    click JoinWaitlist "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/JoinWaitlist.java"
    click PurchaseWaitlistedFlight "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/PurchaseWaitlistedFlight.java"
    click SalesReportServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/SalesReportServlet.java"
    click ReservationReportServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/ReservationReportServlet.java"
    click RevenueReportServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/RevenueReportServlet.java"
    click ListQuestionsServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/ListQuestionsServlet.java"
    click PostQuestionServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/PostQuestionServlet.java"
    click PostAnswerServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/PostAnswerServlet.java"
    click SearchQuestionsServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/SearchQuestionsServlet.java"
    click MyQuestionsServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/MyQuestionsServlet.java"
    click ViewQuestionServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/ViewQuestionServlet.java"
    click Login "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/Login.java"
    click Logout "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/Logout.java"
    click AdminStatsServlet "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/AdminStatsServlet.java"
    click Admin "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/Admin.java"
    click CustRep "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/CustRep.java"
    click MySQLUtil "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/MySQL.java"
    click User "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/User.java"
    click Customer "https://github.com/tejask28/cs336-flight-reservation-full-stack-web-app/blob/main/src/main/java/Customer.java"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000
    classDef backend fill:#90EE90,stroke:#000
    classDef dao fill:#FFD700,stroke:#000
    classDef db fill:#f4a261,stroke:#000,stroke-width:2px
    classDef external fill:#ccc,stroke-dasharray: 5 5,stroke:#000
```
