# marwaneproo/finsight-ai architecture

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

- Interactive diagram: https://gitdiagram.com/marwaneproo/finsight-ai
- Repository: https://github.com/marwaneproo/finsight-ai

## Overview

FinSight AI is a financial analytics and business-intelligence application. Users import financial files, manage datasets, and explore live analysis, alerts, forecasts, AI-assisted answers, and reports. The graph follows the documented product stages and source-visible React routing and workspace/data-service responsibilities. Several feature implementations are unsampled; their placement follows the README and tree, while uncertain internal links are omitted.

Main entry points: [`src/App.tsx`](https://github.com/marwaneproo/finsight-ai/blob/main/src/App.tsx) (App Router), [`src/hooks/useWorkspace.tsx`](https://github.com/marwaneproo/finsight-ai/blob/main/src/hooks/useWorkspace.tsx) (Workspace State), [`src/lib/cashFlowEngine.ts`](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/cashFlowEngine.ts) (Cash Flow Engine), [`src/components/modules/Reports.tsx`](https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/Reports.tsx) (Financial Reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Application Experience"]
  node_app["App Router<br/>[App.tsx]"]
  node_landing["Landing &amp; Pricing<br/>[LandingPage.tsx]"]
  node_overview["Dashboard Overview<br/>[Overview.tsx]"]
end

subgraph group_ingestion["Data Ingestion &amp; Workspace"]
  node_workspace["Workspace State<br/>[useWorkspace.tsx]"]
  node_data_manager["Dataset Manager<br/>[DataManager.tsx]"]
  node_upload["File Upload<br/>[UploadPanel.tsx]"]
  node_parser["File Parser<br/>[fileParser.ts]"]
end

subgraph group_analysis["Financial Intelligence"]
  node_analytics["BI Analytics<br/>[Analytics.tsx]"]
  node_cash_engine["Cash Flow Engine<br/>[cashFlowEngine.ts]"]
  node_anomaly_ui["Anomaly Review<br/>[Anomalies.tsx]"]
  node_anomaly_engine["Anomaly Detector<br/>[anomalyDetector.ts]"]
  node_health["Health Score<br/>[healthScore.ts]"]
  node_insights["Executive Insights<br/>[insights.ts]"]
end

subgraph group_decision["Decision Support"]
  node_simulator["Scenario Simulator<br/>[Simulator.tsx]"]
  node_copilot["AI Copilot<br/>[Copilot.tsx]"]
  node_copilot_engine["Copilot Engine<br/>[copilotEngine.ts]"]
  node_reports["Financial Reports<br/>[Reports.tsx]"]
  node_report_export["Report Export<br/>[exportReport.ts]"]
  node_alerts["Alert Settings<br/>[AlertsSettings.tsx]"]
  node_alert_engine["Alert Engine<br/>[alertEngine.ts]"]
end

subgraph group_platform["Plans &amp; Persistence"]
  node_data_service["Data Service<br/>[dataService.ts]"]
  node_storage[("Local &amp; Supabase Store<br/>[dataService.ts]")]
  node_plans["Plan Entitlements<br/>[plans.ts]"]
end

node_user(("Business User"))

node_user -->|"opens"| node_app
node_app -->|"renders"| node_landing
node_app -->|"routes to"| node_overview
node_app -->|"routes to"| node_data_manager
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_anomaly_ui
node_app -->|"routes to"| node_simulator
node_app -->|"routes to"| node_copilot
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_alerts
node_user -->|"uploads data"| node_upload
node_data_manager -->|"renders"| node_upload
node_upload -->|"submits file"| node_workspace
node_workspace -->|"parses file"| node_parser
node_workspace -->|"loads and saves"| node_data_service
node_data_service -->|"persists datasets"| node_storage
node_storage -.->|"syncs remotely"| node_user
node_workspace -->|"computes analysis"| node_cash_engine
node_overview -->|"reads analysis"| node_workspace
node_analytics -.->|"reads dataset"| node_workspace
node_workspace -->|"detects anomalies"| node_anomaly_engine
node_anomaly_ui -->|"reads findings"| node_workspace
node_cash_engine -->|"uses leak metrics"| node_anomaly_engine
node_workspace -->|"computes health"| node_health
node_overview -->|"generates summary"| node_insights
node_simulator -->|"projects scenarios"| node_cash_engine
node_copilot -->|"answers questions"| node_copilot_engine
node_copilot_engine -->|"uses calculations"| node_cash_engine
node_copilot_engine -->|"checks leaks"| node_anomaly_engine
node_reports -->|"exports reports"| node_report_export
node_reports -->|"shows score"| node_health
node_reports -->|"shows findings"| node_insights
node_alerts -.->|"evaluates rules"| node_alert_engine
node_alert_engine -->|"formats metrics"| node_cash_engine
node_landing -->|"offers plans"| node_user
node_data_manager -.->|"gates features"| node_plans

click node_app "https://github.com/marwaneproo/finsight-ai/blob/main/src/App.tsx"
click node_landing "https://github.com/marwaneproo/finsight-ai/blob/main/src/components/LandingPage.tsx"
click node_overview "https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/Overview.tsx"
click node_workspace "https://github.com/marwaneproo/finsight-ai/blob/main/src/hooks/useWorkspace.tsx"
click node_data_manager "https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/DataManager.tsx"
click node_upload "https://github.com/marwaneproo/finsight-ai/blob/main/src/components/UploadPanel.tsx"
click node_parser "https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/fileParser.ts"
click node_data_service "https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/dataService.ts"
click node_storage "https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/dataService.ts"
click node_analytics "https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/Analytics.tsx"
click node_cash_engine "https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/cashFlowEngine.ts"
click node_anomaly_ui "https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/Anomalies.tsx"
click node_anomaly_engine "https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/anomalyDetector.ts"
click node_health "https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/healthScore.ts"
click node_insights "https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/insights.ts"
click node_simulator "https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/Simulator.tsx"
click node_copilot "https://github.com/marwaneproo/finsight-ai/blob/main/src/components/Copilot.tsx"
click node_copilot_engine "https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/copilotEngine.ts"
click node_reports "https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/Reports.tsx"
click node_report_export "https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/exportReport.ts"
click node_alerts "https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/AlertsSettings.tsx"
click node_alert_engine "https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/alertEngine.ts"
click node_plans "https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/plans.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_app,node_landing,node_overview,node_user toneBlue
class node_workspace,node_data_manager,node_upload,node_parser toneAmber
class node_analytics,node_cash_engine,node_anomaly_ui,node_anomaly_engine,node_health,node_insights toneMint
class node_simulator,node_copilot,node_copilot_engine,node_reports,node_report_export,node_alerts,node_alert_engine toneRose
class node_data_service,node_storage,node_plans toneIndigo
```

## Components

### Application Experience

- [App Router](https://github.com/marwaneproo/finsight-ai/blob/main/src/App.tsx): `src/App.tsx`
- [Landing & Pricing](https://github.com/marwaneproo/finsight-ai/blob/main/src/components/LandingPage.tsx): `src/components/LandingPage.tsx`
- [Dashboard Overview](https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/Overview.tsx): `src/components/modules/Overview.tsx`

### Data Ingestion & Workspace

- [Workspace State](https://github.com/marwaneproo/finsight-ai/blob/main/src/hooks/useWorkspace.tsx): `src/hooks/useWorkspace.tsx`
- [Dataset Manager](https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/DataManager.tsx): `src/components/modules/DataManager.tsx`
- [File Upload](https://github.com/marwaneproo/finsight-ai/blob/main/src/components/UploadPanel.tsx): `src/components/UploadPanel.tsx`
- [File Parser](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/fileParser.ts): `src/lib/fileParser.ts`

### Financial Intelligence

- [BI Analytics](https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/Analytics.tsx): `src/components/modules/Analytics.tsx`
- [Cash Flow Engine](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/cashFlowEngine.ts): `src/lib/cashFlowEngine.ts`
- [Anomaly Review](https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/Anomalies.tsx): `src/components/modules/Anomalies.tsx`
- [Anomaly Detector](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/anomalyDetector.ts): `src/lib/anomalyDetector.ts`
- [Health Score](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/healthScore.ts): `src/lib/healthScore.ts`
- [Executive Insights](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/insights.ts): `src/lib/insights.ts`

### Decision Support

- [Scenario Simulator](https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/Simulator.tsx): `src/components/modules/Simulator.tsx`
- [AI Copilot](https://github.com/marwaneproo/finsight-ai/blob/main/src/components/Copilot.tsx): `src/components/Copilot.tsx`
- [Copilot Engine](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/copilotEngine.ts): `src/lib/copilotEngine.ts`
- [Financial Reports](https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/Reports.tsx): `src/components/modules/Reports.tsx`
- [Report Export](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/exportReport.ts): `src/lib/exportReport.ts`
- [Alert Settings](https://github.com/marwaneproo/finsight-ai/blob/main/src/components/modules/AlertsSettings.tsx): `src/components/modules/AlertsSettings.tsx`
- [Alert Engine](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/alertEngine.ts): `src/lib/alertEngine.ts`

### Plans & Persistence

- [Data Service](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/dataService.ts): `src/lib/dataService.ts`
- [Local & Supabase Store](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/dataService.ts): `src/lib/dataService.ts`
- [Plan Entitlements](https://github.com/marwaneproo/finsight-ai/blob/main/src/lib/plans.ts): `src/lib/plans.ts`

### Other components

- **Business User**

## Connections

- Business User → App Router: opens (evidence: `README.md`)
- App Router → Landing & Pricing: renders (evidence: `src/App.tsx`)
- App Router → Dashboard Overview: routes to (evidence: `src/App.tsx`)
- App Router → Dataset Manager: routes to (evidence: `src/App.tsx`)
- App Router → BI Analytics: routes to (evidence: `src/App.tsx`)
- App Router → Anomaly Review: routes to (evidence: `src/App.tsx`)
- App Router → Scenario Simulator: routes to (evidence: `src/App.tsx`)
- App Router → AI Copilot: routes to (evidence: `src/App.tsx`)
- App Router → Financial Reports: routes to (evidence: `src/App.tsx`)
- App Router → Alert Settings: routes to (evidence: `src/App.tsx`)
- Business User → File Upload: uploads data (evidence: `README.md`)
- Dataset Manager → File Upload: renders (evidence: `src/components/modules/DataManager.tsx`)
- File Upload → Workspace State: submits file (evidence: `src/components/UploadPanel.tsx`)
- Workspace State → File Parser: parses file (evidence: `src/hooks/useWorkspace.tsx`)
- Workspace State → Data Service: loads and saves (evidence: `src/hooks/useWorkspace.tsx`)
- Data Service → Local & Supabase Store: persists datasets (evidence: `src/lib/dataService.ts`)
- Local & Supabase Store → Business User: syncs remotely
- Workspace State → Cash Flow Engine: computes analysis (evidence: `src/hooks/useWorkspace.tsx`)
- Dashboard Overview → Workspace State: reads analysis (evidence: `src/components/modules/Overview.tsx`)
- BI Analytics → Workspace State: reads dataset
- Workspace State → Anomaly Detector: detects anomalies (evidence: `src/hooks/useWorkspace.tsx`)
- Anomaly Review → Workspace State: reads findings (evidence: `src/components/modules/Anomalies.tsx`)
- Cash Flow Engine → Anomaly Detector: uses leak metrics (evidence: `src/lib/cashFlowEngine.ts`)
- Workspace State → Health Score: computes health (evidence: `src/hooks/useWorkspace.tsx`)
- Dashboard Overview → Executive Insights: generates summary (evidence: `src/components/modules/Overview.tsx`)
- Scenario Simulator → Cash Flow Engine: projects scenarios (evidence: `src/components/modules/Simulator.tsx`)
- AI Copilot → Copilot Engine: answers questions (evidence: `src/components/Copilot.tsx`)
- Copilot Engine → Cash Flow Engine: uses calculations (evidence: `src/lib/copilotEngine.ts`)
- Copilot Engine → Anomaly Detector: checks leaks (evidence: `src/lib/copilotEngine.ts`)
- Financial Reports → Report Export: exports reports (evidence: `src/components/modules/Reports.tsx`)
- Financial Reports → Health Score: shows score (evidence: `src/components/modules/Reports.tsx`)
- Financial Reports → Executive Insights: shows findings (evidence: `src/components/modules/Reports.tsx`)
- Alert Settings → Alert Engine: evaluates rules (evidence: `src/components/modules/AlertsSettings.tsx`)
- Alert Engine → Cash Flow Engine: formats metrics (evidence: `src/lib/alertEngine.ts`)
- Landing & Pricing → Business User: offers plans (evidence: `README.md`)
- Dataset Manager → Plan Entitlements: gates features
