# shresta-voruganti/ai-wardrobe1 architecture

> Architecture diagram of the GitHub repository shresta-voruganti/ai-wardrobe1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shresta-voruganti/ai-wardrobe1
- Repository: https://github.com/shresta-voruganti/ai-wardrobe1

## Overview

##### Project Type and Purpose
- This is a full-stack, single-page web application (“AI Wardrobe”) that leverages a React frontend (in src/ and public/) and a Python backend (server/server.py plus requirements.txt). Its purpose is to let users upload photos of clothing, run computer-vision/ML models on the server to detect and classify garments, store them in a digital wardrobe, and generate outfit recommendations via an AI model.

##### File Structure Analysis
- Top-level: package.json (npm/React), server/ (Python API), public/ (React’s static assets), src/ (React components/pages).
- src/pages contains three major UI flows: Main (landing/dashboard), UploadItem (image upload + classification modal), Wardrobe (view stored items + outfit generation modal).
- server/server.py likely implements REST endpoints for item classification, wardrobe CRUD, and outfit recommendation.
- No explicit DB folder—assume the server persists metadata either to a lightweight DB (e.g., SQLite) or file storage; pre-trained models live in the repo root per README.

##### README Insights
- Confirms computer-vision “Clothing Detection”, “Digital Wardrobe” storage, and “Outfit Generation” features.
- Describes a two-step local setup: pip install server dependencies + npm start front end.
- External ML artifacts (models) must be downloaded into the root.

##### Diagramming the Architecture
a. Main Components
- User’s Browser (React UI)
- React Frontend (src/ + public/)
- API Gateway / Backend (Flask or equivalent in server/server.py)
- ML Model Layer (pre-trained CV and outfit-generation models)
- Data Storage (Digital Wardrobe DB or filesystem)
- Jupyter Notebook Suite (offline data-prep & model training—not in runtime)
b. Relationships & Data Flow
1. User interacts with React UI → triggers HTTP requests (POST /upload, GET /wardrobe, GET /outfits)
2. Backend API receives request → loads appropriate ML model → processes image or wardrobe data
3. Backend persists metadata & image references to storage → returns JSON response to frontend
4. React UI renders updated wardrobe or outfit recommendations
c. Architectural Patterns
- Client-Server separation (SPA + REST API)
- Layered architecture: Presentation (React) → Application (Flask API) → ML Services → Persistence
- Modular React pages for each UI flow
d. Key Technologies
- Frontend: React, create-react-app, CSS Modules
- Backend: Python 3.x, Flask (or FastAPI), pip dependencies (requirements.txt)
- ML: TensorFlow/PyTorch models, Jupyter notebooks for training/preprocessing
- Build & Deployment: npm, virtualenv, local static hosting for React, Python HTTP server

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Side
    subgraph "Client Side"
        direction TB
        Browser["User's Browser"]:::external
        subgraph "React SPA" 
            direction TB
            SRC_ROOT["src/"]:::frontend
            PUBLIC_ROOT["public/"]:::frontend
            INDEX_JS["index.js"]:::frontend
            APP_JS["App.js"]:::frontend
            subgraph "Pages"
                direction TB
                MainPage["Main.jsx"]:::frontend
                MainStyle["Main.module.css"]:::frontend
                UploadPage["UploadItem.jsx"]:::frontend
                UploadStyle["UploadItem.module.css"]:::frontend
                CategoryModal["CategoryModal.jsx"]:::frontend
                WardrobePage["Wardrobe.jsx"]:::frontend
                WardrobeStyle["Wardrobe.module.css"]:::frontend
                WardrobeModal["WardrobeItemModal.jsx"]:::frontend
            end
            SRC_ROOT --> INDEX_JS --> APP_JS --> Pages
            PUBLIC_ROOT -->|hosts| PUBLIC_INDEX["index.html"]:::frontend
            PUBLIC_ROOT --> PUBLIC_MANIFEST["manifest.json"]:::frontend
            PUBLIC_ROOT --> PUBLIC_ROBOTS["robots.txt"]:::frontend
        end
        Browser -->|loads SPA| PUBLIC_INDEX
        Browser -->|interacts| ReactSPA["React SPA"]
    end

    %% Server Side
    subgraph "Server Side"
        direction TB
        API["Flask API (server.py)"]:::backend
        REQS["requirements.txt"]:::backend
        subgraph "Model Layer"
            direction TB
            CVModel["CV Model"]:::ml
            OutfitModel["Outfit Model"]:::ml
        end
        subgraph "Data Storage"
            direction TB
            DB["Database (SQLite/NoSQL)"]:::storage
            FS["Filesystem (Images)"]:::storage
        end
        API -->|"POST /upload\nGET /wardrobe\nGET /outfits"| ReactSPA
        ReactSPA -->|"requests"| API
        API -->|process image| CVModel
        CVModel -->|classification| API
        API -->|generate outfits| OutfitModel
        OutfitModel -->|recommendations| API
        API -->|store metadata| DB
        API -->|store images| FS
        DB -->|metadata| API
    end

    %% Model Development
    JN["Jupyter Notebook Suite"]:::external
    JN -.-> CVModel
    JN -.-> OutfitModel

    %% Click events
    click SRC_ROOT "https://github.com/shresta-voruganti/ai-wardrobe1/tree/main/src/"
    click PUBLIC_ROOT "https://github.com/shresta-voruganti/ai-wardrobe1/tree/main/public/"
    click INDEX_JS "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/src/index.js"
    click APP_JS "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/src/App.js"
    click MainPage "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/src/pages/Main/Main.jsx"
    click MainStyle "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/src/pages/Main/Main.module.css"
    click UploadPage "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/src/pages/UploadItem/UploadItem.jsx"
    click UploadStyle "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/src/pages/UploadItem/UploadItem.module.css"
    click CategoryModal "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/src/pages/UploadItem/CategoryModal.jsx"
    click WardrobePage "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/src/pages/Wardrobe/Wardrobe.jsx"
    click WardrobeStyle "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/src/pages/Wardrobe/Wardrobe.module.css"
    click WardrobeModal "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/src/pages/Wardrobe/WardrobeItemModal.jsx"
    click API "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/server/server.py"
    click REQS "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/server/requirements.txt"
    click PUBLIC_INDEX "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/public/index.html"
    click PUBLIC_MANIFEST "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/public/manifest.json"
    click PUBLIC_ROBOTS "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/public/robots.txt"
    click PACKAGE "https://github.com/shresta-voruganti/ai-wardrobe1/blob/main/package.json"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,stroke-width:1px
    classDef backend fill:#e0ffe0,stroke:#28a745,stroke-width:1px
    classDef storage fill:#fff4e5,stroke:#d2691e,stroke-width:1px
    classDef ml fill:#f3e5ff,stroke:#6f42c1,stroke-width:1px
    classDef external fill:#f0f0f0,stroke:#666,stroke-width:1px

    class PACKAGE external
```
