# diegoa-rodriguezc/sistemas-recomendacion architecture

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

- Interactive diagram: https://gitdiagram.com/diegoa-rodriguezc/sistemas-recomendacion
- Repository: https://github.com/diegoa-rodriguezc/sistemas-recomendacion

## Overview

##### Project type and purpose
- This “sistemas-recomendacion” repository is a full-stack, containerized movie-recommendation system. It evolved through three “Taller” exercises (Taller1: basic Flask; Taller2: FastAPI; Taller3: React + FastAPI + Docker). The final deliverable (Taller3) is a web application that:
- Serves a React-based UI to end users
- Exposes a FastAPI backend with endpoints for movies, genres, user ratings, recommendations
- Loads a hybrid recommendation model and data from local files
- Uses Firebase for authentication
- Is orchestrated via Docker Compose

##### File structure (focus on Taller3)
- Top-level:
- Dockerfile (builds the backend image)
- docker-compose.yml (orchestrates frontend and backend containers)
- package.json / vite.config.js (defines the React app)
- index.html (static host for React entry)
- Backend (./Taller3/backend):
- main.py (FastAPI app entrypoint)
- routers/ (six router modules: movies, genres, recommendations, user_ratings)
- models/ (data processing logic & hybrid recommender classes)
- data/ (movie & rating CSV, precomputed pickles)
- requirements.txt
- Frontend (./Taller3/src):
- components/ (React UI building blocks)
- views/ (page-level components: Home, Login)
- services/ (firebase.service.js for auth, movielensService.service.js for API calls)
- routes/, styles/, data/ (local mocks)
- No external DB container; data is file-backed and in-memory.

##### README for additional insights
- README is sparse but the file-tree shows clear separation: front vs. back, service abstractions, prebuilt model artifacts.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Interaction
    User["User (Browser)"]:::external
    User -->|"HTTP requests"| FrontendContainer

    %% Docker Compose Boundary
    subgraph "Docker Compose" 
        direction TB

        %% Frontend Container
        subgraph "React Frontend" 
            direction TB
            FE_Pkg["package.json / vite.config.js / index.html"]:::frontend
            FE_Entry["Entry: main.jsx / App.jsx"]:::frontend
            FE_Components["UI Components"]:::frontend
            FE_Views["Page Views & Routes"]:::frontend
            FE_Services["Services: Auth & API"]:::frontend

            FE_Pkg --> FE_Entry
            FE_Entry --> FE_Views
            FE_Entry --> FE_Components
            FE_Entry --> FE_Services
            FE_Views --> FrontendContainer
        end

        %% Backend Container
        subgraph "FastAPI Backend"
            direction TB
            BE_Main["main.py"]:::backend
            BE_Routers["API Routers"]:::backend
            BE_Models["Recommender Service"]:::backend
            BE_DataLayer["Data Layer (CSV & Pickles)"]:::data

            BE_Main --> BE_Routers
            BE_Routers --> BE_Models
            BE_Models --> BE_DataLayer
            BE_Routers --> BackendContainer
        end
    end

    %% External Services and Data Storage
    Firebase["Firebase Auth"]:::external
    BE_Routers -->|"verifyToken()"| Firebase

    %% Frontend to Backend
    FrontendContainer["React Frontend"]:::frontend
    BackendContainer["FastAPI Backend"]:::backend
    FrontendContainer -->|"HTTP GET /recommendations, /movies, /login"| BackendContainer

    %% Backend to Data Storage
    DataStore["File Store: CSV & Pickles"]:::data
    BE_DataLayer -->|"load(…) / save(…)"| DataStore

    %% Backend to Model Prediction
    BE_Models -->|"predict(user_id)"| BE_Routers

    %% Click Events - Frontend
    click FE_Pkg "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/package.json"
    click FE_Pkg "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/vite.config.js"
    click FE_Pkg "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/index.html"
    click FE_Entry "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/main.jsx"
    click FE_Entry "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/App.jsx"
    click FE_Components "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/components/Button/Button.jsx"
    click FE_Components "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/components/Header/Header.jsx"
    click FE_Components "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/components/Heading/Heading.jsx"
    click FE_Components "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/components/Input/Input.jsx"
    click FE_Components "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/components/MoviePosters/MoviePosters.jsx"
    click FE_Components "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/components/MovieRatingPopup/MovieRatingPopup.jsx"
    click FE_Components "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/components/Paragraph/Paragraph.jsx"
    click FE_Components "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/components/RecommendationsList/RecommendationsList.jsx"
    click FE_Views "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/views/Home/Home.jsx"
    click FE_Views "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/views/Login/Login.jsx"
    click FE_Views "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/routes/index.jsx"
    click FE_Services "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/services/firebase.service.js"
    click FE_Services "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/src/services/movielensService.service.js"
    click FrontendContainer "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/tree/main/Taller3/src/"

    %% Click Events - Backend
    click BE_Main "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/tree/main/Taller3/backend/Dockerfile"
    click BE_Main "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/main.py"
    click BE_Routers "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/routers/movies.py"
    click BE_Routers "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/routers/genres.py"
    click BE_Routers "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/routers/recommendations.py"
    click BE_Routers "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/routers/user_ratings.py"
    click BE_Models "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/models/data_processor.py"
    click BE_Models "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/models/enhancedhybridrecommender.py"
    click BE_Models "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/models/recommendation_model.py"
    click BE_DataLayer "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/data/movies.csv"
    click BE_DataLayer "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/data/ratings.csv"
    click BE_DataLayer "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/data/metadata.json"
    click BE_DataLayer "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/data/item_mapping.pkl"
    click BE_DataLayer "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/data/user_mapping.pkl"
    click BackendContainer "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/backend/requirements.txt"
    click BackendContainer "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/.env"
    click BackendContainer "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/docker-compose.yml"
    click FrontendContainer "https://github.com/diegoa-rodriguezc/sistemas-recomendacion/blob/main/Taller3/package-lock.json"

    %% Styles
    classDef frontend fill:#D6E9FF,stroke:#4A90E2,color:#000;
    classDef backend fill:#E0F7FA,stroke:#0097A7,color:#000;
    classDef data fill:#E8F5E9,stroke:#43A047,color:#000,stroke-dasharray: 5 5;
    classDef external fill:#FFF3E0,stroke:#FB8C00,color:#000,stroke-dasharray: 2 2;
```
