How krishnnavarun/ai_powered_finance_tracker works
Purpose and Entry Points
Personal-finance tracker with client dashboards, budgets, transactions, reports, profile/authentication, and AI/insight features. The frontend starts at client/src/main.jsx and composes the application in client/src/App.jsx. The API application is assembled in server/app.js and launched through server/server.js.
Client Application and Navigation
The client is a Vite-style React single-page application, with page-level workflows for dashboard, transactions, budgets, reports, insights, and account access. Shared authenticated-shell UI is centralized in:
• client/src/components/layout/Layout.jsx
• client/src/components/layout/Navbar.jsx
• client/src/components/layout/Sidebar.jsx
Primary screen boundaries are represented by client/src/pages/Dashboard.jsx, client/src/pages/Transactions.jsx, and client/src/pages/Budget.jsx.
Client State and API Boundary
Redux is the central client state boundary. Domain slices separate identity, transactions, budgets, and insights:
• client/src/redux/store.js
• client/src/redux/slices/authSlice.js
• client/src/redux/slices/transactionSlice.js
Service modules isolate HTTP/API interactions from pages and Redux/UI code, including client/src/services/api.js, client/src/services/authService.js, and client/src/services/transactionService.js. Parallel service boundaries exist for budget, dashboard, reporting, and AI functionality.
Backend HTTP and Authentication Pipeline
The server follows controller-and-route separation. Route modules expose domain endpoints, while controllers implement request handling:
• server/routes/authRoutes.js
• server/routes/transactionRoutes.js
• server/controllers/authController.js
Authentication is a cross-cutting middleware boundary in server/middleware/authMiddleware.js, expected to protect user-specific finance operations before they reach controllers. User/account persistence is represented by server/models/User.js.
Finance Domain and Persistence
Core persisted finance entities are users, transactions, and budgets:
• server/models/User.js
• server/models/Transaction.js
• server/models/Budget.js
Transaction and budget controllers own CRUD/domain operations through server/controllers/transactionController.js and server/controllers/budgetController.js. Dashboard and report controllers provide aggregation-oriented API surfaces rather than direct client-side calculations: server/controllers/dashboardController.js and server/controllers/reportController.js.
Analytics and AI Services
The server has a dedicated analysis/service layer beyond HTTP controllers:
• server/services/financeAnalyzer.js
• server/services/aiService.js
• server/controllers/aiController.js
This establishes an important boundary: controllers adapt API requests, while finance analysis and AI work reside in reusable services. Client AI and insight consumers are separated through client/src/services/aiService.js and client/src/redux/slices/insightSlice.js.
Runtime and Deployment Boundaries
The repository is split into independently configured client and server Node.js applications, each with its own package manifest. The client includes Vite configuration and Vercel deployment configuration:
• client/vite.config.js
• client/vercel.json
• server/package.json
Environment-based integration is indicated by client/.env.production and server/.env.example; external API, AI-provider, authentication-secret, and persistence connection details should remain behind these runtime configuration boundaries.
Main entry points: store.js Redux store · authRoutes.js Domain routes · api.js Client API services · App.jsx App composition
Components 21
React client
Single-page finance dashboard application.
- Client entry
client/src/main.jsx - App composition
client/src/App.jsx - Authenticated shell · Layout, navigation bar, and sidebar frame signed-in screens.
client/src/components/layout/Layout.jsx - Finance screens · Dashboard, transaction, and budget screens.
client/src/pages/Dashboard.jsx - Redux store
client/src/redux/store.js - Auth slice
client/src/redux/slices/authSlice.js - Transaction slice
client/src/redux/slices/transactionSlice.js - Insight slice
client/src/redux/slices/insightSlice.js - Client API services · Shared API client plus auth, transaction, budget, dashboard, report, and AI services.
client/src/services/api.js
Node API
HTTP API, domain logic, and persistence.
- Server launch
server/server.js - API application
server/app.js - Domain routes · Authentication and transaction endpoints lead the route layer.
server/routes/authRoutes.js - Auth middleware · Guards user-specific finance operations.
server/middleware/authMiddleware.js - Finance controllers · Transaction, budget, dashboard, and report operations.
server/controllers/transactionController.js - Auth controller
server/controllers/authController.js - AI controller
server/controllers/aiController.js - Finance analysis · Reusable financial analysis outside HTTP controllers.
server/services/financeAnalyzer.js - AI service
server/services/aiService.js - Finance models · User, transaction, and budget entities.
server/models/Transaction.js
Runtime boundaries
Independent client and server deployment configuration.
- Client runtime · Build and frontend deployment boundary.
client/vite.config.js - Server runtime · Server dependencies and environment configuration boundary.
server/package.json
Connections 25
- Client entry → App composition: mounts
- App composition → Authenticated shell: composes
- Authenticated shell → Finance screens: hosts
- App composition → Redux store: provides
- Redux store → Auth slice: contains
- Redux store → Transaction slice: contains
- Redux store → Insight slice: contains
- Finance screens → Redux store: reads and updates
- Auth slice → Client API services: uses
- Transaction slice → Client API services: uses
- Insight slice → Client API services: uses
- Client API services → API application: HTTP requests
- Server launch → API application: launches
- API application → Domain routes: registers
- Domain routes → Auth controller: auth requests
- Domain routes → Auth middleware: protects finance routes
- Auth middleware → Finance controllers: authorizes
- Finance controllers → Finance analysis: requests aggregates
- Finance controllers → Finance models: CRUD
- Auth controller → Finance models: accounts
- Domain routes → AI controller: AI requests
- AI controller → Finance analysis: uses finance context
- AI controller → AI service: delegates
- Client runtime → Client entry: builds
- Server runtime → Server launch: runs