# nguyenphuocsang1695/project_website_advance architecture

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

- Interactive diagram: https://gitdiagram.com/nguyenphuocsang1695/project_website_advance
- Repository: https://github.com/nguyenphuocsang1695/project_website_advance

## Overview

##### Project Overview and Purpose
- The project is a web application that appears to serve both end users and administrators. There are distinct sections for the administration interface (the “admin” directory) and for public user pages (found under “pages” and “src”). Additionally, there is a “php-api” folder that indicates backend API endpoints (including database connectivity via connectdb.php and product filtering). The project is essentially a full-stack web application built using a mix of HTML, CSS, JavaScript, PHP, and various assets/libraries (like Bootstrap and Font Awesome).

##### Analyzing the File Structure
- Top-level Directories:
- admin: Contains the administration web pages and related assets including CSS, JavaScript, fonts (Font Awesome), and PHP pages.
- pages: Contains HTML and PHP pages intended for regular user interactions (such as login, registration, shopping cart “gio-hang”, search results, etc.).
- src: Holds additional CSS and JS files that likely represent the styling and interactive logic for the user front-end.
- php-api: Contains PHP scripts that connect to the database and perform operations like filtering products.
- Other files such as index.html, note.md, quy-uoc.txt, and configuration files indicate extra documentation, external guidelines, or simple setup instructions.
- The structure clearly separates client-side resources (HTML/CSS/JS) and server-side PHP/API components.

##### Key Components (to be highlighted
a. Frontend – Two distinct areas:
- Admin Interface (admin folder):
– Admin dashboard pages
– Admin-specific CSS (style, admin/css) and JS files (admin/js)
- Public/User Interface (pages and src folders):
– User pages (login, registration, cart, history, product display)
– CSS and JS for user interactions maintained in src.
b. Backend/API (php-api folder):
- PHP scripts for database connectivity and filtering logic.
- Likely interacts with a relational database (implied by connectdb.php) even though the database itself isn’t in the file tree.
c. Shared Assets/Components (assets folder):
- Contains UI components, Bootstrap libraries, and Font Awesome assets.
- These support both admin and user parts.
d. External Libraries and Dependencies:
- Bootstrap (assets/libs) for responsive layout and components.
- Community or vendor files ensure modularity and reusability.

##### Relationships and Interactions
- Frontend (both Admin and User) sends requests to the backend PHP API endpoints (in php-api) – display interactions, data submission, etc.
- The backend connects to a (likely external) database to persist or retrieve data (e.g., customer information, order details, etc.).
- Common assets and libraries are used across both frontends to ensure consistency of look & feel.
- Some client-side JavaScript (in both admin/js and src/js) may perform asynchronous calls (AJAX) to the php-api endpoints to fetch or manipulate data.

##### Architectural Patterns and Design Principles
- MVC-like separation: While not strictly following an MVC framework, the logical separation is evident between:
– Views: HTML/CSS in “admin”, “pages”, and “src”
– Controller / Client logic: JavaScript (admin/js, src/js)
– Model / Data access: PHP scripts in “php-api” interacting with the database.
- Separation of concerns: Files are neatly organized by their role (CSS, JS, fonts, API).
- Asset Management: The use of dedicated folders for third-party components and libraries reflects attention to modularity and maintainability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Admin Frontend
    subgraph "Admin Frontend"
        A["Admin Dashboard Pages"]:::admin
        A_CSS["Admin CSS"]:::admin
        A_JS["Admin JS"]:::admin
        A --> A_CSS
        A --> A_JS
    end

    %% Public/User Frontend
    subgraph "User Frontend"
        U["User Pages"]:::user
        U_src["User CSS/JS"]:::user
        U --> U_src
    end

    %% Backend/API Layer
    subgraph "Backend/API"
        API["PHP API Server"]:::api
        API_DB["Database Connection"]:::database
        API --> API_DB
    end

    %% Shared Assets and Libraries
    Shared["Shared Assets & Libraries"]:::shared

    %% Interactions
    A -->|"sendsRequests"| API
    U -->|"sendsRequests"| API
    A ---|"uses"| Shared
    U ---|"uses"| Shared

    %% Click Events
    click A "https://github.com/nguyenphuocsang1695/project_website_advance/tree/develop/admin"
    click A_CSS "https://github.com/nguyenphuocsang1695/project_website_advance/tree/develop/admin/css"
    click A_JS "https://github.com/nguyenphuocsang1695/project_website_advance/tree/develop/admin/js"
    click U "https://github.com/nguyenphuocsang1695/project_website_advance/tree/develop/pages"
    click U_src "https://github.com/nguyenphuocsang1695/project_website_advance/tree/develop/src"
    click API "https://github.com/nguyenphuocsang1695/project_website_advance/tree/develop/php-api"
    click API_DB "https://github.com/nguyenphuocsang1695/project_website_advance/blob/develop/php-api/connectdb.php"
    click Shared "https://github.com/nguyenphuocsang1695/project_website_advance/tree/develop/assets"

    %% Styles
    classDef admin fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef user fill:#ccffcc,stroke:#009900,stroke-width:2px;
    classDef api fill:#ccccff,stroke:#0000cc,stroke-width:2px;
    classDef database fill:#ffe6cc,stroke:#cc6600,stroke-width:2px;
    classDef shared fill:#e6f7ff,stroke:#0099cc,stroke-width:2px;
```
