# rishabhdev06/cfo-helper architecture

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

- Interactive diagram: https://gitdiagram.com/rishabhdev06/cfo-helper
- Repository: https://github.com/rishabhdev06/cfo-helper

## Overview

CFO Helper is a browser-based financial planning and forecasting product for Indian businesses. Users enter organization details during onboarding, adjust financial and custom business inputs, run forecasts, inspect dashboard metrics and charts, and export PDF reports; an AI advisor is a separate assistance capability. The graph combines the sampled app, onboarding, persistence, AI and export code with capabilities documented in the README. Dashboard and several feature components were not sampled, so their internal wiring is represented only where the product workflow supports it.

Main entry points: [`src/components/Dashboard.tsx`](https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/Dashboard.tsx) (Dashboard), [`src/components/OnboardingFlow.tsx`](https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/OnboardingFlow.tsx) (Organization setup), [`src/App.tsx`](https://github.com/rishabhdev06/cfo-helper/blob/main/src/App.tsx) (App), [`src/hooks/useSupabase.ts`](https://github.com/rishabhdev06/cfo-helper/blob/main/src/hooks/useSupabase.ts) (User data hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry"]
  node_app["App<br/>[App.tsx]"]
  node_landing["Landing page<br/>[LandingPage.tsx]"]
end

subgraph group_planning["Planning experience"]
  node_onboarding["Organization setup<br/>[OnboardingFlow.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_input["Financial inputs<br/>[InputPanel.tsx]"]
  node_advanced_input["Advanced controls"]
  node_financial_types["Financial types<br/>[financial.ts]"]
end

subgraph group_data["Accounts and data"]
  node_user_hook["User data hook<br/>[useSupabase.ts]"]
  node_db_service["Database services<br/>[databaseService.ts]"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
end

subgraph group_insights["Insights and reports"]
  node_results["Forecast results<br/>[ResultsPanel.tsx]"]
  node_ai_chat["AI advisor chat<br/>[AIChatBot.tsx]"]
  node_ai_service["AI advisor service<br/>[aiAdvisor.ts]"]
  node_pdf["PDF report export<br/>[pdfExport.ts]"]
end

node_business_user(("Business user"))
node_clerk{{"Clerk auth"}}
node_gemini{{"Gemini API"}}
node_supabase[("Supabase")]

node_business_user -->|"views"| node_landing
node_landing -->|"starts sign-in"| node_clerk
node_clerk -->|"authenticates"| node_app
node_app -->|"shows signed-out"| node_landing
node_app -->|"shows signed-in"| node_onboarding
node_onboarding -->|"renders after setup"| node_dashboard
node_onboarding -->|"updates metadata"| node_clerk
node_onboarding -->|"creates profile"| node_db_service
node_business_user -->|"provides org details"| node_onboarding
node_business_user -->|"sets parameters"| node_input
node_dashboard -->|"presents controls"| node_input
node_dashboard -->|"presents advanced controls"| node_advanced_input
node_dashboard -->|"presents analysis"| node_results
node_input -->|"uses input model"| node_financial_types
node_advanced_input -->|"uses input model"| node_financial_types
node_business_user -->|"asks advice"| node_ai_chat
node_ai_chat -->|"sends message"| node_ai_service
node_ai_service -.->|"generates response"| node_gemini
node_results -->|"exports report"| node_pdf
node_dashboard -->|"loads user data"| node_user_hook
node_user_hook -->|"reads signed-in user"| node_clerk
node_user_hook -->|"loads and saves data"| node_db_service
node_db_service -->|"queries through"| node_supabase_client
node_supabase_client -->|"reads and writes"| node_supabase

click node_app "https://github.com/rishabhdev06/cfo-helper/blob/main/src/App.tsx"
click node_landing "https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/LandingPage.tsx"
click node_onboarding "https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/OnboardingFlow.tsx"
click node_dashboard "https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/Dashboard.tsx"
click node_input "https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/InputPanel.tsx"
click node_advanced_input "https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/AdvancedInputPanel.tsx"
click node_results "https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/ResultsPanel.tsx"
click node_ai_chat "https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/AIChatBot.tsx"
click node_ai_service "https://github.com/rishabhdev06/cfo-helper/blob/main/src/services/aiAdvisor.ts"
click node_pdf "https://github.com/rishabhdev06/cfo-helper/blob/main/src/utils/pdfExport.ts"
click node_user_hook "https://github.com/rishabhdev06/cfo-helper/blob/main/src/hooks/useSupabase.ts"
click node_db_service "https://github.com/rishabhdev06/cfo-helper/blob/main/src/services/databaseService.ts"
click node_supabase_client "https://github.com/rishabhdev06/cfo-helper/blob/main/src/lib/supabase.ts"
click node_financial_types "https://github.com/rishabhdev06/cfo-helper/blob/main/src/types/financial.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_business_user toneBlue
class node_onboarding,node_dashboard,node_input,node_advanced_input,node_financial_types,node_supabase toneAmber
class node_user_hook,node_db_service,node_supabase_client,node_gemini toneMint
class node_results,node_ai_chat,node_ai_service,node_pdf toneRose
class node_clerk toneIndigo
```

## Components

### App entry

- [App](https://github.com/rishabhdev06/cfo-helper/blob/main/src/App.tsx): `src/App.tsx`
- [Landing page](https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/LandingPage.tsx): `src/components/LandingPage.tsx`

### Planning experience

- [Organization setup](https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/OnboardingFlow.tsx): `src/components/OnboardingFlow.tsx`
- [Dashboard](https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/Dashboard.tsx): `src/components/Dashboard.tsx`
- [Financial inputs](https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/InputPanel.tsx): `src/components/InputPanel.tsx`
- [Advanced controls](https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/AdvancedInputPanel.tsx): `src/components/AdvancedInputPanel.tsx`
- [Financial types](https://github.com/rishabhdev06/cfo-helper/blob/main/src/types/financial.ts): `src/types/financial.ts`

### Accounts and data

- [User data hook](https://github.com/rishabhdev06/cfo-helper/blob/main/src/hooks/useSupabase.ts): `src/hooks/useSupabase.ts`
- [Database services](https://github.com/rishabhdev06/cfo-helper/blob/main/src/services/databaseService.ts): `src/services/databaseService.ts`
- [Supabase client](https://github.com/rishabhdev06/cfo-helper/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`

### Insights and reports

- [Forecast results](https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/ResultsPanel.tsx): `src/components/ResultsPanel.tsx`
- [AI advisor chat](https://github.com/rishabhdev06/cfo-helper/blob/main/src/components/AIChatBot.tsx): `src/components/AIChatBot.tsx`
- [AI advisor service](https://github.com/rishabhdev06/cfo-helper/blob/main/src/services/aiAdvisor.ts): `src/services/aiAdvisor.ts`
- [PDF report export](https://github.com/rishabhdev06/cfo-helper/blob/main/src/utils/pdfExport.ts): `src/utils/pdfExport.ts`

### Other components

- **Business user**
- **Clerk auth**
- **Gemini API**
- **Supabase**

## Connections

- Business user → Landing page: views
- Landing page → Clerk auth: starts sign-in
- Clerk auth → App: authenticates
- App → Landing page: shows signed-out
- App → Organization setup: shows signed-in
- Organization setup → Dashboard: renders after setup
- Organization setup → Clerk auth: updates metadata
- Organization setup → Database services: creates profile
- Business user → Organization setup: provides org details
- Business user → Financial inputs: sets parameters
- Dashboard → Financial inputs: presents controls
- Dashboard → Advanced controls: presents advanced controls
- Dashboard → Forecast results: presents analysis
- Financial inputs → Financial types: uses input model
- Advanced controls → Financial types: uses input model
- Business user → AI advisor chat: asks advice
- AI advisor chat → AI advisor service: sends message
- AI advisor service → Gemini API: generates response
- Forecast results → PDF report export: exports report
- Dashboard → User data hook: loads user data
- User data hook → Clerk auth: reads signed-in user
- User data hook → Database services: loads and saves data
- Database services → Supabase client: queries through
- Supabase client → Supabase: reads and writes
