# diego16022/proyecto-integrador architecture

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

- Interactive diagram: https://gitdiagram.com/diego16022/proyecto-integrador
- Repository: https://github.com/diego16022/proyecto-integrador

## Overview

##### Project type and purpose
- This is a full-stack mobile application (“Outfit Recommender”) built with Flutter on the frontend and FastAPI on the backend.
- Purpose: capture a user’s skin tone with an AI model (ResNet34), manage a virtual closet, record usage metrics, and recommend outfits.
- It uses Amazon S3 for image storage and Amazon RDS (MySQL) for persistent data.

##### File structure
- Top level:
- Modelo/: stand-alone scripts for model training/inference (main.py, modelo_skin.py, predictor.py, recorte.py).
- backend/: FastAPI service.
- frontend/: Flutter multi-platform app (iOS, Android, web, desktop).
- backend/app:
- routers/: HTTP endpoints grouped by resource.
- crud/: data-access layer using SQLAlchemy.
- schemas/: Pydantic models for request/response validation.
- modelos/: PyTorch model loader and inference code, plus the .pt file.
- utils/: AWS S3 upload helper.
- database.py: database engine and session.
- main.py: FastAPI app entrypoint.
- frontend/lib:
- screens/: UI pages/widgets.
- services/: HTTP clients for auth, garments, outfits, recommendations.
- Config files: .env, requirements.txt, pubspec.yaml, Docker/gcloud not present but AWS credentials required.

##### README for additional insights
[Flutter App] <--> [FastAPI Backend] <--> [MySQL RDS]
|
└--> [ResNet34 Model]
└--> [Amazon S3]
- Tech stack: Flutter, FastAPI, PyTorch, SQLAlchemy, Pydantic, AWS S3 & RDS.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Client Layer
  subgraph "Client (Flutter App)"
    direction TB
    FL["Flutter App\n(Dart, http)"]:::client
    SC["screens/\n(UI Pages)"]:::client
    SV["services/\n(HTTP Clients)"]:::client
  end

  %% Backend Layer
  subgraph "Server (FastAPI Backend)"
    direction TB
    EP["main.py\n(FastAPI Entrypoint)"]:::backend
    subgraph "Routers (Presentation)"
      R["routers/\n(Auth, Upload, Predict)"]:::backend
    end
    subgraph "CRUD (Data Access)"
      C["crud/\n(SQLAlchemy)"]:::backend
    end
    subgraph "Schemas (Validation)"
      S["schemas/\n(Pydantic)"]:::backend
    end
    DB["database.py\n(SQLAlchemy Engine)"]:::backend
    subgraph "Modelos (AI Inference)"
      ML1["modelo_skin.py\n(PyTorch)"]:::ml
      ML2["skin_type_model.pt\n(ResNet34)"]:::ml
      ML3["descarga.py\n(Model Download)"]:::ml
    end
    subgraph "Utils (AWS S3)"
      U["s3_upload.py\n(boto3 Helper)"]:::backend
    end
  end

  %% External Services
  subgraph "External Services"
    direction TB
    S3["AWS S3\n(Object Storage)"]:::storage
    RDS["MySQL RDS\n(Relational DB)"]:::storage
  end

  %% Standalone Scripts
  subgraph "Standalone Model Scripts"
    direction TB
    ST["main.py\n(Training)"]:::ml
    SM["modelo_skin.py\n(Inference)"]:::ml
    PRED["predictor.py\n(Predict)"]:::ml
    REC["recorte.py\n(Image Crop)"]:::ml
  end

  %% Data Flows
  FL -->|REST API| R
  R -->|validate| S
  R -->|access| C
  C -->|uses| DB
  R -->|upload| U
  U -->|store| S3
  R -->|infer| ML1
  ML1 -->|load| ML2
  ML3 -->|download| ML2
  R -->|read/write| RDS
  DB -->|connect| RDS
  ML1 -->|result| R
  FL -->|updates UI| SC
  FL -->|calls services| SV

  %% Click Events
  click FL "https://github.com/diego16022/proyecto-integrador/blob/main/frontend/lib/main.dart"
  click SC "https://github.com/diego16022/proyecto-integrador/tree/main/frontend/lib/screens/"
  click SV "https://github.com/diego16022/proyecto-integrador/tree/main/frontend/lib/services/"
  click EP "https://github.com/diego16022/proyecto-integrador/blob/main/backend/app/main.py"
  click R "https://github.com/diego16022/proyecto-integrador/tree/main/backend/app/routers/"
  click C "https://github.com/diego16022/proyecto-integrador/tree/main/backend/app/crud/"
  click S "https://github.com/diego16022/proyecto-integrador/tree/main/backend/app/schemas/"
  click DB "https://github.com/diego16022/proyecto-integrador/blob/main/backend/app/database.py"
  click ML1 "https://github.com/diego16022/proyecto-integrador/blob/main/backend/app/modelos/modelo_skin.py"
  click ML2 "https://github.com/diego16022/proyecto-integrador/blob/main/backend/app/modelos/skin_type_model.pt"
  click ML3 "https://github.com/diego16022/proyecto-integrador/blob/main/backend/app/modelos/descarga.py"
  click U "https://github.com/diego16022/proyecto-integrador/blob/main/backend/app/utils/s3_upload.py"
  click ST "https://github.com/diego16022/proyecto-integrador/blob/main/Modelo/main.py"
  click SM "https://github.com/diego16022/proyecto-integrador/blob/main/Modelo/modelo_skin.py"
  click PRED "https://github.com/diego16022/proyecto-integrador/blob/main/Modelo/predictor.py"
  click REC "https://github.com/diego16022/proyecto-integrador/blob/main/Modelo/recorte.py"

  %% Styles
  classDef client fill:#D0E6FF,stroke:#007BFF,stroke-width:2px
  classDef backend fill:#DFFFE0,stroke:#28A745,stroke-width:2px
  classDef ml fill:#E8D0FF,stroke:#6F42C1,stroke-width:2px
  classDef storage fill:#FFF5D0,stroke:#FFC107,stroke-width:2px
```
