# hoangtran0410/doan_web1 architecture

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

- Interactive diagram: https://gitdiagram.com/hoangtran0410/doan_web1
- Repository: https://github.com/hoangtran0410/doan_web1

## Overview

##### Project Type and Purpose
- Project Type: It’s a web-based, static website project built as an assignment ("Đồ án môn web 1"). The site is designed for selling phones.
- Purpose: It provides an end-user interface where customers can browse products, search/filter, see detailed product pages, manage their carts, and handle user authentication. Additionally, there’s an Admin interface for product, order, and user management along with statistics.

##### File Structure
- HTML Files: Notice multiple HTML pages like index.html (landing page), giohang.html (cart), chitietsanpham.html (product detail), and separate admin.html as well as extra pages relevant for user actions (lienhe.html for contact, nguoidung.html for user profile, etc.).
- CSS Directory: Contains numerous CSS files segregated into several categories including common page styles (header, footer, pagination, banners) and admin-specific styling (admin/progress.css, admin/style.css). This indicates that the presentation layer is very modular.
- JS Directory: Multiple JavaScript files are used to add dynamic functionality. There are library folders like jquery and owlcarousel, as well as custom scripts for different pages (chitietsanpham.js, giohang.js, trangchu.js, etc.). The admin.js file likely powers the administrative interactions.
- Data: A data folder with “products.js” suggests product information is managed through static JSON-like structures.
- Assets: An “img” folder containing images for banners, products, etc., and a “screenshots” folder used in the README for visual demonstration.

##### README for Additional Insights
- The README details both “Cơ bản” (Basic user functions) and “ADMIN” functionalities which guide you on what the system should exhibit.
- It describes key features like product filtering, searching, and user management along with admin operations (statistics, managing products, orders, and customers).
- References to screenshots provide visual hints on the UI design and separate interfaces for front-end and admin use.

a. Main Components:
- User Interface (Frontend):
- Customer pages: Home, Product Listing, Product Details, Cart, User Login/Registration, Contact, and News pages.
- Assets: CSS and images (for styling and visual content).
- JavaScript: Files handling user interactions (e.g., trangchu.js for the homepage, giohang.js for the shopping cart).
- Admin Interface:
- Admin Dashboard for statistics.
- Pages for managing products, orders, and users (admin.html and related JavaScript files like admin.js).
- Data Component:
- Static data source (data/products.js) which provides product information.
- External Libraries:
- jQuery, Owl Carousel (and any other JS libraries in the “js/…” folders) used to enhance functionality.

b. Relationships and Interactions:
- The HTML pages serve as the entry points that consume CSS for design and JS for interactive functionality.
- JavaScript files dynamically manipulate HTML elements and interact with the data layer (e.g., loading product details from data/products.js).
- The admin portion interacts similarly but steers toward management functions like CRUD operations (albeit simulated since this is a static web project).
- Visual elements (images) and CSS styles are used by both customer and admin interfaces.

c. Architectural Patterns & Principles:
- Separation of Concerns: By dividing the project into HTML (structure), CSS (presentation), and JS (behavior), the project follows a basic but clear separation.
- Modular File Organization: Different folders for admin, CSS, images, and JS indicate a modular approach.
- Client-Side Rendering: Since all pages are static and use JavaScript to provide interactions, you essentially have a client-side rendered application.

