# jc1902/react-projects architecture

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

- Interactive diagram: https://gitdiagram.com/jc1902/react-projects
- Repository: https://github.com/jc1902/react-projects

## Overview

##### Project Type and Purpose
- This repository is a monorepo containing multiple standalone React Single-Page Applications (SPAs) for practice.
- Each subdirectory (e.g., buscador-peliculas, carrito-react, calorie-tracker) is a Vite-based React frontend project that consumes mock data or external REST APIs.

##### File-Structure Analysis
- Top level: a README plus folders for each demo app.
- Each app folder contains:
- index.html, package.json, vite.config.* – Vite setup and build scripts
- public – static assets
- src – React source code, with subfolders:
– components (presentation & container components)
– hooks (custom state management hooks)
– services or data (API / mock-data abstractions)
– assets, types (for TS projects), styles
- No backend code—these are pure frontend applications.

##### Key Architectural Patterns
- Component hierarchy (tree of reusable UI components)
- Separation of concerns:
– UI layer: components
– State layer: hooks
– Data layer: services (fetch wrappers)
- Build/dev workflow via Vite (dev server, hot reload, production bundling)

##### Main Components
a. Monorepo Level
– Developer environment (IDE, CLI)
– Version control (Git)
– Monorepo containing N independent SPA projects
b. Per-App Level (choose one app or show a generic template)
– Vite Dev Server / Bundler
– Static Host (e.g., Netlify, Vercel)
– Browser (Client)
– React App Entry (src/main.jsx or main.tsx)
– Component Tree (App → child components)
– Custom Hooks (state management, useMovies, useOrder)
– Services Layer (API clients, mock JSON)
– External API or Mock Data
– Asset pipeline (public folder)

##### Relationships and Data Flow
- Developer triggers `npm run dev` → Vite dev server compiles source → streams to browser
- Browser loads index.html → bootstraps React App
- User interacts with UI components → event handlers invoke hooks → hooks call services → HTTP fetch or mock data → data flows back to hooks → state updates → UI re-renders
- On production build: Vite bundles code → deploys static assets to host → browser requests JS/CSS/assets → same runtime flow

##### Architectural Patterns & Principles
- Unidirectional data flow (React’s top-down props + hooks)
- Single responsibility (components vs hooks vs services)
- Convention over configuration (Vite defaults with minimal config)
- Modularization: each demo is an isolated application folder

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo Level
    subgraph "Monorepo Repository" 
        direction TB
        RepoMeta["README.md"]:::repo
        GitIgnore[".gitignore"]:::repo
        subgraph "SPA Projects" 
            direction TB
            BP["buscador-peliculas"]:::repo
            CP["calculadora_propinas"]:::repo
            CT["calorie-tracker"]:::repo
            CR["carrito-react"]:::repo
            GTs["guitarla-ts"]:::repo
            GT["guitarla"]:::repo
            SC["shopping-cart"]:::repo
        end
    end

    %% Detail: Buscador Películas SPA
    subgraph "buscador-peliculas (Detail View)"
        direction TB
        %% Build/Dev Layer
        Vite["Vite Dev Server / Bundler"]:::build
        HTML["index.html"]:::build
        Package["package.json"]:::build
        %% Deployment Stage (Static Host)
        Host["Static Host (Netlify/Vercel)"]:::runtime
        %% Client Runtime
        Browser["Browser"]:::runtime
        ReactEntry["src/main.jsx"]:::runtime
        AppComponent["src/App.jsx"]:::runtime
        ComponentTree["Movies Component\n(src/components/Movies.jsx)"]:::runtime
        Hook["useMovies Hook\n(src/hooks/useMovies.js)"]:::runtime
        Service["Movies Service\n(src/services/movies.js)"]:::runtime
        PublicAssets["public"]:::runtime
        %% Data Sources
        Mock1["noResults.json"]:::data
        Mock2["withResults.json"]:::data
    end

    %% Relationships
    RepoMeta -->|contains| BP
    GitIgnore -->|applies to| BP
    BP -->|"build config"| Vite
    BP -->|"html entry"| HTML
    BP -->|"scripts & deps"| Package
    BP -->|"static assets"| PublicAssets
    Vite -->|"bundles/dev compiles"| Browser
    Host -->|"serves bundles"| Browser
    Browser -->|"loads"| HTML
    HTML -->|"bootstraps"| ReactEntry
    ReactEntry -->|"renders"| AppComponent
    AppComponent -->|"renders"| ComponentTree
    ComponentTree -->|"uses state via"| Hook
    Hook -->|"calls"| Service
    Service -->|"fetchMovies() GET"| Mock1
    Service -->|"fetchMovies() GET"| Mock2
    Browser -->|"requests assets"| PublicAssets

    %% Click Events
    click RepoMeta "https://github.com/jc1902/react-projects/blob/main/README.md"
    click GitIgnore "https://github.com/jc1902/react-projects/blob/main/.gitignore"
    click Vite "https://github.com/jc1902/react-projects/blob/main/buscador-peliculas/vite.config.js"
    click HTML "https://github.com/jc1902/react-projects/blob/main/buscador-peliculas/index.html"
    click Package "https://github.com/jc1902/react-projects/blob/main/buscador-peliculas/package.json"
    click PublicAssets "https://github.com/jc1902/react-projects/tree/main/buscador-peliculas/public"
    click ReactEntry "https://github.com/jc1902/react-projects/blob/main/buscador-peliculas/src/main.jsx"
    click AppComponent "https://github.com/jc1902/react-projects/blob/main/buscador-peliculas/src/App.jsx"
    click ComponentTree "https://github.com/jc1902/react-projects/blob/main/buscador-peliculas/src/components/Movies.jsx"
    click Hook "https://github.com/jc1902/react-projects/blob/main/buscador-peliculas/src/hooks/useMovies.js"
    click Service "https://github.com/jc1902/react-projects/blob/main/buscador-peliculas/src/services/movies.js"
    click Mock1 "https://github.com/jc1902/react-projects/blob/main/buscador-peliculas/src/mockups/noResults.json"
    click Mock2 "https://github.com/jc1902/react-projects/blob/main/buscador-peliculas/src/mockups/withResults.json"

    %% Styles
    classDef build fill:#D0E6FF,stroke:#000
    classDef runtime fill:#DFFFD0,stroke:#000
    classDef data fill:#FFE6A7,stroke:#000
    classDef repo fill:#F0F0F0,stroke:#000
```
