How jc1902/react-projects works
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