d. Relevant Technologies, Frameworks, or Libraries:
- HTML/CSS/JavaScript (plain or with libraries like jQuery and Owl Carousel).
- The data layer is static, using JavaScript objects in products.js.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend User Interface
    subgraph "Frontend User Interface"
        FE1("index.html"):::html
        FE2("giohang.html"):::html
        FE3("chitietsanpham.html"):::html
        FE4("lienhe.html"):::html
        FE5("nguoidung.html"):::html
        FE6("tintuc.html"):::html
        FE7("trungtambaohanh.html"):::html
        FE8("tuyendung.html"):::html
        FE9("createProductJson.html"):::html
        FE_UI_AGG("Frontend UI"):::htmlBold
        FE1 --> FE_UI_AGG
        FE2 --> FE_UI_AGG
        FE3 --> FE_UI_AGG
        FE4 --> FE_UI_AGG
        FE5 --> FE_UI_AGG
        FE6 --> FE_UI_AGG
        FE7 --> FE_UI_AGG
        FE8 --> FE_UI_AGG
        FE9 --> FE_UI_AGG
    end

    %% Admin Interface
    subgraph "Admin Interface"
        A1("admin.html"):::admin
        Admin_UI_AGG("Admin UI"):::adminBold
        A1 --> Admin_UI_AGG
    end

    %% Aggregated Assets (common resources)
    subgraph "Assets"
        %% Aggregated asset nodes for Frontend
        FE_CSS("Frontend CSS"):::css
        FE_JS("Frontend JS"):::js
        %% Aggregated asset nodes for Admin
        Admin_CSS("Admin CSS"):::css
        Admin_JS("Admin JS"):::js
        %% Shared assets
        Images("Images"):::asset
        Screenshots("Screenshots"):::asset
        DataProducts("Data Source"):::data
    end

    %% CSS Files Subgraph
    subgraph "CSS Files"
        direction TB
        subgraph "General CSS Files"
            CSS_banner("banner.css"):::css
            CSS_baohanh("baohanh.css"):::css
            CSS_chitiet("chitietsanpham.css"):::css
            CSS_footer("footer.css"):::css
            CSS_giohang("gioHang.css"):::css
            CSS_gioithieu("gioithieu.css"):::css
            CSS_header("header.css"):::css
            CSS_home("home_products.css"):::css
            CSS_lienhe("lienhe.css"):::css
            CSS_nguoidung("nguoidung.css"):::css
            CSS_pagination("pagination_phantrang.css"):::css
            CSS_style("style.css"):::css
            CSS_taikhoan("taikhoan.css"):::css
            CSS_tintuc("tintuc.css"):::css
            CSS_topnav("topnav.css"):::css
            CSS_trangchu("trangchu.css"):::css
            CSS_tuyendung("tuyendung.css"):::css
        end
        subgraph "Admin CSS Files"
            AdminCSS_progress("admin/progress.css"):::css
            AdminCSS_style("admin/style.css"):::css
        end
    end

    %% JS Files Subgraph
    subgraph "JS Files"
        direction TB
        subgraph "Custom Scripts"
            JS_chitiet("chitietsanpham.js"):::js
            JS_giohang("giohang.js"):::js
            JS_lienhe("lienhe.js"):::js
            JS_nguoid("nguoidung.js"):::js
            JS_trangchu("trangchu.js"):::js
            JS_classes("classes.js"):::js
            JS_dungchung("dungchung.js"):::js
        end
        subgraph "External Libraries"
            Jquery("Jquery"):::js
            Owlcarousel("owlcarousel"):::js
        end
        Admin_JS_inner("admin.js"):::js
    end

    %% Connections from Frontend UI aggregator to Assets
    FE_UI_AGG -->|"loads"| FE_CSS
    FE_UI_AGG -->|"loads"| FE_JS
    FE_UI_AGG -->|"displays"| Images
    FE_UI_AGG -->|"displays"| Screenshots

    %% Frontend JS interacts with data source
    FE_JS -->|"fetches"| DataProducts

    %% Connections from Admin UI aggregator to Admin Assets and shared assets
    Admin_UI_AGG -->|"loads"| Admin_CSS
    Admin_UI_AGG -->|"loads"| Admin_JS
    Admin_UI_AGG -->|"displays"| Images
    Admin_UI_AGG -->|"displays"| Screenshots

    %% Connect aggregated Frontend CSS to individual General CSS files
    FE_CSS --> CSS_banner
    FE_CSS --> CSS_baohanh
    FE_CSS --> CSS_chitiet
    FE_CSS --> CSS_footer
    FE_CSS --> CSS_giohang
    FE_CSS --> CSS_gioithieu
    FE_CSS --> CSS_header
    FE_CSS --> CSS_home
    FE_CSS --> CSS_lienhe
    FE_CSS --> CSS_nguoidung
    FE_CSS --> CSS_pagination
    FE_CSS --> CSS_style
    FE_CSS --> CSS_taikhoan
    FE_CSS --> CSS_tintuc
    FE_CSS --> CSS_topnav
    FE_CSS --> CSS_trangchu
    FE_CSS --> CSS_tuyendung

    %% Connect aggregated Admin CSS to individual Admin CSS files
    Admin_CSS --> AdminCSS_progress
    Admin_CSS --> AdminCSS_style

    %% Connect aggregated Frontend JS to individual Custom Scripts and External Libraries
    FE_JS --> JS_chitiet
    FE_JS --> JS_giohang
    FE_JS --> JS_lienhe
    FE_JS --> JS_nguoid
    FE_JS --> JS_trangchu
    FE_JS --> JS_classes
    FE_JS --> JS_dungchung
    FE_JS --> Jquery
    FE_JS --> Owlcarousel

    %% Connect aggregated Admin JS to its inner file
    Admin_JS --> Admin_JS_inner

    %% Click Events for Frontend HTML Pages
    click FE1 "https://github.com/hoangtran0410/doan_web1/blob/master/index.html"
    click FE2 "https://github.com/hoangtran0410/doan_web1/blob/master/giohang.html"
    click FE3 "https://github.com/hoangtran0410/doan_web1/blob/master/chitietsanpham.html"
    click FE4 "https://github.com/hoangtran0410/doan_web1/blob/master/lienhe.html"
    click FE5 "https://github.com/hoangtran0410/doan_web1/blob/master/nguoidung.html"
    click FE6 "https://github.com/hoangtran0410/doan_web1/blob/master/tintuc.html"
    click FE7 "https://github.com/hoangtran0410/doan_web1/blob/master/trungtambaohanh.html"
    click FE8 "https://github.com/hoangtran0410/doan_web1/blob/master/tuyendung.html"
    click FE9 "https://github.com/hoangtran0410/doan_web1/blob/master/createProductJson.html"

    %% Click Event for Admin HTML
    click A1 "https://github.com/hoangtran0410/doan_web1/blob/master/admin.html"

    %% Click Events for General CSS Files
    click CSS_banner "https://github.com/hoangtran0410/doan_web1/blob/master/css/banner.css"
    click CSS_baohanh "https://github.com/hoangtran0410/doan_web1/blob/master/css/baohanh.css"
    click CSS_chitiet "https://github.com/hoangtran0410/doan_web1/blob/master/css/chitietsanpham.css"
    click CSS_footer "https://github.com/hoangtran0410/doan_web1/blob/master/css/footer.css"
    click CSS_giohang "https://github.com/hoangtran0410/doan_web1/blob/master/css/gioHang.css"
    click CSS_gioithieu "https://github.com/hoangtran0410/doan_web1/blob/master/css/gioithieu.css"
    click CSS_header "https://github.com/hoangtran0410/doan_web1/blob/master/css/header.css"
    click CSS_home "https://github.com/hoangtran0410/doan_web1/blob/master/css/home_products.css"
    click CSS_lienhe "https://github.com/hoangtran0410/doan_web1/blob/master/css/lienhe.css"
    click CSS_nguoidung "https://github.com/hoangtran0410/doan_web1/blob/master/css/nguoidung.css"
    click CSS_pagination "https://github.com/hoangtran0410/doan_web1/blob/master/css/pagination_phantrang.css"
    click CSS_style "https://github.com/hoangtran0410/doan_web1/blob/master/css/style.css"
    click CSS_taikhoan "https://github.com/hoangtran0410/doan_web1/blob/master/css/taikhoan.css"
    click CSS_tintuc "https://github.com/hoangtran0410/doan_web1/blob/master/css/tintuc.css"
    click CSS_topnav "https://github.com/hoangtran0410/doan_web1/blob/master/css/topnav.css"
    click CSS_trangchu "https://github.com/hoangtran0410/doan_web1/blob/master/css/trangchu.css"
    click CSS_tuyendung "https://github.com/hoangtran0410/doan_web1/blob/master/css/tuyendung.css"

    %% Click Events for Admin CSS Files
    click AdminCSS_progress "https://github.com/hoangtran0410/doan_web1/blob/master/css/admin/progress.css"
    click AdminCSS_style "https://github.com/hoangtran0410/doan_web1/blob/master/css/admin/style.css"

    %% Click Events for Custom Scripts and External Libraries
    click JS_chitiet "https://github.com/hoangtran0410/doan_web1/blob/master/js/chitietsanpham.js"
    click JS_giohang "https://github.com/hoangtran0410/doan_web1/blob/master/js/giohang.js"
    click JS_lienhe "https://github.com/hoangtran0410/doan_web1/blob/master/js/lienhe.js"
    click JS_nguoid "https://github.com/hoangtran0410/doan_web1/blob/master/js/nguoidung.js"
    click JS_trangchu "https://github.com/hoangtran0410/doan_web1/blob/master/js/trangchu.js"
    click JS_classes "https://github.com/hoangtran0410/doan_web1/blob/master/js/classes.js"
    click JS_dungchung "https://github.com/hoangtran0410/doan_web1/blob/master/js/dungchung.js"
    click Jquery "https://github.com/hoangtran0410/doan_web1/tree/master/js/Jquery"
    click Owlcarousel "https://github.com/hoangtran0410/doan_web1/tree/master/js/owlcarousel"

    %% Click Event for Admin JS
    click Admin_JS_inner "https://github.com/hoangtran0410/doan_web1/blob/master/js/admin.js"

    %% Click Event for Data Source
    click DataProducts "https://github.com/hoangtran0410/doan_web1/blob/master/data/products.js"

    %% Click Events for Assets Images and Screenshots
    click Images "https://github.com/hoangtran0410/doan_web1/tree/master/img"
    click Screenshots "https://github.com/hoangtran0410/doan_web1/tree/master/screenshots"

    %% Class Definitions
    classDef html fill:#f9e6ff,stroke:#8A2BE2,stroke-width:2px;
    classDef htmlBold fill:#f9c,stroke:#800080,stroke-width:3px;
    classDef admin fill:#ffe6e6,stroke:#ff0000,stroke-width:2px;
    classDef adminBold fill:#ffcccc,stroke:#cc0000,stroke-width:3px;
    classDef css fill:#e6f7ff,stroke:#007acc,stroke-width:2px;
    classDef js fill:#e6ffe6,stroke:#00cc00,stroke-width:2px;
    classDef data fill:#fff0b3,stroke:#e68a00,stroke-width:2px;
    classDef asset fill:#f0f0f0,stroke:#666,stroke-width:2px;
```
