How franklinomar23/pemsun works
Project type and purpose
• This is a single-page application (SPA) built with React and Vite.
• It serves static assets (HTML, CSS, JS, JSON) to the browser and provides interactive UI components (charts, lists, file upload).
File structure
• Top level:
• index.html – the SPA host page
• package.json / package-lock.json – NPM dependencies & scripts
• vite.config.js – dev/build server configuration
• public/ – static assets (favicon, manifest, etc.)
• src/ – all React app code
• src breakdown:
• App.jsx / main.jsx – entrypoint, React root instantiation
• components/ – UI components (Progress, Chart, SubjectList, UploadFile)
• page/ – page-level components (Home)
• data/ – JSON files (materias.json, medicina.json) treated as “backend” data sources
• hook/ – custom hook useMaterias.js for data loading & state
• utils/ – pure functions to transform data (progressUtil, materiaUtils)
• Config files:
• eslint.config.js – lint rules
• vite.config.js – plugin/react or plugin-react-swc for HMR
README for additional insights
• Minimal React + Vite template
• Uses one of two official React plugins for fast refresh
• Encourages TypeScript for production, but project is plain JS
Main components
a. Development environment
• Developer Workstation
• Vite Dev Server (with React plugin for HMR)
• ESLint process (code linting during dev)
b. Build/Production environment
• Vite Build (bundler)
• Static File Server (e.g., Nginx, GitHub Pages)
c. Client-side application
• Browser / JS runtime
• index.html → mounts React app
• React Core (App.jsx → component tree)
• Components:
– SubjectList/SubjectItem
– Progress (Progress.jsx)
– RemainingTimeChart (charts)
– UploadFile
• Data Sources (JSON files under src/data or public)
• Hooks & Utils for data fetching and manipulation
Relationships and data flow
• Developer edits code → Vite Dev Server recompiles + HMR → Browser updates
• On page load: index.html served → main.jsx bootstraps React into DOM
• React App calls useMaterias hook → reads JSON files via ES module import or fetch
• Data flows into utils → formatted → passed down to Presentation components (charts, lists)
• User actions (e.g., file upload) handled by UploadFile component → local state updates
Architectural patterns & design principles
• SPA architecture
• Component-based UI (React)
• Separation of concerns: data fetching (hook) vs. data transformation (utils) vs. presentation (components)
• Dev/Prod build pipeline (Vite) with fast-refresh plugin