# phongpahmm/movieticket architecture

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

- Interactive diagram: https://gitdiagram.com/phongpahmm/movieticket
- Repository: https://github.com/phongpahmm/movieticket

## Overview

##### Project Type and Purpose
- This is a backend monolithic web service built with Spring Boot, providing RESTful HTTP and WebSocket APIs for a movie ticket booking system.
- It handles user authentication/authorization, movie/show management, seat booking, payment processing, real-time chat/seat updates, email notifications, and media uploads.
- The project exposes its functionality to a separate frontend (web or mobile) accessible at https://movie-ticket-booking.site/.

##### File Structure Analysis
- Top-level files: pom.xml, README.md, Maven wrapper → a Maven-based Java project.
- src/main/java/com/example/movieticket:
- configuration: security (JWT filters, handlers), WebSocket, cloudinary, payment, mail.
- controller: HTTP endpoints by resource (Authentication, Movie, Booking, Chat, etc.).
- dto: request/response objects for each API.
- service & service/impl: business logic.
- repository: Spring Data JPA interfaces.
- model: JPA @Entity domain objects.
- common/util: enums and utilities (JWT, pagination).
- exception: centralized error handling.
- src/main/resources: application-prod.yml for env configuration, static assets (faqs.xlsx) and uploaded media in /uploads.
- WebSocketConfig indicates real-time messaging; CloudinaryConfig and VNPayConfig point to third-party integrations.

