# cavargas10/frontend-cubeai architecture

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

- Interactive diagram: https://gitdiagram.com/cavargas10/frontend-cubeai
- Repository: https://github.com/cavargas10/frontend-cubeai

## Overview

##### Project type and purpose
- This is a single-page React application built with Vite. It serves as a client-side front end for user authentication, documentation browsing, dashboard management, and 3D generation-prediction workflows. It leverages Firebase for auth, Hygraph for content, and deploys statically (e.g., Vercel).

##### File structure
- Top-level config: `.eslintrc.cjs`, `vite.config.js`, `tailwind.config.js`, `vercel.json` → build, lint, styling, deployment.
- `public/` → static assets like videos, robots.txt.
- `src/` → all React source code:
- `config/` → Firebase and Hygraph client setups
- `layouts/` → Public vs. Dashboard vs. Docs reusable page wrappers
- `features/`
– `auth/` → hooks, routes, pages for login, register, password flows
– `dashboard/` → dashboard UI components and layout
– `documentacion/` → content viewer and sidebar
– `prediction/` → input components, result components, shared viewers, context, hooks, and API service
- `components/` → UI primitives and modal dialogs
- `lib/hygraph/` → GraphQL queries to fetch CMS content
- `pages/`, `App.jsx`, `main.jsx` → entry points and routing

##### README
- Minimal React + Vite template with HMR support and ESLint rules. No backend code—this confirms a static front end that integrates external services.

##### Detail
- How `PredictionContext` wraps input and result.
- Build/deploy pipeline: Vite → static bundle → Vercel → CDN → Browser.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser and CDN
    subgraph "User Environment"
        Browser["Browser"]:::external
    end
    Browser -->|"GET static bundle"| CDN["Vercel/CDN"]:::service
    CDN -->|"serves assets"| Browser

    %% React SPA Layer
    subgraph "React SPA (Vite Bundle)"
        Main["main.jsx"]:::ui
        App["App.jsx"]:::ui
    end
    click Main "https://github.com/cavargas10/frontend-cubeai/blob/main/src/main.jsx"
    click App "https://github.com/cavargas10/frontend-cubeai/blob/main/src/App.jsx"

    Browser -->|"runs SPA"| App

    %% External Services
    subgraph "External Services"
        Auth["Firebase Auth"]:::service
        CMS["Hygraph CMS"]:::service
        API["Prediction API"]:::service
    end
    click Auth "https://github.com/cavargas10/frontend-cubeai/blob/main/src/config/firebase.js"
    click CMS "https://github.com/cavargas10/frontend-cubeai/blob/main/src/config/client.js"
    click API "https://github.com/cavargas10/frontend-cubeai/blob/main/src/features/prediction/services/predictionApi.jsx"

    App -->|"auth token exchange"| Auth
    App -->|"GraphQL query"| CMS
    App -->|"REST call"| API

    %% Prediction Workflow
    subgraph "Prediction Workflow"
        Context["PredictionContext"]:::data
        Hook["usePredictionHandler"]:::data
        Service["predictionApi.jsx"]:::data
        subgraph "Inputs"
            BocetoIn["Boceto3DInput"]:::ui
            ImagenIn["Imagen3DInput"]:::ui
            MultiImagenIn["MultiImagen3DInput"]:::ui
            TextImgIn["TextImg3DInput"]:::ui
            TextoIn["Texto3DInput"]:::ui
            UnicoIn["Unico3DInput"]:::ui
        end
        subgraph "Results"
            BocetoOut["Boceto3DResult"]:::ui
            ImagenOut["Imagen3DResult"]:::ui
            MultiImagenOut["MultiImagen3DResult"]:::ui
            TextImgOut["TextImg3DResult"]:::ui
            TextoOut["Texto3DResult"]:::ui
            UnicoOut["Unico3DResult"]:::ui
        end

        subgraph "Hooks"
            UseCanvas["useCanvasDrawing"]:::data
            UseImgUpload["useImageUpload"]:::data
            UseMultiImg["useMultiImageUpload"]:::data
        end
    end

    click Context "https://github.com/cavargas10/frontend-cubeai/blob/main/src/features/prediction/context/PredictionContext.jsx"
    click Hook "https://github.com/cavargas10/frontend-cubeai/blob/main/src/features/prediction/hooks/usePredictionHandler.jsx"
    click UseCanvas "https://github.com/cavargas10/frontend-cubeai/blob/main/src/features/prediction/hooks/useCanvasDrawing.jsx"
    click UseImgUpload "https://github.com/cavargas10/frontend-cubeai/blob/main/src/features/prediction/hooks/useImageUpload.jsx"
    click UseMultiImg "https://github.com/cavargas10/frontend-cubeai/blob/main/src/features/prediction/hooks/useMultiImageUpload.jsx"

    %% Prediction workflow connections
    BocetoIn -->|"input data"| Context
    ImagenIn -->|"input data"| Context
    MultiImagenIn -->|"input data"| Context
    TextImgIn -->|"input data"| Context
    TextoIn -->|"input data"| Context
    UnicoIn -->|"input data"| Context

    Context -->|"invoke handler"| Hook
    Hook -->|"calls API"| Service
    Service -->|"response data"| Context

    Context -->|"provides results"| BocetoOut
    Context -->|"provides results"| ImagenOut
    Context -->|"provides results"| MultiImagenOut
    Context -->|"provides results"| TextImgOut
    Context -->|"provides results"| TextoOut
    Context -->|"provides results"| UnicoOut

    BocetoOut -->|"render UI"| App
    ImagenOut -->|"render UI"| App
    MultiImagenOut -->|"render UI"| App
    TextImgOut -->|"render UI"| App
    TextoOut -->|"render UI"| App
    UnicoOut -->|"render UI"| App

    %% Class definitions
    classDef ui fill:#D0E7FF,stroke:#0366D6,color:#0366D6;
    classDef service fill:#E6F4EA,stroke:#238636,color:#238636;
    classDef data fill:#FFF4DB,stroke:#BF8700,color:#BF8700;
    classDef external fill:#F0F0F0,stroke:#A0A0A0,color:#3E3E3E;
```
