# nishit-luhadia30/budget-planner architecture

> Architecture diagram of the GitHub repository nishit-luhadia30/budget-planner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nishit-luhadia30/budget-planner
- Repository: https://github.com/nishit-luhadia30/budget-planner

## Overview

Budget Tracker is a personal-finance web app. Users sign in, select a month, create a budget, and manage expenses; the dashboard presents summaries and supports exports and an assistant. The API authenticates requests and stores monthly budgets with embedded transactions. Separate capabilities include transaction ingestion and mock imports, recurring-expense processing, and analytics helpers. The graph follows documented and indexed relationships; some frontend API calls and unsampled route internals are represented only where README documentation supports them.

Main entry points: [`frontend/src/components/Dashboard.js`](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/Dashboard.js) (Monthly dashboard), [`backend/server.js`](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/server.js) (Express server), [`backend/models/Budget.js`](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/models/Budget.js) (Monthly budget model), [`backend/middleware/auth.js`](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/middleware/auth.js) (JWT middleware)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["React routes<br/>[App.js]"]
  node_authui["Session state<br/>[AuthContext.js]"]
  node_dashboard["Monthly dashboard<br/>[Dashboard.js]"]
  node_budgetform["Budget form<br/>[BudgetForm.js]"]
  node_expenseform["Expense form<br/>[ExpenseForm.js]"]
  node_summary["Budget summary<br/>[BudgetSummary.js]"]
  node_expenses["Expense list<br/>[ExpenseList.js]"]
  node_exportui["Export options<br/>[ExportOptions.js]"]
  node_exportutils["File generation<br/>[exportUtils.js]"]
  node_assistantui["Assistant UI<br/>[AIAssistant.js]"]
  node_notifications["Notifications"]
end

subgraph group_api["API and domain"]
  node_server["Express server<br/>[server.js]"]
  node_authroute["Authentication routes<br/>[auth.js]"]
  node_authmw["JWT middleware<br/>[auth.js]"]
  node_budgetroute["Budget routes<br/>[budget.js]"]
  node_expenseroute["Expense routes<br/>[expense.js]"]
  node_transactions["Transaction routes<br/>[transactions.js]"]
  node_exportroute["Export route<br/>[export.js]"]
  node_airoute["Assistant route<br/>[ai.js]"]
end

subgraph group_data["Persistence"]
  node_userdoc[("User model<br/>[User.js]")]
  node_budgetdoc[("Monthly budget model<br/>[Budget.js]")]
end

subgraph group_services["Services"]
  node_categorization["Merchant categorization<br/>[categorization.js]"]
  node_mockprovider["Mock transactions"]
  node_aitools["Assistant data queries<br/>[aiTools.js]"]
  node_recurring["Recurring processor"]
  node_analytics["Finance analytics"]
end

node_user(("User"))
node_database[("MongoDB")]

node_user -->|"uses"| node_app
node_app -->|"provides session"| node_authui
node_app -->|"routes to"| node_dashboard
node_dashboard -->|"renders"| node_budgetform
node_dashboard -->|"renders"| node_expenseform
node_dashboard -->|"renders"| node_expenses
node_dashboard -->|"renders"| node_summary
node_dashboard -->|"renders"| node_exportui
node_dashboard -->|"renders"| node_assistantui
node_dashboard -->|"renders"| node_notifications
node_authui -->|"authenticates via"| node_authroute
node_dashboard -->|"requests monthly data"| node_budgetroute
node_budgetform -->|"updates budget"| node_budgetroute
node_expenseform -->|"submits expenses"| node_expenseroute
node_exportui -->|"requests report data"| node_exportroute
node_exportui -->|"generates files"| node_exportutils
node_assistantui -->|"sends questions"| node_airoute
node_server -->|"mounts"| node_authroute
node_server -->|"mounts"| node_budgetroute
node_server -->|"mounts"| node_expenseroute
node_server -->|"mounts"| node_transactions
node_server -->|"mounts"| node_exportroute
node_server -->|"mounts"| node_airoute
node_server -->|"starts service"| node_recurring
node_authroute -->|"reads and writes"| node_userdoc
node_authmw -->|"loads user"| node_userdoc
node_budgetroute -->|"protects routes"| node_authmw
node_expenseroute -->|"protects routes"| node_authmw
node_transactions -->|"protects routes"| node_authmw
node_exportroute -->|"protects routes"| node_authmw
node_airoute -->|"protects routes"| node_authmw
node_budgetroute -->|"reads and writes"| node_budgetdoc
node_expenseroute -->|"mutates expenses"| node_budgetdoc
node_transactions -->|"stores transactions"| node_budgetdoc
node_exportroute -->|"reads reports"| node_budgetdoc
node_transactions -->|"categorizes"| node_categorization
node_transactions -->|"collects samples"| node_mockprovider
node_airoute -->|"selects data queries"| node_aitools
node_aitools -->|"queries transactions"| node_budgetdoc
node_recurring -->|"processes due entries"| node_budgetdoc
node_analytics -->|"analyzes budgets"| node_budgetdoc
node_analytics -->|"uses categories"| node_categorization
node_userdoc -.->|"persists"| node_database
node_budgetdoc -.->|"persists"| node_database

