# spectorharvey147/site-connect architecture

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

- Interactive diagram: https://gitdiagram.com/spectorharvey147/site-connect
- Repository: https://github.com/spectorharvey147/site-connect

## Overview

ClaimFlow is a role-based expense-claim and accounting application. Users authenticate, submit claims with expenses and attachments, and claims proceed through role-specific approval and accounts processing toward SAP/accounting and payment workflows. The README also identifies vendor GST verification, duplicate detection, attachment/PDF handling, and approval identity limits as product concerns. The graph includes documented major capabilities, but several views and backend functions were not sampled; their internal calls are therefore omitted where evidence is unavailable.

Main entry points: [`src/App.tsx`](https://github.com/spectorharvey147/site-connect/blob/main/src/App.tsx) (App routing), [`src/lib/claims-api.ts`](https://github.com/spectorharvey147/site-connect/blob/main/src/lib/claims-api.ts) (Claim workflows), [`src/components/views/ApprovalView.tsx`](https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/ApprovalView.tsx) (Claim approvals), [`src/components/views/AccountsProcessingView.tsx`](https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/AccountsProcessingView.tsx) (Accounts processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Application and identity"]
  node_app["App routing<br/>[App.tsx]"]
  node_workspace["Role workspace<br/>[Index.tsx]"]
  node_login["Login interface<br/>[LoginPage.tsx]"]
  node_authcontext["Session context<br/>[AuthContext.tsx]"]
  node_auth["Authentication service<br/>[auth.ts]"]
end

subgraph group_claims["Claims and approvals"]
  node_submit["Claim submission"]
  node_claimsapi["Claim workflows<br/>[claims-api.ts]"]
  node_approval["Claim approvals<br/>[ApprovalView.tsx]"]
  node_emailaction["Email approval<br/>[ClaimAction.tsx]"]
  node_approvaleditor["Expense approval editor"]
  node_timeline["Approval timeline"]
  node_attachmentpreview["Attachment preview"]
  node_history["Claim history"]
end

subgraph group_accounting["Accounting operations"]
  node_accountsprocessing["Accounts processing"]
  node_accountingapi["Accounting services<br/>[accounting-api.ts]"]
  node_sapjournal["SAP journal<br/>[sap-journal.ts]"]
  node_accountingsetup["Accounting setup"]
  node_voucher["Payment voucher"]
end

subgraph group_platform["Backend and files"]
  node_supabaseclient["Supabase client<br/>[client.ts]"]
  node_supabase[("Supabase services")]
  node_storageaccess["Storage access function<br/>[index.ts]"]
  node_notification["Email notifications<br/>[index.ts]"]
end

node_user(("Claim user"))

node_user -.->|"opens"| node_app
node_app -->|"routes to"| node_workspace
node_workspace -->|"shows when signed out"| node_login
node_workspace -->|"reads session"| node_authcontext
node_authcontext -->|"calls"| node_auth
node_auth -->|"uses"| node_supabaseclient
node_login -->|"requests reset"| node_auth
node_app -->|"routes to"| node_submit
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_approval
node_app -->|"routes to"| node_accountsprocessing
node_app -->|"routes to"| node_accountingsetup
node_app -->|"routes to"| node_voucher
node_submit -->|"submits claims"| node_claimsapi
node_claimsapi -->|"queries"| node_supabaseclient
node_claimsapi -->|"resolves work"| node_accountingapi
node_approval -->|"uses workflows"| node_claimsapi
node_approval -->|"renders"| node_approvaleditor
node_approval -->|"renders"| node_timeline
node_approval -->|"renders"| node_attachmentpreview
node_emailaction -->|"approves claims"| node_claimsapi
node_emailaction -->|"renders"| node_approvaleditor
node_emailaction -->|"renders"| node_attachmentpreview
node_accountsprocessing -->|"uses claim data"| node_claimsapi
node_accountsprocessing -->|"uses accounting services"| node_accountingapi
node_accountsprocessing -->|"uses journal logic"| node_sapjournal
node_supabaseclient -->|"queries and stores"| node_supabase
node_supabaseclient -->|"dispatches storage requests"| node_storageaccess
node_storageaccess -.->|"accesses storage"| node_supabase
node_notification -.->|"uses backend"| node_supabase

click node_app "https://github.com/spectorharvey147/site-connect/blob/main/src/App.tsx"
click node_workspace "https://github.com/spectorharvey147/site-connect/blob/main/src/pages/Index.tsx"
click node_login "https://github.com/spectorharvey147/site-connect/blob/main/src/components/LoginPage.tsx"
click node_authcontext "https://github.com/spectorharvey147/site-connect/blob/main/src/contexts/AuthContext.tsx"
click node_auth "https://github.com/spectorharvey147/site-connect/blob/main/src/lib/auth.ts"
click node_submit "https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/SubmitClaimView.tsx"
click node_claimsapi "https://github.com/spectorharvey147/site-connect/blob/main/src/lib/claims-api.ts"
click node_approval "https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/ApprovalView.tsx"
click node_emailaction "https://github.com/spectorharvey147/site-connect/blob/main/src/pages/ClaimAction.tsx"
click node_approvaleditor "https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/ExpenseApprovalEditor.tsx"
click node_timeline "https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/ClaimApprovalTimeline.tsx"
click node_attachmentpreview "https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/AttachmentPreview.tsx"
click node_history "https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/ClaimHistoryView.tsx"
click node_accountsprocessing "https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/AccountsProcessingView.tsx"
click node_accountingapi "https://github.com/spectorharvey147/site-connect/blob/main/src/lib/accounting-api.ts"
click node_sapjournal "https://github.com/spectorharvey147/site-connect/blob/main/src/lib/sap-journal.ts"
click node_accountingsetup "https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/AccountingSetupView.tsx"
click node_voucher "https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/PaymentVoucherView.tsx"
click node_supabaseclient "https://github.com/spectorharvey147/site-connect/blob/main/src/integrations/supabase/client.ts"
click node_storageaccess "https://github.com/spectorharvey147/site-connect/blob/main/supabase/functions/storage-access/index.ts"
click node_notification "https://github.com/spectorharvey147/site-connect/blob/main/supabase/functions/send-notification/index.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_workspace,node_login,node_authcontext,node_auth,node_user toneBlue
class node_submit,node_claimsapi,node_approval,node_emailaction,node_approvaleditor,node_timeline,node_attachmentpreview,node_history toneAmber
class node_accountsprocessing,node_accountingapi,node_sapjournal,node_accountingsetup,node_voucher toneMint
class node_supabaseclient,node_supabase,node_storageaccess,node_notification toneRose
```

## Components

### Application and identity

- [App routing](https://github.com/spectorharvey147/site-connect/blob/main/src/App.tsx): `src/App.tsx`
- [Role workspace](https://github.com/spectorharvey147/site-connect/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`
- [Login interface](https://github.com/spectorharvey147/site-connect/blob/main/src/components/LoginPage.tsx): `src/components/LoginPage.tsx`
- [Session context](https://github.com/spectorharvey147/site-connect/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Authentication service](https://github.com/spectorharvey147/site-connect/blob/main/src/lib/auth.ts): `src/lib/auth.ts`

### Claims and approvals

- [Claim submission](https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/SubmitClaimView.tsx): `src/components/views/SubmitClaimView.tsx`
- [Claim workflows](https://github.com/spectorharvey147/site-connect/blob/main/src/lib/claims-api.ts): `src/lib/claims-api.ts`
- [Claim approvals](https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/ApprovalView.tsx): `src/components/views/ApprovalView.tsx`
- [Email approval](https://github.com/spectorharvey147/site-connect/blob/main/src/pages/ClaimAction.tsx): `src/pages/ClaimAction.tsx`
- [Expense approval editor](https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/ExpenseApprovalEditor.tsx): `src/components/views/ExpenseApprovalEditor.tsx`
- [Approval timeline](https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/ClaimApprovalTimeline.tsx): `src/components/views/ClaimApprovalTimeline.tsx`
- [Attachment preview](https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/AttachmentPreview.tsx): `src/components/views/AttachmentPreview.tsx`
- [Claim history](https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/ClaimHistoryView.tsx): `src/components/views/ClaimHistoryView.tsx`

### Accounting operations

- [Accounts processing](https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/AccountsProcessingView.tsx): `src/components/views/AccountsProcessingView.tsx`
- [Accounting services](https://github.com/spectorharvey147/site-connect/blob/main/src/lib/accounting-api.ts): `src/lib/accounting-api.ts`
- [SAP journal](https://github.com/spectorharvey147/site-connect/blob/main/src/lib/sap-journal.ts): `src/lib/sap-journal.ts`
- [Accounting setup](https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/AccountingSetupView.tsx): `src/components/views/AccountingSetupView.tsx`
- [Payment voucher](https://github.com/spectorharvey147/site-connect/blob/main/src/components/views/PaymentVoucherView.tsx): `src/components/views/PaymentVoucherView.tsx`

### Backend and files

- [Supabase client](https://github.com/spectorharvey147/site-connect/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- **Supabase services**
- [Storage access function](https://github.com/spectorharvey147/site-connect/blob/main/supabase/functions/storage-access/index.ts): `supabase/functions/storage-access/index.ts`
- [Email notifications](https://github.com/spectorharvey147/site-connect/blob/main/supabase/functions/send-notification/index.ts): `supabase/functions/send-notification/index.ts`

### Other components

- **Claim user**

## Connections

- Claim user → App routing: opens
- App routing → Role workspace: routes to (evidence: `src/App.tsx`)
- Role workspace → Login interface: shows when signed out (evidence: `src/pages/Index.tsx`)
- Role workspace → Session context: reads session (evidence: `src/pages/Index.tsx`)
- Session context → Authentication service: calls (evidence: `src/contexts/AuthContext.tsx`)
- Authentication service → Supabase client: uses (evidence: `src/lib/auth.ts`)
- Login interface → Authentication service: requests reset (evidence: `src/components/LoginPage.tsx`)
- App routing → Claim submission: routes to (evidence: `src/App.tsx`)
- App routing → Claim history: routes to (evidence: `src/App.tsx`)
- App routing → Claim approvals: routes to (evidence: `src/App.tsx`)
- App routing → Accounts processing: routes to (evidence: `src/App.tsx`)
- App routing → Accounting setup: routes to (evidence: `src/App.tsx`)
- App routing → Payment voucher: routes to (evidence: `src/App.tsx`)
- Claim submission → Claim workflows: submits claims (evidence: `src/lib/claims-api.ts`)
- Claim workflows → Supabase client: queries (evidence: `src/lib/claims-api.ts`)
- Claim workflows → Accounting services: resolves work (evidence: `src/lib/claims-api.ts`)
- Claim approvals → Claim workflows: uses workflows (evidence: `src/components/views/ApprovalView.tsx`)
- Claim approvals → Expense approval editor: renders (evidence: `src/components/views/ApprovalView.tsx`)
- Claim approvals → Approval timeline: renders (evidence: `src/components/views/ApprovalView.tsx`)
- Claim approvals → Attachment preview: renders (evidence: `src/components/views/ApprovalView.tsx`)
- Email approval → Claim workflows: approves claims (evidence: `src/pages/ClaimAction.tsx`)
- Email approval → Expense approval editor: renders (evidence: `src/pages/ClaimAction.tsx`)
- Email approval → Attachment preview: renders (evidence: `src/pages/ClaimAction.tsx`)
- Accounts processing → Claim workflows: uses claim data (evidence: `src/components/views/AccountsProcessingView.tsx`)
- Accounts processing → Accounting services: uses accounting services (evidence: `src/components/views/AccountsProcessingView.tsx`)
- Accounts processing → SAP journal: uses journal logic (evidence: `src/components/views/AccountsProcessingView.tsx`)
- Supabase client → Supabase services: queries and stores (evidence: `src/integrations/supabase/client.ts`)
- Supabase client → Storage access function: dispatches storage requests (evidence: `src/integrations/supabase/client.ts`)
- Storage access function → Supabase services: accesses storage
- Email notifications → Supabase services: uses backend
