# jonarcasdev/medvoxel architecture

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

- Interactive diagram: https://gitdiagram.com/jonarcasdev/medvoxel
- Repository: https://github.com/jonarcasdev/medvoxel

## Overview

##### Project Type and Purpose
- This is a full‐stack‐style frontend application (no dedicated backend in the repo) built with React (via Vite) that:
- Serves multiple “pages” (Home, About, CRUD flows, Quiz, Enfermedades/Trombosis, NotFound)
- Renders 3D scenes/models (using Three.js or similar) with assets under /public and modules under src/pages/models3d
- Manages application state for quizzes via a Zustand store (src/stores/use-quiz-store.js)
- Is configured for deployment on Vercel (vercel.json)

##### File Structure and Architectural Patterns
- Top‐level:
- package.json, vite.config.js, index.html → build tooling & entry point
- public/Textures, public/models-3d → static assets served as static files
- src/ ── component + page hierarchy
– src/layout → shared Layout, Header, Footer
– src/pages → routes with per‐page components (CRUD/Login/Register/Dashboard, Quiz, Enfermedades, 3D models, etc.)
– src/lights → 3D scene lighting configuration
– src/stores → centralized state (Zustand)
– src/main.jsx → ReactDOM render + router mount point
- Architectural Pattern: Component-based UI with react-router for routing, single‐page‐app, centralized lightweight store for quiz state, and a 3D renderer context (likely via react-three-fiber).

A. Presentation Layer
– Browser / Client
– React App (mounted in index.html via main.jsx)
– Router (React Router) → directs to page components
– Page Components (Home, About, CRUD, Quiz, NotFound, Enfermedades, Models3D)
– Shared Layout Components (Header, Footer, Layout wrapper)
B. 3D Rendering Subsystem
– Scene Setup (lights.jsx)
– 3D Model Loaders (GLTFLoader feeding from public/models-3d)
– Canvas Renderer (Three.js/react-three-fiber)
C. State Management
– Zustand Store (use-quiz-store.js) → holds quiz questions, answers, user progress
D. Static Asset Delivery
– Vite Dev/Build → bundles src into optimized assets
– public directory → textures & 3D models served as static files
E. Deployment
– Vercel platform (vercel.json) for hosting the output of the build process

##### Relationships & Data Flows
- User clicks a link → React Router loads a Page Component
- Page Components may:
- Read/write quiz data via the Zustand store
- Trigger 3D render calls (load textures/models, configure lights)
- UI via Layout/Header/Footer
- Build & Serve:
- Vite bundles all src + imports, copies public assets → static files → deployed on Vercel

