# advaith-3683/smartspendai architecture

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

- Interactive diagram: https://gitdiagram.com/advaith-3683/smartspendai
- Repository: https://github.com/advaith-3683/smartspendai

## Overview

SmartSpend AI is a personal-finance web app for tracking budgets and expenses, importing transactions, and getting spending guidance. The main workflow runs from the dashboard through its API client to backend routes, which use services and persistent models to return financial summaries or record changes. Separate capabilities cover statement/SMS ingestion, recurring bills, savings planning, anomaly detection, subscriptions, and AI coaching. The README gives only the product name; several feature connections are therefore shown only where source excerpts or the index support them, with uncertain links omitted or dashed.

Main entry points: [`smartspend frontend/src/App.jsx`](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/App.jsx) (Dashboard), [`smartspend frontend/src/api.js`](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/api.js) (API Client), [`smartspend backend/main.py`](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/main.py) (API Routes), [`smartspend backend/models.py`](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/models.py) (Finance Models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard UI"]
  node_app["Dashboard<br/>[App.jsx]"]
  node_api["API Client<br/>[api.js]"]
  node_budget_ui["Budget Views<br/>[BudgetCard.jsx]"]
  node_bills_ui["Bills Panel<br/>[BillsPanel.jsx]"]
end

subgraph group_entry["Expense Entry"]
  node_transactions_ui["Transaction Entry"]
  node_import_ui["Import Review<br/>[ImportPanel.jsx]"]
  node_ingestion["Transaction Parsing<br/>[ingestion.py]"]
end

subgraph group_finance["Finance Backend"]
  node_routes["API Routes<br/>[main.py]"]
  node_services["Finance Services<br/>[services.py]"]
  node_models["Finance Models<br/>[models.py]"]
  node_database[("SQLite Access<br/>[database.py]")]
  node_schemas["API Schemas<br/>[schemas.py]"]
end

subgraph group_insights["Guidance and Insights"]
  node_coach_ui["Coach Chat<br/>[CoachPanel.jsx]"]
  node_savings_ui["Savings Planner"]
  node_digest_ui["Weekly Digest<br/>[WeeklyDigest.jsx]"]
  node_coach_engine["LLM Coach<br/>[llm_coach.py]"]
end

node_person(("User"))
node_gemini{{"Gemini API"}}

node_person -->|"uses"| node_app
node_app -->|"requests data"| node_api
node_app -->|"renders"| node_budget_ui
node_app -->|"renders"| node_transactions_ui
node_app -->|"renders"| node_import_ui
node_app -->|"renders"| node_bills_ui
node_app -->|"renders"| node_coach_ui
node_app -->|"renders"| node_savings_ui
node_app -->|"renders"| node_digest_ui
node_import_ui -->|"parses and commits"| node_api
node_bills_ui -->|"manages bills"| node_api
node_coach_ui -->|"chats and loads history"| node_api
node_transactions_ui -.->|"submits expense"| node_api
node_savings_ui -.->|"requests plan"| node_api
node_digest_ui -.->|"loads digest"| node_api
node_api -.->|"HTTP requests"| node_routes
node_routes -->|"delegates calculations"| node_services
node_routes -->|"parses imports"| node_ingestion
node_routes -->|"requests coaching"| node_coach_engine
node_routes -->|"validates responses"| node_schemas
node_services -->|"queries finance data"| node_models
node_routes -->|"queries records"| node_models
node_models -->|"uses ORM base"| node_database
node_ingestion -->|"uses model config"| node_coach_engine
node_coach_engine -->|"generates responses"| node_gemini

click node_app "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/App.jsx"
click node_api "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/api.js"
click node_budget_ui "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/BudgetCard.jsx"
click node_transactions_ui "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/TransactionForm.jsx"
click node_import_ui "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/ImportPanel.jsx"
click node_bills_ui "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/BillsPanel.jsx"
click node_coach_ui "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/CoachPanel.jsx"
click node_savings_ui "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/SavingsGoalPlanner.jsx"
click node_digest_ui "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/WeeklyDigest.jsx"
click node_routes "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/main.py"
click node_services "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/services.py"
click node_ingestion "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/ingestion.py"
click node_models "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/models.py"
click node_database "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/database.py"
click node_schemas "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/schemas.py"
click node_coach_engine "https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/llm_coach.py"

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_api,node_budget_ui,node_bills_ui,node_person toneBlue
class node_transactions_ui,node_import_ui,node_ingestion toneAmber
class node_routes,node_services,node_models,node_database,node_schemas,node_gemini toneMint
class node_coach_ui,node_savings_ui,node_digest_ui,node_coach_engine toneRose
```

## Components

### Dashboard UI

- [Dashboard](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/App.jsx): `smartspend frontend/src/App.jsx`
- [API Client](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/api.js): `smartspend frontend/src/api.js`
- [Budget Views](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/BudgetCard.jsx): `smartspend frontend/src/components/BudgetCard.jsx`
- [Bills Panel](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/BillsPanel.jsx): `smartspend frontend/src/components/BillsPanel.jsx`

### Expense Entry

- [Transaction Entry](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/TransactionForm.jsx): `smartspend frontend/src/components/TransactionForm.jsx`
- [Import Review](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/ImportPanel.jsx): `smartspend frontend/src/components/ImportPanel.jsx`
- [Transaction Parsing](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/ingestion.py): `smartspend backend/ingestion.py`

### Finance Backend

- [API Routes](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/main.py): `smartspend backend/main.py`
- [Finance Services](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/services.py): `smartspend backend/services.py`
- [Finance Models](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/models.py): `smartspend backend/models.py`
- [SQLite Access](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/database.py): `smartspend backend/database.py`
- [API Schemas](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/schemas.py): `smartspend backend/schemas.py`

### Guidance and Insights

- [Coach Chat](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/CoachPanel.jsx): `smartspend frontend/src/components/CoachPanel.jsx`
- [Savings Planner](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/SavingsGoalPlanner.jsx): `smartspend frontend/src/components/SavingsGoalPlanner.jsx`
- [Weekly Digest](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20frontend/src/components/WeeklyDigest.jsx): `smartspend frontend/src/components/WeeklyDigest.jsx`
- [LLM Coach](https://github.com/advaith-3683/smartspendai/blob/main/smartspend%20backend/llm_coach.py): `smartspend backend/llm_coach.py`

### Other components

- **User**
- **Gemini API**

## Connections

- User → Dashboard: uses
- Dashboard → API Client: requests data (evidence: `smartspend frontend/src/App.jsx`)
- Dashboard → Budget Views: renders (evidence: `smartspend frontend/src/App.jsx`)
- Dashboard → Transaction Entry: renders (evidence: `smartspend frontend/src/App.jsx`)
- Dashboard → Import Review: renders (evidence: `smartspend frontend/src/App.jsx`)
- Dashboard → Bills Panel: renders (evidence: `smartspend frontend/src/App.jsx`)
- Dashboard → Coach Chat: renders (evidence: `smartspend frontend/src/App.jsx`)
- Dashboard → Savings Planner: renders (evidence: `smartspend frontend/src/App.jsx`)
- Dashboard → Weekly Digest: renders (evidence: `smartspend frontend/src/App.jsx`)
- Import Review → API Client: parses and commits (evidence: `smartspend frontend/src/components/ImportPanel.jsx`)
- Bills Panel → API Client: manages bills (evidence: `smartspend frontend/src/components/BillsPanel.jsx`)
- Coach Chat → API Client: chats and loads history (evidence: `smartspend frontend/src/components/CoachPanel.jsx`)
- Transaction Entry → API Client: submits expense
- Savings Planner → API Client: requests plan (evidence: `smartspend frontend/src/components/SavingsGoalPlanner.jsx`)
- Weekly Digest → API Client: loads digest (evidence: `smartspend frontend/src/components/WeeklyDigest.jsx`)
- API Client → API Routes: HTTP requests
- API Routes → Finance Services: delegates calculations (evidence: `smartspend backend/main.py`)
- API Routes → Transaction Parsing: parses imports (evidence: `smartspend backend/main.py`)
- API Routes → LLM Coach: requests coaching (evidence: `smartspend backend/main.py`)
- API Routes → API Schemas: validates responses (evidence: `smartspend backend/main.py`)
- Finance Services → Finance Models: queries finance data (evidence: `smartspend backend/services.py`)
- API Routes → Finance Models: queries records (evidence: `smartspend backend/main.py`)
- Finance Models → SQLite Access: uses ORM base (evidence: `smartspend backend/models.py`)
- Transaction Parsing → LLM Coach: uses model config (evidence: `smartspend backend/ingestion.py`)
- LLM Coach → Gemini API: generates responses (evidence: `smartspend backend/llm_coach.py`)
