# krishnnavarun/ai_powered_finance_tracker architecture

> Architecture diagram of the GitHub repository krishnnavarun/ai_powered_finance_tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/krishnnavarun/ai_powered_finance_tracker
- Repository: https://github.com/krishnnavarun/ai_powered_finance_tracker

## Overview

#### 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: [`client/src/redux/store.js`](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/redux/store.js) (Redux store), [`server/routes/authRoutes.js`](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/routes/authRoutes.js) (Domain routes), [`client/src/services/api.js`](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/services/api.js) (Client API services), [`client/src/App.jsx`](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/App.jsx) (App composition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_client_entry["Client entry<br/>React bootstrap<br/>[main.jsx]"]
  node_app["App composition<br/>React application<br/>[App.jsx]"]
  node_shell["Authenticated shell<br/>shared layout<br/>[Layout.jsx]"]
  node_screens["Finance screens<br/>page workflows<br/>[Dashboard.jsx]"]
  node_store[("Redux store<br/>client state<br/>[store.js]")]
  node_auth_slice["Auth slice<br/>identity state<br/>[authSlice.js]"]
  node_transaction_slice["Transaction slice<br/>finance state"]
  node_insight_slice["Insight slice<br/>AI state<br/>[insightSlice.js]"]
  node_client_api{{"Client API services<br/>HTTP boundary<br/>[api.js]"}}
end

subgraph group_server["Node API"]
  node_server_entry["Server launch<br/>Node entry point<br/>[server.js]"]
  node_api_app["API application<br/>Express assembly<br/>[app.js]"]
  node_routes["Domain routes<br/>HTTP routes<br/>[authRoutes.js]"]
  node_auth_middleware{{"Auth middleware<br/>request protection<br/>[authMiddleware.js]"}}
  node_controllers["Finance controllers<br/>request handlers"]
  node_auth_controller["Auth controller<br/>request handler<br/>[authController.js]"]
  node_ai_controller["AI controller<br/>request handler<br/>[aiController.js]"]
  node_analysis["Finance analysis<br/>domain service<br/>[financeAnalyzer.js]"]
  node_ai_service{{"AI service<br/>provider boundary<br/>[aiService.js]"}}
  node_finance_models[("Finance models<br/>persistence models<br/>[Transaction.js]")]
end

subgraph group_runtime["Runtime boundaries"]
  node_client_runtime["Client runtime<br/>Vite and Vercel<br/>[vite.config.js]"]
  node_server_runtime["Server runtime<br/>Node package<br/>[package.json]"]
end

node_client_entry -->|"mounts"| node_app
node_app -->|"composes"| node_shell
node_shell -->|"hosts"| node_screens
node_app -->|"provides"| node_store
node_store -->|"contains"| node_auth_slice
node_store -->|"contains"| node_transaction_slice
node_store -->|"contains"| node_insight_slice
node_screens -->|"reads and updates"| node_store
node_auth_slice -->|"uses"| node_client_api
node_transaction_slice -->|"uses"| node_client_api
node_insight_slice -->|"uses"| node_client_api
node_client_api -->|"HTTP requests"| node_api_app
node_server_entry -->|"launches"| node_api_app
node_api_app -->|"registers"| node_routes
node_routes -->|"auth requests"| node_auth_controller
node_routes -->|"protects finance routes"| node_auth_middleware
node_auth_middleware -->|"authorizes"| node_controllers
node_controllers -->|"requests aggregates"| node_analysis
node_controllers -->|"CRUD"| node_finance_models
node_auth_controller -->|"accounts"| node_finance_models
node_routes -->|"AI requests"| node_ai_controller
node_ai_controller -->|"uses finance context"| node_analysis
node_ai_controller -->|"delegates"| node_ai_service
node_client_runtime -.->|"builds"| node_client_entry
node_server_runtime -.->|"runs"| node_server_entry