##### Architectural Patterns & Principles
- Component-based separation of concerns
- Single‐source-of-truth state (Zustand) for quiz logic
- Static asset hosting for models & textures
- SPA routing for modular page loading
- Decoupling of 3D rendering concerns (lights, models) into their own modules

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Browser / Client"
        direction TB
        App["React App<br/>(src/main.jsx)"]:::ui
        Router["React Router"]:::ui
        subgraph "Shared Layout"
            direction TB
            Header["Header.jsx"]:::ui
            Layout["Layout.jsx"]:::ui
            Footer["Footer.jsx"]:::ui
        end
        subgraph "Pages"
            direction TB
            Home["Home.jsx"]:::ui
            About["About.jsx"]:::ui
            CRUD_Dashboard["Dashboard.jsx"]:::ui
            CRUD_Login["Login.jsx"]:::ui
            CRUD_Register["Register.jsx"]:::ui
            QuizPage["Quiz.jsx"]:::ui
            Enfer["Enfermedades.jsx"]:::ui
            Tromb["Trombosis.jsx"]:::ui
            NotFound["NotFound.jsx"]:::ui
            FloorPage["Floor.jsx"]:::ui
            Heart1Page["Heart1.jsx"]:::ui
            Heart2Page["Heart.jsx"]:::ui
        end
    end

    subgraph "3D Rendering Engine"
        direction TB
        Lights["lights.jsx"]:::gfx
        GLTFLoader["GLTFLoader"]:::gfx
        Canvas["Canvas Renderer"]:::gfx
    end

    subgraph "State Store"
        QuizStore["use-quiz-store.js"]:::state
    end

    subgraph "Static Assets"
        direction TB
        HeartAsset["Heart.glb"]:::asset
        Textures["Textures/"]:::asset
    end

    subgraph "Build & Deploy"
        direction TB
        Vite["vite.config.js"]:::infra
        Vercel["vercel.json"]:::infra
    end

    %% Connections within Client
    App --> Router
    Router --> Home
    Router --> About
    Router --> CRUD_Dashboard
    Router --> CRUD_Login
    Router --> CRUD_Register
    Router --> QuizPage
    Router --> Enfer
    Router --> Tromb
    Router --> NotFound
    Router --> FloorPage
    Router --> Heart1Page
    Router --> Heart2Page

    %% Layout integration
    Home --> Layout
    About --> Layout
    CRUD_Dashboard --> Layout
    CRUD_Login --> Layout
    CRUD_Register --> Layout
    QuizPage --> Layout
    Enfer --> Layout
    Tromb --> Layout
    NotFound --> Layout
    FloorPage --> Layout
    Heart1Page --> Layout
    Heart2Page --> Layout
    Layout --> Header
    Layout --> Footer

    %% State store usage
    App --> QuizStore
    QuizPage --> QuizStore

    %% 3D Engine flows
    FloorPage --> Lights
    FloorPage --> GLTFLoader
    FloorPage --> Canvas
    Heart1Page --> Lights
    Heart1Page --> GLTFLoader
    Heart1Page --> Canvas
    Heart2Page --> Lights
    Heart2Page --> GLTFLoader
    Heart2Page --> Canvas

    GLTFLoader --> HeartAsset
    GLTFLoader --> Textures

    Canvas --> App

    %% Build & Deploy flows
    Vite --> Vercel
    Vite --> App
    Vite --> HeartAsset
    Vite --> Textures
    Vercel --> App

    %% Click Events
    click App "https://github.com/jonarcasdev/medvoxel/blob/jac/src/main.jsx"
    click Header "https://github.com/jonarcasdev/medvoxel/blob/jac/src/layout/Header/Header.jsx"
    click Layout "https://github.com/jonarcasdev/medvoxel/blob/jac/src/layout/Layout.jsx"
    click Footer "https://github.com/jonarcasdev/medvoxel/blob/jac/src/layout/Footer/Footer.jsx"
    click Home "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/Home/Home.jsx"
    click About "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/About/About.jsx"
    click CRUD_Dashboard "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/Crud/Dashboard/Dashboard.jsx"
    click CRUD_Login "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/Crud/Login/Login.jsx"
    click CRUD_Register "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/Crud/Register/Register.jsx"
    click QuizPage "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/quiz/Quiz.jsx"
    click Enfer "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/Enfermedades/Enfermedades.jsx"
    click Tromb "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/Enfermedades/Trombosis/Trombosis.jsx"
    click NotFound "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/not-found/NotFound.jsx"
    click FloorPage "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/models3d/Floor.jsx"
    click Heart1Page "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/models3d/Heart1.jsx"
    click Heart2Page "https://github.com/jonarcasdev/medvoxel/blob/jac/src/pages/models3d/heart.jsx"
    click Lights "https://github.com/jonarcasdev/medvoxel/blob/jac/src/lights/lights.jsx"
    click QuizStore "https://github.com/jonarcasdev/medvoxel/blob/jac/src/stores/use-quiz-store.js"
    click Vite "https://github.com/jonarcasdev/medvoxel/blob/jac/vite.config.js"
    click Vercel "https://github.com/jonarcasdev/medvoxel/blob/jac/vercel.json"
    click HeartAsset "https://github.com/jonarcasdev/medvoxel/blob/jac/public/models-3d/Heart.glb"
    click Textures "https://github.com/jonarcasdev/medvoxel/tree/jac/public/Textures/"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0066CC,color:#000
    classDef state fill:#DFFFD6,stroke:#33AA00,color:#000
    classDef gfx fill:#FFE4B5,stroke:#FF8C00,color:#000
    classDef asset fill:#FFF2CC,stroke:#CC9900,color:#000
    classDef infra fill:#E0E0E0,stroke:#888888,color:#000
```
