# adeebazaidi/spendwise-ai architecture

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

- Interactive diagram: https://gitdiagram.com/adeebazaidi/spendwise-ai
- Repository: https://github.com/adeebazaidi/spendwise-ai

## Overview

Spendwise AI is a self-service AI-tooling spend audit: a startup team enters its size, use case, tools, plans, seats, and spend; the app calculates deterministic savings recommendations and presents a shareable report with an optional executive summary and lead capture. The main calculation, persistence fallback, report loading, and lead-capture calls are visible in excerpts. Other capabilities, such as the documented AI-summary fallback, are represented from the README; unsampled implementation details are not inferred.

Main entry points: [`src/components/audit/audit-form.tsx`](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/components/audit/audit-form.tsx) (Audit form), [`src/components/audit/report-dashboard.tsx`](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/components/audit/report-dashboard.tsx) (Report dashboard), [`src/app/page.tsx`](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/app/page.tsx) (Landing page), [`src/lib/audit-engine.ts`](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/lib/audit-engine.ts) (Savings engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Product entry"]
  node_landing["Landing page<br/>[page.tsx]"]
  node_audit_route["Audit route<br/>[page.tsx]"]
  node_site_shell["Site layout<br/>[layout.tsx]"]
end

subgraph group_audit["Audit workflow"]
  node_audit_form["Audit form<br/>[audit-form.tsx]"]
  node_pricing["Pricing data<br/>[pricing.ts]"]
  node_engine["Savings engine<br/>[audit-engine.ts]"]
end

subgraph group_reporting["Reports and persistence"]
  node_results_route["Results route<br/>[page.tsx]"]
  node_dashboard["Report dashboard"]
  node_actions["Summary action<br/>[actions.ts]"]
  node_supabase_helpers["Report and lead access<br/>[supabase.ts]"]
end

subgraph group_shared["Shared interface"]
  node_layout_parts["Header and footer"]
  node_ui_components["UI components"]
end

node_team(("Startup team"))
node_database[("Supabase database")]
node_anthropic{{"Anthropic API"}}

node_team -->|"visits"| node_landing
node_landing -->|"links to audit"| node_audit_route
node_team -->|"enters spend"| node_audit_form
node_audit_route -->|"renders"| node_audit_form
node_audit_form -->|"uses options"| node_pricing
node_audit_form -->|"runs audit"| node_engine
node_engine -->|"reads pricing"| node_pricing
node_audit_form -->|"saves report"| node_supabase_helpers
node_audit_form -->|"routes with report"| node_results_route
node_results_route -->|"renders"| node_dashboard
node_dashboard -->|"loads report and captures lead"| node_supabase_helpers
node_dashboard -->|"runs audit"| node_engine
node_dashboard -->|"requests summary"| node_actions
node_supabase_helpers -->|"reads and writes"| node_database
node_actions -.->|"requests summary"| node_anthropic
node_site_shell -->|"renders"| node_layout_parts
node_landing -->|"uses button"| node_ui_components
node_audit_form -->|"uses form controls"| node_ui_components
node_dashboard -->|"uses report controls"| node_ui_components

click node_landing "https://github.com/adeebazaidi/spendwise-ai/blob/main/src/app/page.tsx"
click node_audit_route "https://github.com/adeebazaidi/spendwise-ai/blob/main/src/app/audit/page.tsx"
click node_audit_form "https://github.com/adeebazaidi/spendwise-ai/blob/main/src/components/audit/audit-form.tsx"
click node_pricing "https://github.com/adeebazaidi/spendwise-ai/blob/main/src/lib/pricing.ts"
click node_engine "https://github.com/adeebazaidi/spendwise-ai/blob/main/src/lib/audit-engine.ts"
click node_results_route "https://github.com/adeebazaidi/spendwise-ai/blob/main/src/app/report/results/page.tsx"
click node_dashboard "https://github.com/adeebazaidi/spendwise-ai/blob/main/src/components/audit/report-dashboard.tsx"
click node_actions "https://github.com/adeebazaidi/spendwise-ai/blob/main/src/app/actions.ts"
click node_supabase_helpers "https://github.com/adeebazaidi/spendwise-ai/blob/main/src/lib/supabase.ts"
click node_site_shell "https://github.com/adeebazaidi/spendwise-ai/blob/main/src/app/layout.tsx"
click node_layout_parts "https://github.com/adeebazaidi/spendwise-ai/tree/main/src/components/layout"
click node_ui_components "https://github.com/adeebazaidi/spendwise-ai/tree/main/src/components/ui"

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_landing,node_audit_route,node_site_shell toneBlue
class node_audit_form,node_pricing,node_engine,node_database toneAmber
class node_results_route,node_dashboard,node_actions,node_supabase_helpers,node_anthropic toneMint
class node_layout_parts,node_ui_components toneRose
class node_team toneIndigo
```

## Components

### Product entry

- [Landing page](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Audit route](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/app/audit/page.tsx): `src/app/audit/page.tsx`
- [Site layout](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/app/layout.tsx): `src/app/layout.tsx`

### Audit workflow

- [Audit form](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/components/audit/audit-form.tsx): `src/components/audit/audit-form.tsx`
- [Pricing data](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/lib/pricing.ts): `src/lib/pricing.ts`
- [Savings engine](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/lib/audit-engine.ts): `src/lib/audit-engine.ts`

### Reports and persistence

- [Results route](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/app/report/results/page.tsx): `src/app/report/results/page.tsx`
- [Report dashboard](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/components/audit/report-dashboard.tsx): `src/components/audit/report-dashboard.tsx`
- [Summary action](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/app/actions.ts): `src/app/actions.ts`
- [Report and lead access](https://github.com/adeebazaidi/spendwise-ai/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`

### Shared interface

- [Header and footer](https://github.com/adeebazaidi/spendwise-ai/tree/main/src/components/layout): `src/components/layout`
- [UI components](https://github.com/adeebazaidi/spendwise-ai/tree/main/src/components/ui): `src/components/ui`

### Other components

- **Startup team**
- **Supabase database**
- **Anthropic API**

## Connections

- Startup team → Landing page: visits (evidence: `src/app/page.tsx`)
- Landing page → Audit route: links to audit (evidence: `src/app/page.tsx`)
- Startup team → Audit form: enters spend (evidence: `README.md`)
- Audit route → Audit form: renders (evidence: `src/app/audit/page.tsx`)
- Audit form → Pricing data: uses options (evidence: `src/components/audit/audit-form.tsx`)
- Audit form → Savings engine: runs audit (evidence: `src/components/audit/audit-form.tsx`)
- Savings engine → Pricing data: reads pricing (evidence: `src/lib/audit-engine.ts`)
- Audit form → Report and lead access: saves report (evidence: `src/components/audit/audit-form.tsx`)
- Audit form → Results route: routes with report (evidence: `src/components/audit/audit-form.tsx`)
- Results route → Report dashboard: renders (evidence: `src/app/report/results/page.tsx`)
- Report dashboard → Report and lead access: loads report and captures lead (evidence: `src/components/audit/report-dashboard.tsx`)
- Report dashboard → Savings engine: runs audit (evidence: `src/components/audit/report-dashboard.tsx`)
- Report dashboard → Summary action: requests summary (evidence: `src/components/audit/report-dashboard.tsx`)
- Report and lead access → Supabase database: reads and writes (evidence: `src/lib/supabase.ts`)
- Summary action → Anthropic API: requests summary (evidence: `README.md`)
- Site layout → Header and footer: renders (evidence: `src/app/layout.tsx`)
- Landing page → UI components: uses button (evidence: `src/app/page.tsx`)
- Audit form → UI components: uses form controls (evidence: `src/components/audit/audit-form.tsx`)
- Report dashboard → UI components: uses report controls (evidence: `src/components/audit/report-dashboard.tsx`)
