# dustin9x/phtv-datvexemphim architecture

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

- Interactive diagram: https://gitdiagram.com/dustin9x/phtv-datvexemphim
- Repository: https://github.com/dustin9x/phtv-datvexemphim

## Overview

##### Main Components
- Frontend: This is built with ReactJS and Redux. Its folder (“frontend”) includes all the pages (Home, Login, Register, Movie Detail, Seat Selection, Admin panels, etc.), components, templates, and services to handle state management and API calls. Indicate that it handles user interactions, displays movie information, manages seat selection, and supports user authentication.
- Backend: Located in the “backend” folder, this is a Laravel application following the MVC (Model-View-Controller) paradigm. It includes models, controllers (especially API controllers), routes (located in routes/api.php, routes/web.php), middleware, migrations, seeders, and configuration files. This layer is responsible for API endpoints for actions such as authentication, movie management, booking operations, seat and order management, and admin CRUD.
- Database: The backend uses a MySQL database (as indicated by the migrations and the reference to phpMyAdmin). This stores users, movies, theaters, seats, orders, banners, news, and other related data.
- External Tools/Services: Mention integration points such as the payment processing (implied in the ticket booking process), email services for notifications (templates under resources/views/mail), and any other external dependencies determined by the environment configuration.

##### Architectural Patterns and Design Principles
- Present a layered architecture: Separation into presentation (ReactJS), business logic (Laravel controllers and services), and persistence (database models/migrations). Emphasize the modular design, with clear boundaries between components.
- That Laravel follows the MVC pattern, with models (e.g., User, Movie, OrderDetail) and controllers that encapsulate business logic.
- Configuration & routing: Indicate that environment files (.env), configuration settings, and migration/seeders set up the initial state of the system and its dependencies.

##### Technologies Involved
- Frontend: ReactJS, Redux, NodeJS (for development), and Tailwind CSS (as seen in tailwind.config.js).
- Backend: PHP Laravel framework, with additional dependencies managed via Composer (composer.json) and PHP artisan CLI for migrations and seeding.
- Database: MySQL with phpMyAdmin used for management.
- Additional Tools: Git for version control (with .gitignore files and other git config files), and possibly npm for dependency management in both frontend and backend.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Global component
    User["User (Browser)"]:::user

    %% Client Tier: ReactJS Frontend
    subgraph "Client Tier: ReactJS Frontend"
        FE_Pages["Pages (frontend/src/pages)"]:::frontend
        FE_Components["Components (frontend/src/components)"]:::frontend
        FE_Redux["Redux Store (frontend/src/redux)"]:::frontend
        FE_Services["Services (frontend/src/services)"]:::frontend
        FE_Templates["Templates (frontend/src/templates)"]:::frontend
    end

    %% Application Server: Laravel Backend
    subgraph "Application Server: Laravel Backend"
        BE_ApiControllers["API Controllers (backend/app/Http/Controllers/Api/)"]:::backend
        BE_Models["Models (backend/app/Models/)"]:::backend
        BE_Routes["Routes (backend/routes/)"]:::backend
        BE_Middleware["Middleware (backend/app/Http/Middleware/)"]:::backend
        BE_Migrations["Migrations (backend/database/migrations/)"]:::backend
        BE_Seeders["Seeders (backend/database/seeders/)"]:::backend
        BE_Configurations["Configurations (backend/config/)"]:::backend
        BE_EmailTemplates["Email Templates (backend/resources/views/mail/)"]:::backend
        
        subgraph "External Services"
            Ext_Payment["Payment Integrations (backend/config/services.php)"]:::external
        end
    end

    %% Data Tier: MySQL Database
    subgraph "Data Tier: MySQL Database"
        DB["MySQL Database"]:::database
    end

    %% Connections between layers
    User -->|"uses"| FE_Pages
    FE_Pages -->|"triggers"| FE_Components
    FE_Pages -->|"dispatches"| FE_Redux
    FE_Redux -->|"calls"| FE_Services
    FE_Services -->|"renders"| FE_Templates
    FE_Pages -->|"REST_API"| BE_ApiControllers
    BE_ApiControllers -->|"fetches"| BE_Models
    BE_ApiControllers -->|"routes_via"| BE_Routes
    BE_ApiControllers -->|"validated_by"| BE_Middleware
    BE_Configurations -->|"configures"| BE_ApiControllers
    BE_Configurations -->|"configures"| BE_EmailTemplates
    BE_ApiControllers -->|"queries"| DB
    BE_Configurations -->|"integrates"| Ext_Payment

    %% Click Events for Frontend
    click FE_Pages "https://github.com/dustin9x/phtv-datvexemphim/tree/main/frontend/src/pages"
    click FE_Components "https://github.com/dustin9x/phtv-datvexemphim/tree/main/frontend/src/components"
    click FE_Redux "https://github.com/dustin9x/phtv-datvexemphim/tree/main/frontend/src/redux"
    click FE_Services "https://github.com/dustin9x/phtv-datvexemphim/tree/main/frontend/src/services"
    click FE_Templates "https://github.com/dustin9x/phtv-datvexemphim/tree/main/frontend/src/templates"

    %% Click Events for Backend
    click BE_ApiControllers "https://github.com/dustin9x/phtv-datvexemphim/tree/main/backend/app/Http/Controllers/Api/"
    click BE_Models "https://github.com/dustin9x/phtv-datvexemphim/tree/main/backend/app/Models/"
    click BE_Routes "https://github.com/dustin9x/phtv-datvexemphim/tree/main/backend/routes/"
    click BE_Middleware "https://github.com/dustin9x/phtv-datvexemphim/tree/main/backend/app/Http/Middleware/"
    click BE_Migrations "https://github.com/dustin9x/phtv-datvexemphim/tree/main/backend/database/migrations/"
    click BE_Seeders "https://github.com/dustin9x/phtv-datvexemphim/tree/main/backend/database/seeders/"
    click BE_Configurations "https://github.com/dustin9x/phtv-datvexemphim/tree/main/backend/config/"
    click BE_EmailTemplates "https://github.com/dustin9x/phtv-datvexemphim/tree/main/backend/resources/views/mail/"
    click Ext_Payment "https://github.com/dustin9x/phtv-datvexemphim/blob/main/backend/config/services.php"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef backend fill:#FFD700,stroke:#000,stroke-width:1px;
    classDef database fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef external fill:#FFB6C1,stroke:#000,stroke-width:1px;
    classDef user fill:#F08080,stroke:#000,stroke-width:1px;
```
