How sakshi107/expense-tracker works
Project Type and Purpose
• This is a single-page React application (“Spendee”) for tracking incomes/expenses via voice commands.
• It uses the Web Speech API for speech recognition, React Context for state management, and Material-UI for styling.
File Structure Analysis
• public/ – static assets (index.html, manifest.json, robots.txt).
• src/
– index.js, App.js – React entry point and root component.
– components/ – UI building blocks:
• Main/Form (captures new transactions via text or speech)
• Main/List (renders transaction list)
• Details (shows aggregates: income, expense, balance)
• Snackbar (feedback UI)
• InfoCard (category-based info display)
– context/ – React Context provider and reducer (global state management).
– constants/ – transaction categories definitions.
– utils/ – helper functions (formatDate).
– useTransactions.js – custom hook for interacting with context.
README Insights
• Core features: speech-based entry, categorize/delete transactions, budget overview.
• Deployment: static hosting on Netlify.
• Tech stack: React, Material-UI, Web Speech API.
Defining Main Components
a. Client Browser (host environment)
b. React Application (inside browser)
– App Component (entry)
– Context Provider & Reducer (state layer)
– UI Components (Form, List, Details, Snackbar, InfoCard)
– Custom Hook (useTransactions)
– Constants & Utils
c. External Services/APIs
– Web Speech API (speech-to-text)
– Netlify (static asset hosting/CDN)
Relationships and Data Flows
• User → Browser UI: clicks “Start listening” or types →
• UI Component (Form) → Web Speech API → transcribed text →
• Form dispatches “ADD_TRANSACTION” → Context Reducer updates state →
• Updated state flows into List & Details components →
• Snackbar component listens for “success”/“error” events → shows feedback →
• Final UI update rendered in browser
Architectural Patterns & Principles
• Component-based design: each feature lives in its own directory/component.
• Unidirectional data flow: UI → actions → reducer → state → UI.
• Separation of concerns:
– UI (Material-UI styled components)
– State (Context + Reducer)
– Business logic (useTransactions hook, utils)
1. Browser Layer
2. State Management Layer
– Context Provider → Reducer → Custom Hook
3. UI Component Layer
– Form, List, Details, Snackbar, InfoCard
4. External Layer
– Web Speech API
– Netlify Hosting