How eatekha/myfinance works
Project type and purpose
• MyFinance is a full-stack, single-page personal finance application.
• Purpose: enable users to register/login, add income/expense entries, categorize them (leveraging a simple ML component), set budgets, and view charts/reports.
File structure
• Top level:
• public/index.html → hosts the front-end SPA
• src/api/… → client-side API wrappers for each backend endpoint
• src/backend/server.js + src/routes.js → Express server and route definitions
• src/backend/historyUserTransactions.js → business logic for retrieving transaction history
• src/backend/learning/… → lightweight ML classifier (dataset.json, keywords.json, categories.json) for auto-categorization
• src/backend/userTransactions.json → JSON file as the application’s data store
• No external database driver: persistence is file-based JSON.
README for architecture hints
• Features mention charts (pieChartAPI.js, transactionsChartAPI.js), summary tables (transactionTableAPI.js), and upload functionality (uploadAPI.js).
• The “learning” folder suggests a plug-in component that classifies transactions.
a. Main components:
1. User’s Browser (UI)
2. Front-end SPA (React or vanilla JS)
3. API layer (src/api/*.js)
4. Backend server (Express in src/backend/server.js + routes.js)
5. Business logic modules:
– historyUserTransactions.js
– learning module (dataset.json, keywords.json, categories.json)
6. Data store (userTransactions.json)
7. Optional: file‐upload handler (uploadAPI.js ↔ server upload route)
b. Relationships and data flow:
• The Browser UI invokes functions in src/api/*.js →
• These modules issue HTTP requests (GET/POST) to defined routes in server.js/routes.js →
• Express routes dispatch to business logic modules (historyUserTransactions, register/login handlers, ML classifier) →
• Logic reads/writes userTransactions.json and returns JSON responses →
• Front-end modules parse responses, update UI, render charts/reports.
c. Architectural patterns/design principles:
• Separation of concerns: UI ↔ API wrappers ↔ API routes ↔ business logic ↔ data store
• Plug-in ML component for categorization (located in src/backend/learning)
• File-based JSON persistence instead of an RDBMS/NoSQL database
d. Key technologies/frameworks:
• Front-end: React or JavaScript SPA (in public/index.html)
• HTTP API clients: src/api/*.js
• Backend: Node.js + Express (server.js, routes.js)
• ML: a custom classifier reading JSON datasets
• Data store: JSON files (userTransactions.json)
Detail
• That userTransactions.json stores all transactions.