# chandra-006/financial-review architecture

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

- Interactive diagram: https://gitdiagram.com/chandra-006/financial-review
- Repository: https://github.com/chandra-006/financial-review

## Overview

FINZ is a financial review application: users import transactions, classify and review uncertain entries, then inspect dashboard P&L and variance analysis or ask questions about the data. The React pages call a shared API client; Express routes dispatch to transaction controllers, which query PostgreSQL and invoke calculation and analyst services. The README documents the broader capabilities; unsampled page and service internals are represented at subsystem level, and edges are limited to documented or indexed relationships.

Main entry points: [`backend/src/controllers/transactionController.js`](https://github.com/chandra-006/financial-review/blob/main/backend/src/controllers/transactionController.js) (Transaction controller), [`backend/src/config/database.js`](https://github.com/chandra-006/financial-review/blob/main/backend/src/config/database.js) (Database connection), [`frontend/src/App.jsx`](https://github.com/chandra-006/financial-review/blob/main/frontend/src/App.jsx) (Page router), [`frontend/src/services/api.js`](https://github.com/chandra-006/financial-review/blob/main/frontend/src/services/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Review interface"]
  node_app["Page router<br/>[App.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_review["Transaction review<br/>[Review.jsx]"]
  node_variances["Variance view<br/>[Variances.jsx]"]
  node_analyst_ui["Analyst interface<br/>[Analyst.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["Transaction API"]
  node_routes["Transaction routes"]
  node_controller["Transaction controller"]
end

subgraph group_finance["Financial analysis"]
  node_pnl["P&amp;L calculations<br/>[pnlService.js]"]
  node_variance["Variance calculations<br/>[varianceService.js]"]
  node_drivers["Variance drivers<br/>[driverService.js]"]
  node_categorization["Transaction categorization"]
end

subgraph group_analyst["AI analyst"]
  node_question["Question answering"]
  node_context["Financial context<br/>[analystService.js]"]
  node_llm["LLM responses"]
end

subgraph group_storage["Data storage"]
  node_db_config["Database connection<br/>[database.js]"]
  node_postgres[("PostgreSQL")]
end

node_user(("Finance user"))
node_csv["Transaction CSV"]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_review
node_app -->|"routes to"| node_variances
node_app -->|"routes to"| node_analyst_ui
node_dashboard -->|"requests data"| node_api_client
node_review -->|"loads and updates"| node_api_client
node_variances -->|"requests analysis"| node_api_client
node_analyst_ui -->|"submits questions"| node_api_client
node_api_client -->|"calls endpoints"| node_routes
node_routes -->|"dispatches"| node_controller
node_controller -->|"parses uploads"| node_csv
node_controller -->|"categorizes"| node_categorization
node_controller -->|"calculates P&amp;L"| node_pnl
node_controller -->|"calculates variance"| node_variance
node_controller -->|"gets drivers"| node_drivers
node_controller -->|"answers questions"| node_question
node_question -->|"loads context"| node_context
node_question -->|"requests fallback"| node_llm
node_pnl -->|"queries through"| node_db_config
node_variance -->|"queries through"| node_db_config
node_drivers -->|"queries through"| node_db_config
node_context -->|"queries through"| node_db_config
node_db_config -->|"connects to"| node_postgres
node_controller -->|"queries through"| node_db_config

click node_app "https://github.com/chandra-006/financial-review/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/chandra-006/financial-review/blob/main/frontend/src/pages/Dashboard.jsx"
click node_review "https://github.com/chandra-006/financial-review/blob/main/frontend/src/pages/Review.jsx"
click node_variances "https://github.com/chandra-006/financial-review/blob/main/frontend/src/pages/Variances.jsx"
click node_analyst_ui "https://github.com/chandra-006/financial-review/blob/main/frontend/src/pages/Analyst.jsx"
click node_api_client "https://github.com/chandra-006/financial-review/blob/main/frontend/src/services/api.js"
click node_routes "https://github.com/chandra-006/financial-review/blob/main/backend/src/routes/transactionRoutes.js"
click node_controller "https://github.com/chandra-006/financial-review/blob/main/backend/src/controllers/transactionController.js"
click node_csv "https://github.com/chandra-006/financial-review/blob/main/data/finz_transactions.csv"
click node_pnl "https://github.com/chandra-006/financial-review/blob/main/backend/src/services/pnlService.js"
click node_variance "https://github.com/chandra-006/financial-review/blob/main/backend/src/services/varianceService.js"
click node_drivers "https://github.com/chandra-006/financial-review/blob/main/backend/src/services/driverService.js"
click node_categorization "https://github.com/chandra-006/financial-review/blob/main/backend/src/services/categorizationService.js"
click node_question "https://github.com/chandra-006/financial-review/blob/main/backend/src/services/analystQuestionService.js"
click node_context "https://github.com/chandra-006/financial-review/blob/main/backend/src/services/analystService.js"
click node_llm "https://github.com/chandra-006/financial-review/blob/main/backend/src/services/llmAnalystService.js"
click node_db_config "https://github.com/chandra-006/financial-review/blob/main/backend/src/config/database.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_dashboard,node_review,node_variances,node_analyst_ui,node_api_client,node_user toneBlue
class node_routes,node_controller toneAmber
class node_pnl,node_variance,node_drivers,node_categorization toneMint
class node_question,node_context,node_llm toneRose
class node_db_config,node_postgres toneIndigo
class node_csv toneTeal
```

## Components

### Review interface

- [Page router](https://github.com/chandra-006/financial-review/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Dashboard](https://github.com/chandra-006/financial-review/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Transaction review](https://github.com/chandra-006/financial-review/blob/main/frontend/src/pages/Review.jsx): `frontend/src/pages/Review.jsx`
- [Variance view](https://github.com/chandra-006/financial-review/blob/main/frontend/src/pages/Variances.jsx): `frontend/src/pages/Variances.jsx`
- [Analyst interface](https://github.com/chandra-006/financial-review/blob/main/frontend/src/pages/Analyst.jsx): `frontend/src/pages/Analyst.jsx`
- [API client](https://github.com/chandra-006/financial-review/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Transaction API

- [Transaction routes](https://github.com/chandra-006/financial-review/blob/main/backend/src/routes/transactionRoutes.js): `backend/src/routes/transactionRoutes.js`
- [Transaction controller](https://github.com/chandra-006/financial-review/blob/main/backend/src/controllers/transactionController.js): `backend/src/controllers/transactionController.js`

### Financial analysis

- [P&L calculations](https://github.com/chandra-006/financial-review/blob/main/backend/src/services/pnlService.js): `backend/src/services/pnlService.js`
- [Variance calculations](https://github.com/chandra-006/financial-review/blob/main/backend/src/services/varianceService.js): `backend/src/services/varianceService.js`
- [Variance drivers](https://github.com/chandra-006/financial-review/blob/main/backend/src/services/driverService.js): `backend/src/services/driverService.js`
- [Transaction categorization](https://github.com/chandra-006/financial-review/blob/main/backend/src/services/categorizationService.js): `backend/src/services/categorizationService.js`

### AI analyst

- [Question answering](https://github.com/chandra-006/financial-review/blob/main/backend/src/services/analystQuestionService.js): `backend/src/services/analystQuestionService.js`
- [Financial context](https://github.com/chandra-006/financial-review/blob/main/backend/src/services/analystService.js): `backend/src/services/analystService.js`
- [LLM responses](https://github.com/chandra-006/financial-review/blob/main/backend/src/services/llmAnalystService.js): `backend/src/services/llmAnalystService.js`

### Data storage

- [Database connection](https://github.com/chandra-006/financial-review/blob/main/backend/src/config/database.js): `backend/src/config/database.js`
- **PostgreSQL**

### Other components

- **Finance user**
- [Transaction CSV](https://github.com/chandra-006/financial-review/blob/main/data/finz_transactions.csv): `data/finz_transactions.csv`

## Connections

- Finance user → Page router: uses (evidence: `README.md`)
- Page router → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Transaction review: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Variance view: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Analyst interface: routes to (evidence: `frontend/src/App.jsx`)
- Dashboard → API client: requests data (evidence: `frontend/src/pages/Dashboard.jsx`)
- Transaction review → API client: loads and updates (evidence: `frontend/src/pages/Review.jsx`)
- Variance view → API client: requests analysis (evidence: `frontend/src/pages/Variances.jsx`)
- Analyst interface → API client: submits questions (evidence: `frontend/src/pages/Analyst.jsx`)
- API client → Transaction routes: calls endpoints (evidence: `frontend/src/services/api.js`)
- Transaction routes → Transaction controller: dispatches (evidence: `backend/src/routes/transactionRoutes.js`)
- Transaction controller → Transaction CSV: parses uploads (evidence: `backend/src/controllers/transactionController.js`)
- Transaction controller → Transaction categorization: categorizes (evidence: `backend/src/controllers/transactionController.js`)
- Transaction controller → P&L calculations: calculates P&L (evidence: `backend/src/controllers/transactionController.js`)
- Transaction controller → Variance calculations: calculates variance (evidence: `backend/src/controllers/transactionController.js`)
- Transaction controller → Variance drivers: gets drivers (evidence: `backend/src/controllers/transactionController.js`)
- Transaction controller → Question answering: answers questions (evidence: `backend/src/controllers/transactionController.js`)
- Question answering → Financial context: loads context (evidence: `backend/src/services/analystQuestionService.js`)
- Question answering → LLM responses: requests fallback (evidence: `backend/src/services/analystQuestionService.js`)
- P&L calculations → Database connection: queries through (evidence: `backend/src/services/pnlService.js`)
- Variance calculations → Database connection: queries through (evidence: `backend/src/services/varianceService.js`)
- Variance drivers → Database connection: queries through (evidence: `backend/src/services/driverService.js`)
- Financial context → Database connection: queries through (evidence: `backend/src/services/analystService.js`)
- Database connection → PostgreSQL: connects to (evidence: `backend/src/config/database.js`)
- Transaction controller → Database connection: queries through (evidence: `backend/src/controllers/transactionController.js`)
