How medtijabou/p7_kasa works
Project type and purpose
• This is a front-end SPA built in React, using Vite as the bundler/dev server.
• No custom backend or API; it consumes static JSON in public/Datas.
Main components
a. Developer Toolchain
• Node.js environment (NPM)
• Vite Dev Server (vite.config.js)
• Plugins: @vitejs/plugin-react or plugin-react-swc, Babel/SWC for Fast Refresh
b. Source Code
• src/ (JSX components, pages, style SASS modules, assets)
• public/ (static index.html, JSON data, images)
c. Build Pipeline
• Babel or SWC transpilation (JSX → JS, SCSS → CSS)
• Module bundling, asset hashing, code splitting
• Output to dist/
d. Runtime/Production
• Static Web Server or CDN hosting the dist folder
• Browser as the runtime environment
e. Data Resources
• Static JSON (collapses.json, logements.json) served via HTTP from public/Datas
Relationships and data flows
• Developer writes code in src/ and saves → Vite Dev Server watches files → serves updated module → Browser HMR updates components.
• On build: Vite reads vite.config.js, applies plugins, bundles src/ + public assets → outputs optimized files in dist/.
• At runtime (prod): Browser requests files from Static Server/CDN → React app bootstraps from index.html → fetches JSON from /Datas/... → renders UI (components, pages, slideshow, collapse, etc.).
Architectural patterns & design principles
• Component-based UI (React): split into reusable components (Header, Footer, Card, Collapse, etc.) organized under src/components and src/pages.
• Asset separation: styling modularized per component in src/style/components and per-page in src/style/page.
• Single source of truth for routing via React Router (assumed in App.jsx).
• Static data decoupled from code, served as JSON.