click node_app "https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/App.js"
click node_authui "https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/context/AuthContext.js"
click node_dashboard "https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/Dashboard.js"
click node_budgetform "https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/BudgetForm.js"
click node_expenseform "https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/ExpenseForm.js"
click node_summary "https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/BudgetSummary.js"
click node_expenses "https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/ExpenseList.js"
click node_exportui "https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/ExportOptions.js"
click node_exportutils "https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/utils/exportUtils.js"
click node_assistantui "https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/AIAssistant.js"
click node_notifications "https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/NotificationSystem.js"
click node_server "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/server.js"
click node_authroute "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/auth.js"
click node_authmw "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/middleware/auth.js"
click node_budgetroute "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/budget.js"
click node_expenseroute "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/expense.js"
click node_transactions "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/transactions.js"
click node_exportroute "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/export.js"
click node_airoute "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/ai.js"
click node_userdoc "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/models/User.js"
click node_budgetdoc "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/models/Budget.js"
click node_categorization "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/services/categorization.js"
click node_mockprovider "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/services/mockPaymentProvider.js"
click node_aitools "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/services/aiTools.js"
click node_recurring "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/services/recurringExpenses.js"
click node_analytics "https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/services/financeAnalytics.js"

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_app,node_authui,node_dashboard,node_budgetform,node_expenseform,node_summary,node_expenses,node_exportui,node_exportutils,node_assistantui,node_notifications,node_user toneBlue
class node_server,node_authroute,node_authmw,node_budgetroute,node_expenseroute,node_transactions,node_exportroute,node_airoute,node_database toneAmber
class node_userdoc,node_budgetdoc toneMint
class node_categorization,node_mockprovider,node_aitools,node_recurring,node_analytics toneRose
```

## Components

### Web application

- [React routes](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Session state](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/context/AuthContext.js): `frontend/src/context/AuthContext.js`
- [Monthly dashboard](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/Dashboard.js): `frontend/src/components/Dashboard.js`
- [Budget form](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/BudgetForm.js): `frontend/src/components/BudgetForm.js`
- [Expense form](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/ExpenseForm.js): `frontend/src/components/ExpenseForm.js`
- [Budget summary](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/BudgetSummary.js): `frontend/src/components/BudgetSummary.js`
- [Expense list](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/ExpenseList.js): `frontend/src/components/ExpenseList.js`
- [Export options](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/ExportOptions.js): `frontend/src/components/ExportOptions.js`
- [File generation](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/utils/exportUtils.js): `frontend/src/utils/exportUtils.js`
- [Assistant UI](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/AIAssistant.js): `frontend/src/components/AIAssistant.js`
- [Notifications](https://github.com/nishit-luhadia30/budget-planner/blob/main/frontend/src/components/NotificationSystem.js): `frontend/src/components/NotificationSystem.js`

### API and domain

- [Express server](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/server.js): `backend/server.js`
- [Authentication routes](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [JWT middleware](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Budget routes](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/budget.js): `backend/routes/budget.js`
- [Expense routes](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/expense.js): `backend/routes/expense.js`
- [Transaction routes](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/transactions.js): `backend/routes/transactions.js`
- [Export route](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/export.js): `backend/routes/export.js`
- [Assistant route](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/routes/ai.js): `backend/routes/ai.js`

### Persistence

- [User model](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/models/User.js): `backend/models/User.js`
- [Monthly budget model](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/models/Budget.js): `backend/models/Budget.js`

### Services

- [Merchant categorization](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/services/categorization.js): `backend/services/categorization.js`
- [Mock transactions](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/services/mockPaymentProvider.js): `backend/services/mockPaymentProvider.js`
- [Assistant data queries](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/services/aiTools.js): `backend/services/aiTools.js`
- [Recurring processor](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/services/recurringExpenses.js): `backend/services/recurringExpenses.js`
- [Finance analytics](https://github.com/nishit-luhadia30/budget-planner/blob/main/backend/services/financeAnalytics.js): `backend/services/financeAnalytics.js`

### Other components

- **User**
- **MongoDB**

## Connections

- User → React routes: uses (evidence: `README.md`)
- React routes → Session state: provides session (evidence: `frontend/src/App.js`)
- React routes → Monthly dashboard: routes to (evidence: `frontend/src/App.js`)
- Monthly dashboard → Budget form: renders (evidence: `frontend/src/components/Dashboard.js`)
- Monthly dashboard → Expense form: renders (evidence: `frontend/src/components/Dashboard.js`)
- Monthly dashboard → Expense list: renders (evidence: `frontend/src/components/Dashboard.js`)
- Monthly dashboard → Budget summary: renders (evidence: `frontend/src/components/Dashboard.js`)
- Monthly dashboard → Export options: renders (evidence: `frontend/src/components/Dashboard.js`)
- Monthly dashboard → Assistant UI: renders (evidence: `frontend/src/components/Dashboard.js`)
- Monthly dashboard → Notifications: renders (evidence: `frontend/src/components/Dashboard.js`)
- Session state → Authentication routes: authenticates via (evidence: `README.md`)
- Monthly dashboard → Budget routes: requests monthly data (evidence: `frontend/src/components/Dashboard.js`)
- Budget form → Budget routes: updates budget (evidence: `README.md`)
- Expense form → Expense routes: submits expenses (evidence: `README.md`)
- Export options → Export route: requests report data (evidence: `README.md`)
- Export options → File generation: generates files (evidence: `README.md`)
- Assistant UI → Assistant route: sends questions (evidence: `README.md`)
- Express server → Authentication routes: mounts (evidence: `backend/server.js`)
- Express server → Budget routes: mounts (evidence: `backend/server.js`)
- Express server → Expense routes: mounts (evidence: `backend/server.js`)
- Express server → Transaction routes: mounts (evidence: `backend/server.js`)
- Express server → Export route: mounts (evidence: `backend/server.js`)
- Express server → Assistant route: mounts (evidence: `backend/server.js`)
- Express server → Recurring processor: starts service (evidence: `backend/server.js`)
- Authentication routes → User model: reads and writes (evidence: `backend/routes/auth.js`)
- JWT middleware → User model: loads user (evidence: `backend/middleware/auth.js`)
- Budget routes → JWT middleware: protects routes (evidence: `README.md`)
- Expense routes → JWT middleware: protects routes (evidence: `README.md`)
- Transaction routes → JWT middleware: protects routes (evidence: `backend/routes/transactions.js`)
- Export route → JWT middleware: protects routes (evidence: `README.md`)
- Assistant route → JWT middleware: protects routes (evidence: `backend/routes/ai.js`)
- Budget routes → Monthly budget model: reads and writes (evidence: `backend/routes/budget.js`)
- Expense routes → Monthly budget model: mutates expenses (evidence: `backend/routes/expense.js`)
- Transaction routes → Monthly budget model: stores transactions (evidence: `backend/routes/transactions.js`)
- Export route → Monthly budget model: reads reports (evidence: `backend/routes/export.js`)
- Transaction routes → Merchant categorization: categorizes (evidence: `backend/routes/transactions.js`)
- Transaction routes → Mock transactions: collects samples (evidence: `backend/routes/transactions.js`)
- Assistant route → Assistant data queries: selects data queries (evidence: `backend/routes/ai.js`)
- Assistant data queries → Monthly budget model: queries transactions (evidence: `backend/services/aiTools.js`)
- Recurring processor → Monthly budget model: processes due entries (evidence: `backend/services/recurringExpenses.js`)
- Finance analytics → Monthly budget model: analyzes budgets (evidence: `backend/services/financeAnalytics.js`)
- Finance analytics → Merchant categorization: uses categories (evidence: `backend/services/financeAnalytics.js`)
- User model → MongoDB: persists (evidence: `README.md`)
- Monthly budget model → MongoDB: persists (evidence: `README.md`)
