How afrit-bagani/expense-tracker-app works
Project type and purpose
• This is a single‑page React application (built with Vite) that runs entirely in the browser.
• Purpose: Track budgets, incomes, and expenses, persisting data in the browser’s local storage.
File structure
• Top‑level files and folders:
• index.html / public : static shell and assets.
• src : source code for the React SPA.
• src/main.jsx: application entry point.
• src/App.jsx: top‑level component (router, layout wrapper).
• src/pages: route views (Dashboard, BudgetPage, ExpensesPage, Error).
• src/components: reusable UI pieces (forms, items, table, nav bar, intro).
• src/actions: functions that encapsulate business logic (add/delete budgets/expenses, logout).
• src/helper.js: utility routines (e.g., Local Storage wrappers).
• Configuration for bundling: vite.config.js, eslint.config.js.
Key architectural insights from the README
• No backend service—data persisted via browser local storage.
• Pure front‑end SPA using HTML, CSS, JavaScript (React).
Main components
a. User Interface (Browser)
• index.html + bundled JS/CSS delivered by Vite
• React runtime rendering App, Layouts, Pages, Components
b. Business Logic Layer
• src/actions functions (deleteBudget, logout, etc.)
• src/helper.js (localStorage handlers)
c. Data Store
• Browser local storage (persistent key‑value store)
d. Build/Dev Tooling (optional to include)
• Vite dev server / bundler
Relationships and interactions
• User clicks or submits in React Components → calls an action → action uses helper to read/write browser local storage → updates component state → React re‑renders UI.
• Navigation between pages handled by React Router (implied in App.jsx).
• index.html loads the compiled JS/CSS bundle produced by Vite.
Architectural patterns/design principles
• Single‑Page Application (SPA)
• Separation of concerns:
• Presentation: components under src/components & src/pages
• Business logic: src/actions
• Data persistence: src/helper.js interacting with local storage
• Unidirectional data flow: user events → actions → storage → state → UI
Elements
• Labels: “App Entry (main.jsx)”, “Router (App.jsx)”, “Pages”, “UI Components”
• Action modules: “deleteBudget.js”, “logout.js”, etc.
• Helper module: “helper.js (localStorage API)”
• User → UI
• UI → Actions
• Actions ↔ Local Storage
• Updated data → UI
Putting it all together
• Start at the browser loading index.html
• Branch into:
• Page Rendering (Dashboard, BudgetPage, ExpensesPage)
• Common Layout (Nav, Intro)