How jonarcasdev/medvoxel works
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