How sinha-19/bill-split works
Project Type and Purpose
• BillSplit is a front-end-only, component-based PWA for splitting bills.
• It uses React + Vite for UI and build, persists data in LocalStorage, and fetches live rates from an external ExchangeRate API.
a. Browser / Client Container
– Represents the user’s browser running as a PWA.
b. Static Assets & PWA Shell
– Files in public/ (index.html, manifest.json, sw.js).
– Service Worker (caching, offline).
c. React Application (src/)
– UI Components (Header, HomePage, CreateSplitPage, ResultPage, etc.)
– Utility Modules
• currencyUtils.js (external API calls)
• storageUtils.js (LocalStorage read/write)
– Styling pipeline (tailwind.config.js, postcss.config.js)
d. External ExchangeRate API
– Real-time currency data.
Relationships & Data Flows
• On page load, the Service Worker may serve cached index.html + JS/CSS → Browser.
• Browser instantiates React via main.tsx → mounts App.jsx / App.tsx.
• User interacts with UI → React state updates.
• Actions in components call storageUtils → save/load session in LocalStorage.
• CurrencySelector or calculation routines call currencyUtils → fetch rates from ExchangeRate API → update component state.
• ResultPage renders computed balances.
Architectural Patterns & Design Principles
• Component-Based Architecture (React) with clear separation of concerns: presentation vs. logic vs. utilities.
• Single-Page Application (SPA) pattern.
• PWA enhancements: offline support with Service Worker.
• Local persistence via browser LocalStorage.
• External integration via REST API.
Detailed Elements
– Vite build layer (optional): Vite config → bundles src → public → served by SW.
– Tailwind/PostCSS pipelines (optional): styling flow.
– Service Worker caching strategy (cache-first for static, network-first for API).