click node_client_entry "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/main.jsx"
click node_app "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/App.jsx"
click node_shell "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/components/layout/Layout.jsx"
click node_screens "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/pages/Dashboard.jsx"
click node_store "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/redux/store.js"
click node_auth_slice "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/redux/slices/authSlice.js"
click node_transaction_slice "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/redux/slices/transactionSlice.js"
click node_insight_slice "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/redux/slices/insightSlice.js"
click node_client_api "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/services/api.js"
click node_server_entry "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/server.js"
click node_api_app "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/app.js"
click node_routes "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/routes/authRoutes.js"
click node_auth_middleware "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/middleware/authMiddleware.js"
click node_controllers "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/controllers/transactionController.js"
click node_auth_controller "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/controllers/authController.js"
click node_ai_controller "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/controllers/aiController.js"
click node_analysis "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/services/financeAnalyzer.js"
click node_ai_service "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/services/aiService.js"
click node_finance_models "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/models/Transaction.js"
click node_client_runtime "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/vite.config.js"
click node_server_runtime "https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/package.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client_entry,node_app,node_shell,node_screens,node_store,node_auth_slice,node_transaction_slice,node_insight_slice,node_client_api toneBlue
class node_server_entry,node_api_app,node_routes,node_auth_middleware,node_controllers,node_auth_controller,node_ai_controller,node_analysis,node_ai_service,node_finance_models toneAmber
class node_client_runtime,node_server_runtime toneMint
```

## Components

### React client

Single-page finance dashboard application.

- [Client entry](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/main.jsx): React bootstrap · `client/src/main.jsx`
- [App composition](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/App.jsx): React application · `client/src/App.jsx`
- [Authenticated shell](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/components/layout/Layout.jsx): shared layout · Layout, navigation bar, and sidebar frame signed-in screens. · `client/src/components/layout/Layout.jsx`
- [Finance screens](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/pages/Dashboard.jsx): page workflows · Dashboard, transaction, and budget screens. · `client/src/pages/Dashboard.jsx`
- [Redux store](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/redux/store.js): client state · `client/src/redux/store.js`
- [Auth slice](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/redux/slices/authSlice.js): identity state · `client/src/redux/slices/authSlice.js`
- [Transaction slice](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/redux/slices/transactionSlice.js): finance state · `client/src/redux/slices/transactionSlice.js`
- [Insight slice](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/redux/slices/insightSlice.js): AI state · `client/src/redux/slices/insightSlice.js`
- [Client API services](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/src/services/api.js): HTTP boundary · 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](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/server.js): Node entry point · `server/server.js`
- [API application](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/app.js): Express assembly · `server/app.js`
- [Domain routes](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/routes/authRoutes.js): HTTP routes · Authentication and transaction endpoints lead the route layer. · `server/routes/authRoutes.js`
- [Auth middleware](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/middleware/authMiddleware.js): request protection · Guards user-specific finance operations. · `server/middleware/authMiddleware.js`
- [Finance controllers](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/controllers/transactionController.js): request handlers · Transaction, budget, dashboard, and report operations. · `server/controllers/transactionController.js`
- [Auth controller](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/controllers/authController.js): request handler · `server/controllers/authController.js`
- [AI controller](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/controllers/aiController.js): request handler · `server/controllers/aiController.js`
- [Finance analysis](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/services/financeAnalyzer.js): domain service · Reusable financial analysis outside HTTP controllers. · `server/services/financeAnalyzer.js`
- [AI service](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/services/aiService.js): provider boundary · `server/services/aiService.js`
- [Finance models](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/models/Transaction.js): persistence models · User, transaction, and budget entities. · `server/models/Transaction.js`

### Runtime boundaries

Independent client and server deployment configuration.

- [Client runtime](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/client/vite.config.js): Vite and Vercel · Build and frontend deployment boundary. · `client/vite.config.js`
- [Server runtime](https://github.com/krishnnavarun/ai_powered_finance_tracker/blob/main/server/package.json): Node package · Server dependencies and environment configuration boundary. · `server/package.json`

## Connections

- 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
