# tructrantrung/voguevibe-vto architecture

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

- Interactive diagram: https://gitdiagram.com/tructrantrung/voguevibe-vto
- Repository: https://github.com/tructrantrung/voguevibe-vto

## Overview

##### Project Overview & Main Components
- This is a full-stack web-based AI platform for fashion recommendations and a touchless virtual try-on feature. It integrates computer vision models (YOLO and DeepFace) for detecting clothing and user attributes, together with deep learning virtual try-on (VITON-HD) modules.
- User Interfaces – Includes the main frontend and the admin panel.
- Backend API – The central Node.js server that handles business logic, authentication (using Firebase), and database interactions (with MongoDB).
- Specialized AI/ML Services:
- Recommendation API: Incorporates YOLO-based clothing item detection (see Web/API_RECOMENDATION).
- Virtual Try-On API: Involves the VITON-HD modules, custom dataloaders, and supporting python utilities (see Web/API_Virtual_Try_On).
- Database & Feature Storage – MongoDB for user and product data along with precomputed features (found in Features_DataBase) that aid in matching similar fashion items.

##### Analyzing the File Structure for Clues
- The "Web" folder contains all web-focused components:
- /frontend: Contains the customer-facing React-based application.
- /admin: Contains a separate admin panel with its own build configurations and UI components.
- /backend: A Node.js-powered backend server that connects to other services and handles API requests.
- /API_RECOMENDATION and /API_Virtual_Try_On: These directories host Python-based microservices dedicated to AI operations. They include their own supporting libraries, utilities, and pre-trained model files (such as “yolov8n.pt” and the VITON-HD directory).
- There are additional directories like “Features_DataBase” (providing precomputed features and labels for recommendation matching) and “Slide” (for presentation materials).

##### Establishing Relationships & Data Flow
- User Interaction: A user uploads an image or selfie through the frontend. In parallel, the admin panel provides management functions for products.
- Frontend -> Backend: The frontend components send HTTP requests for login, product recommendation, or virtual try-on processing.
- Backend Service: Acts as the central hub receiving requests, interfacing with the MongoDB database and Firebase for authentication and real-time data sync.
- AI API Microservices:
- Recommendation API (Web/API_RECOMENDATION): Receives image data, triggers the YOLO model to detect clothing items, and then fetches matching products from the database using precomputed feature similarity (using the DINOv2-based features stored under Features_DataBase).
- Virtual Try-On API (Web/API_Virtual_Try_On): Accepts user images, processes them through the VITON-HD pipeline along with supporting dataloaders and network modules, and produces a virtual try-on output.
- Integrations: External services (Firebase for auth, MongoDB for persistent storage) are configured via the backend and appropriate configuration files (as noted in the README).

##### Including Relevant Technologies and Frameworks
- Frontend: React (indicated by package.json, JSX files, Tailwind CSS config).
- Backend: Node.js, Express-like service (index.js in the backend folder) with integration for Firebase.
- AI & ML Services: Python is used to run the AI modules (YOLO, VITON-HD). Also note supporting libraries such as those handling deep learning and image processing.
- Database: MongoDB is used as the primary data store.
- Supporting Service: Firebase handles user authentication and perhaps real-time database aspects.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U("User"):::user

    subgraph "User Interfaces"
        FR("Customer Frontend (React, Tailwind CSS)"):::frontend
        AD("Admin Dashboard"):::frontend
    end

    BE("Backend API (Node.js, Express, Firebase)"):::backend

    subgraph "AI Services"
        RE("Recommendation Service (YOLO, Python)"):::aiservice
        VT("Virtual Try-On Service (VITON-HD, Python)"):::aiservice
    end

    DB("Database & Feature Storage (MongoDB, Precomputed Features)"):::database
    FB("Firebase"):::external

    %% Data Flow
    U --> FR
    U --> AD
    FR -->|"HTTP_Request"| BE
    AD -->|"Management_Action"| BE
    BE -->|"Recommendation_Request"| RE
    BE -->|"TryOn_Request"| VT
    BE -->|"DB_Read/Write"| DB
    BE -->|"Auth_Call"| FB

    %% Annotation: Only one API runs at a time
    NT("Note:Only_one_API_runs_at_a_time"):::note
    RE ---|"annotation"| NT
    VT ---|"annotation"| NT

    %% Click Events
    click FR "https://github.com/tructrantrung/voguevibe-vto/tree/main/Web/frontend"
    click AD "https://github.com/tructrantrung/voguevibe-vto/tree/main/Web/admin"
    click BE "https://github.com/tructrantrung/voguevibe-vto/tree/main/Web/backend"
    click RE "https://github.com/tructrantrung/voguevibe-vto/tree/main/Web/API_RECOMENDATION"
    click VT "https://github.com/tructrantrung/voguevibe-vto/tree/main/Web/API_Virtual_Try_On"
    click DB "https://github.com/tructrantrung/voguevibe-vto/tree/main/Features_DataBase"

    %% Style Definitions
    classDef frontend fill:#99d8c9,stroke:#2ca25f,color:#000,stroke-width:2px;
    classDef backend fill:#fc8d62,stroke:#e6550d,color:#000,stroke-width:2px;
    classDef aiservice fill:#8da0cb,stroke:#4575b4,color:#000,stroke-width:2px;
    classDef database fill:#e78ac3,stroke:#d53e4f,color:#000,stroke-width:2px;
    classDef external fill:#66c2a5,stroke:#238b45,color:#000,stroke-width:2px;
    classDef user fill:#ffd92f,stroke:#e5c07b,color:#000,stroke-width:2px;
    classDef note fill:#f7f7f7,stroke:#555,color:#000,stroke-dasharray: 5 5,stroke-width:2px;
```
