# veerbhadramahant/finpilot architecture

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

- Interactive diagram: https://gitdiagram.com/veerbhadramahant/finpilot
- Repository: https://github.com/veerbhadramahant/finpilot

## Overview

FinPilot is a financial health and wealth-planning application: users connect or upload financial data, inspect forecasts and health insights, then explore simulated actions through the copilot and planning tools. The README documents major capabilities including budgets, tax optimization, goals, a printable executive statement, and verification-contract answers. The tree also contains Focal, a separate expense-tracking application with a React client and a Cloudflare Worker backend. Several subsystem paths are included from the tree and README, but their internal links are left out where source excerpts do not establish them.

Main entry points: [`backend/app/api/routes.py`](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/api/routes.py) (Core API routes), [`focal/worker/handlers/auth.handler.ts`](https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/handlers/auth.handler.ts) (Authentication handlers), [`focal/worker/handlers/receipts.handler.ts`](https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/handlers/receipts.handler.ts) (Receipt processing), [`backend/app/simulate/engine.py`](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/simulate/engine.py) (What-if simulator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_finpilot["FinPilot experience"]
  node_finpilot_ui["FinPilot app"]
  node_api_app["API application<br/>[main.py]"]
  node_api_routes["Core API routes<br/>[routes.py]"]
  node_contracts["Data contracts<br/>[schemas.py]"]
  node_statement["Executive statement"]
end

subgraph group_data["Financial data"]
  node_identity["Identity and settings<br/>[auth.py]"]
  node_store[("Financial data store<br/>[store.py]")]
  node_ingest["Data ingestion<br/>[upload.py]"]
  node_recurring["Recurring obligations<br/>[recurring.py]"]
end

subgraph group_insights["Analysis and planning"]
  node_dashboard["Health dashboard<br/>[routes.py]"]
  node_forecast["Cash-flow forecasting<br/>[cashflow.py]"]
  node_health["Health score<br/>[health_score.py]"]
  node_simulation["What-if simulator<br/>[engine.py]"]
  node_recommend["Action recommendations<br/>[engine.py]"]
  node_copilot["Financial copilot<br/>[engine.py]"]
  node_tax["Tax optimization<br/>[tax.py]"]
  node_plan["Financial planning<br/>[planner.py]"]
end

subgraph group_focal["Focal expense tracker"]
  node_focal_ui["Expense tracker UI<br/>[App.tsx]"]
end

subgraph group_focal_runtime["Focal services"]
  node_worker["Worker router<br/>[router.ts]"]
  node_auth_handler["Authentication handlers<br/>[auth.handler.ts]"]
  node_receipt_handler["Receipt processing"]
  node_focal_db[("Expense database<br/>[db.service.ts]")]
  node_auth_service["Token and password service<br/>[auth.service.ts]"]
end

node_person(("User"))
node_focal_user(("Expense user"))
node_external_ai(("AI providers"))

node_person -->|"uses"| node_finpilot_ui
node_finpilot_ui -.->|"requests data"| node_api_app
node_api_app -->|"mounts routes"| node_api_routes
node_api_routes -->|"resolves identity"| node_identity
node_api_routes -->|"validates responses"| node_contracts
node_api_routes -->|"reads and writes"| node_store
node_api_routes -->|"builds snapshot"| node_dashboard
node_dashboard -->|"uses obligations"| node_recurring
node_api_routes -->|"answers chat"| node_copilot
node_api_routes -->|"serves forecasts"| node_forecast
node_api_routes -->|"runs scenarios"| node_simulation
node_recommend -->|"simulates actions"| node_simulation
node_simulation -->|"computes projections"| node_forecast
node_person -->|"prints report"| node_statement
node_person -.->|"tracks expenses"| node_focal_ui
node_worker -->|"routes auth"| node_auth_handler
node_worker -->|"routes receipts"| node_receipt_handler
node_auth_handler -->|"stores sessions"| node_focal_db
node_auth_handler -->|"handles credentials"| node_auth_service
node_receipt_handler -->|"stores expenses"| node_focal_db
node_receipt_handler -->|"processes receipts"| node_external_ai
node_api_routes -.->|"provides health insights"| node_health
node_api_routes -.->|"provides tax tools"| node_tax
node_api_routes -.->|"provides planning"| node_plan

click node_finpilot_ui "https://github.com/veerbhadramahant/finpilot/tree/main/frontend/app"
click node_api_app "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/main.py"
click node_api_routes "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/api/routes.py"
click node_contracts "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/schemas.py"
click node_identity "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/core/auth.py"
click node_store "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/core/store.py"
click node_ingest "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/ingest/upload.py"
click node_recurring "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/analytics/recurring.py"
click node_dashboard "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/api/routes.py"
click node_forecast "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/forecast/cashflow.py"
click node_health "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/analytics/health_score.py"
click node_simulation "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/simulate/engine.py"
click node_recommend "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/recommend/engine.py"
click node_copilot "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/copilot/engine.py"
click node_tax "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/analytics/tax.py"
click node_plan "https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/plan/planner.py"
click node_statement "https://github.com/veerbhadramahant/finpilot/blob/main/frontend/components/statement/ExecutiveStatement.tsx"
click node_focal_ui "https://github.com/veerbhadramahant/finpilot/blob/main/focal/src/App.tsx"
click node_worker "https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/router.ts"
click node_auth_handler "https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/handlers/auth.handler.ts"
click node_receipt_handler "https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/handlers/receipts.handler.ts"
click node_focal_db "https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/services/db.service.ts"
click node_auth_service "https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/services/auth.service.ts"

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_finpilot_ui,node_api_app,node_api_routes,node_contracts,node_statement,node_person,node_focal_user toneBlue
class node_identity,node_store,node_ingest,node_recurring toneAmber
class node_dashboard,node_forecast,node_health,node_simulation,node_recommend,node_copilot,node_tax,node_plan toneMint
class node_focal_ui toneRose
class node_worker,node_auth_handler,node_receipt_handler,node_focal_db,node_auth_service,node_external_ai toneIndigo
```

## Components

### FinPilot experience

- [FinPilot app](https://github.com/veerbhadramahant/finpilot/tree/main/frontend/app): `frontend/app`
- [API application](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/main.py): `backend/app/main.py`
- [Core API routes](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`
- [Data contracts](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/schemas.py): `backend/app/schemas.py`
- [Executive statement](https://github.com/veerbhadramahant/finpilot/blob/main/frontend/components/statement/ExecutiveStatement.tsx): `frontend/components/statement/ExecutiveStatement.tsx`

### Financial data

- [Identity and settings](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/core/auth.py): `backend/app/core/auth.py`
- [Financial data store](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/core/store.py): `backend/app/core/store.py`
- [Data ingestion](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/ingest/upload.py): `backend/app/ingest/upload.py`
- [Recurring obligations](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/analytics/recurring.py): `backend/app/analytics/recurring.py`

### Analysis and planning

- [Health dashboard](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`
- [Cash-flow forecasting](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/forecast/cashflow.py): `backend/app/forecast/cashflow.py`
- [Health score](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/analytics/health_score.py): `backend/app/analytics/health_score.py`
- [What-if simulator](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/simulate/engine.py): `backend/app/simulate/engine.py`
- [Action recommendations](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/recommend/engine.py): `backend/app/recommend/engine.py`
- [Financial copilot](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/copilot/engine.py): `backend/app/copilot/engine.py`
- [Tax optimization](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/analytics/tax.py): `backend/app/analytics/tax.py`
- [Financial planning](https://github.com/veerbhadramahant/finpilot/blob/main/backend/app/plan/planner.py): `backend/app/plan/planner.py`

### Focal expense tracker

- [Expense tracker UI](https://github.com/veerbhadramahant/finpilot/blob/main/focal/src/App.tsx): `focal/src/App.tsx`

### Focal services

- [Worker router](https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/router.ts): `focal/worker/router.ts`
- [Authentication handlers](https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/handlers/auth.handler.ts): `focal/worker/handlers/auth.handler.ts`
- [Receipt processing](https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/handlers/receipts.handler.ts): `focal/worker/handlers/receipts.handler.ts`
- [Expense database](https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/services/db.service.ts): `focal/worker/services/db.service.ts`
- [Token and password service](https://github.com/veerbhadramahant/finpilot/blob/main/focal/worker/services/auth.service.ts): `focal/worker/services/auth.service.ts`

### Other components

- **User**
- **Expense user**
- **AI providers**

## Connections

- User → FinPilot app: uses
- FinPilot app → API application: requests data
- API application → Core API routes: mounts routes (evidence: `backend/app/main.py`)
- Core API routes → Identity and settings: resolves identity (evidence: `backend/app/api/routes.py`)
- Core API routes → Data contracts: validates responses (evidence: `backend/app/api/routes.py`)
- Core API routes → Financial data store: reads and writes (evidence: `backend/app/api/routes.py`)
- Core API routes → Health dashboard: builds snapshot (evidence: `backend/app/api/routes.py`)
- Health dashboard → Recurring obligations: uses obligations (evidence: `backend/app/api/routes.py`)
- Core API routes → Financial copilot: answers chat (evidence: `backend/app/api/routes.py`)
- Core API routes → Cash-flow forecasting: serves forecasts (evidence: `backend/app/api/routes.py`)
- Core API routes → What-if simulator: runs scenarios (evidence: `backend/app/api/routes.py`)
- Action recommendations → What-if simulator: simulates actions (evidence: `backend/app/recommend/engine.py`)
- What-if simulator → Cash-flow forecasting: computes projections (evidence: `backend/app/simulate/engine.py`)
- User → Executive statement: prints report
- User → Expense tracker UI: tracks expenses
- Worker router → Authentication handlers: routes auth (evidence: `focal/worker/router.ts`)
- Worker router → Receipt processing: routes receipts (evidence: `focal/worker/router.ts`)
- Authentication handlers → Expense database: stores sessions (evidence: `focal/worker/handlers/auth.handler.ts`)
- Authentication handlers → Token and password service: handles credentials (evidence: `focal/worker/handlers/auth.handler.ts`)
- Receipt processing → Expense database: stores expenses (evidence: `focal/worker/handlers/receipts.handler.ts`)
- Receipt processing → AI providers: processes receipts (evidence: `focal/worker/handlers/receipts.handler.ts`)
- Core API routes → Health score: provides health insights
- Core API routes → Tax optimization: provides tax tools
- Core API routes → Financial planning: provides planning