##### README Insights
- Only deployment link is provided, but the wide array of controllers and services shows a standard layered architecture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Clients
    UI["Frontend (Browser/Mobile UI)"]:::external
    UI -->|HTTP/HTTPS| API_GW["Load Balancer / API Gateway"]:::external

    %% API Gateway to Application
    API_GW -->|forwards requests| AppEntry["MovieTicketApplication"]:::internal
    click AppEntry "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/MovieTicketApplication.java"

    subgraph "Spring Boot Application"
        direction TB
        %% Configuration Layer
        subgraph "Configuration" 
            direction TB
            JWTFilter["JwtAuthenticationFilter"]:::config
            AuthEntry["JwtAuthenticationEntryPoint"]:::config
            AccessDenied["JwtAccessDenied"]:::config
            SecurityCfg["SecurityConfig"]:::config
            WSConfig["WebSocketConfig"]:::config
            CloudCfg["CloudinaryConfig"]:::config
            VNPcfg["VNPayConfig"]:::config
            MailCfg["MailConfig"]:::config

            click JWTFilter "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/configuration/JwtAuthenticationFilter.java"
            click AuthEntry "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/configuration/JwtAuthenticationEntryPoint.java"
            click AccessDenied "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/configuration/JwtAccessDenied.java"
            click SecurityCfg "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/configuration/SecurityConfig.java"
            click WSConfig "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/configuration/WebSocketConfig.java"
            click CloudCfg "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/configuration/CloudinaryConfig.java"
            click VNPcfg "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/configuration/VNPayConfig.java"
            click MailCfg "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/configuration/MailConfig.java"
        end

        %% Controller Layer
        subgraph "Controllers (REST & WebSocket)"
            direction TB
            AuthCtrl["AuthenticationController"]:::internal
            MovieCtrl["MovieController"]:::internal
            ShowCtrl["ShowController"]:::internal
            BookingCtrl["BookingController"]:::internal
            SeatCtrl["SeatController"]:::internal
            ScreenCtrl["ScreenController"]:::internal
            GenreCtrl["GenreController"]:::internal
            PriceCtrl["PriceController"]:::internal
            ReviewCtrl["ReviewController"]:::internal
            UserCtrl["UserController"]:::internal
            ImageCtrl["ImageController"]:::internal
            ChatCtrl["ChatController"]:::internal
            EmailCtrl["EmailController"]:::internal

            click AuthCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/AuthenticationController.java"
            click MovieCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/MovieController.java"
            click ShowCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/ShowController.java"
            click BookingCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/BookingController.java"
            click SeatCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/SeatController.java"
            click ScreenCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/ScreenController.java"
            click GenreCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/GenreController.java"
            click PriceCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/PriceController.java"
            click ReviewCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/ReviewController.java"
            click UserCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/UserController.java"
            click ImageCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/ImageController.java"
            click ChatCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/ChatController.java"
            click EmailCtrl "https://github.com/phongpahmm/movieticket/blob/master/src/main/java/com/example/movieticket/controller/EmailController.java"
        end

        %% Service Layer
        subgraph "Service Layer"
            direction TB
            AuthSvcI["AuthenticationService"]:::internal
            MovieSvcI["MovieService"]:::internal
            ShowSvcI["ShowService"]:::internal
            BookingSvcI["BookingService"]:::internal
            SeatSvcI["SeatService"]:::internal
            ScreenSvcI["ScreenService"]:::internal
            GenreSvcI["GenreService"]:::internal
            PriceSvcI["PriceService"]:::internal
            ReviewSvcI["ReviewService"]:::internal
            UserSvcI["UserService"]:::internal
            CloudSvcI["CloudinaryService"]:::internal
            PaySvcI["PaymentService"]:::internal
            EmailSvcI["EmailService"]:::internal
            QRCodeSvcI["QRCodeService"]:::internal

            %% Implementations folder
            subgraph "Implementations"
                direction TB
                AuthSvcImpl["AuthenticationServiceImpl"]:::internal
                MovieSvcImpl["MovieServiceImpl"]:::internal
                ShowSvcImpl["ShowServiceImpl"]:::internal
                BookingSvcImpl["BookingServiceImpl"]:::internal
                SeatSvcImpl["SeatServiceImpl"]:::internal
                ScreenSvcImpl["ScreenServiceImpl"]:::internal
                GenreSvcImpl["GenreServiceImpl"]:::internal
                PriceSvcImpl["PriceServiceImpl"]:::internal
                ReviewSvcImpl["ReviewServiceImpl"]:::internal
                UserSvcImpl["UserServiceImpl"]:::internal
                CloudSvcImpl["CloudinaryServiceImpl"]:::internal
                VNPaySvc["VNPayService"]:::internal
                EmailSvcImpl["EmailServiceImpl"]:::internal
                ExcelSvc["ExcelService"]:::internal
                CleanupSvc["BookingCleanUpService"]:::internal
                CohereSvc["CohereService"]:::internal
            end
        end

        %% Repository Layer
        subgraph "Repository Layer"
            direction TB
            Repos["JPA Repositories"]:::internal
        end
    end

    %% Storage and External Integrations
    DB["Relational Database"]:::storage
    FileStore["Local File Storage (/uploads)"]:::storage
    Cloudinary["Cloudinary"]:::external
    VNPay["VNPay Payment Gateway"]:::external
    SMTP["SMTP Mail Server"]:::external

    %% Data Flows
    SecurityCfg -->|applies filter| AuthCtrl
    AuthCtrl -->|calls| AuthSvcI
    MovieCtrl -->|calls| MovieSvcI
    ShowCtrl -->|calls| ShowSvcI
    BookingCtrl -->|calls| BookingSvcI
    SeatCtrl -->|calls| SeatSvcI
    ScreenCtrl -->|calls| ScreenSvcI
    GenreCtrl -->|calls| GenreSvcI
    PriceCtrl -->|calls| PriceSvcI
    ReviewCtrl -->|calls| ReviewSvcI
    UserCtrl -->|calls| UserSvcI
    ImageCtrl -->|calls| CloudSvcI
    EmailCtrl -->|calls| EmailSvcI
    ChatCtrl -->|WebSocket messages| WSConfig

    AuthSvcI --> AuthSvcImpl
    MovieSvcI --> MovieSvcImpl
    ShowSvcI --> ShowSvcImpl
    BookingSvcI --> BookingSvcImpl
    SeatSvcI --> SeatSvcImpl
    ScreenSvcI --> ScreenSvcImpl
    GenreSvcI --> GenreSvcImpl
    PriceSvcI --> PriceSvcImpl
    ReviewSvcI --> ReviewSvcImpl
    UserSvcI --> UserSvcImpl
    CloudSvcI --> CloudSvcImpl
    PaySvcI --> VNPaySvc
    EmailSvcI --> EmailSvcImpl

    %% Service to external
    CloudSvcImpl -->|upload| Cloudinary
    CloudSvcImpl -->|fallback store| FileStore
    PaySvcI -->|process payment| VNPay
    EmailSvcI -->|send email| SMTP
    CleanupSvc -->|cleanup expired| BookingSvcImpl --> DB

    %% DB interactions
    subgraph "Data Persistence"
        direction TB
        Repos --> DB
    end

    %% File Storage
    ImageCtrl -->|store/retrieve| FileStore

    %% Classes
    classDef internal fill:#cef,stroke:#066,stroke-width:1px
    classDef external fill:#fdd,stroke:#600,stroke-width:1px
    classDef storage fill:#dfd,stroke:#060,stroke-width:1px
    classDef config fill:#ffd,stroke:#660,stroke-width:1px
```
