# aathisankar7/swipe-invoice-parser architecture

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

- Interactive diagram: https://gitdiagram.com/aathisankar7/swipe-invoice-parser
- Repository: https://github.com/aathisankar7/swipe-invoice-parser

## Overview

Swipe Invoice Parser takes invoice files and spreadsheets through a React upload workflow, backend extraction and normalization, then presents editable invoice, product and customer records synchronized in Redux. Spreadsheet uploads support suggested and human-verified column mapping; PDFs and images use Gemini, while spreadsheet header mapping uses Groq as documented. The excerpts show the upload routes and frontend state flow, but not every extractor branch or AI request, so those capability relationships are documented rather than inferred beyond the visible calls.

Main entry points: [`frontend/src/store/invoiceSlice.js`](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/store/invoiceSlice.js) (Invoice state), [`frontend/src/App.jsx`](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/App.jsx) (Workspace), [`frontend/src/components/FileUpload.jsx`](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/components/FileUpload.jsx) (File upload), [`backend/app/services/extractor.py`](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/backend/app/services/extractor.py) (File extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Upload and review"]
  node_app["Workspace<br/>[App.jsx]"]
  node_upload["File upload<br/>[FileUpload.jsx]"]
  node_mapper["Header mapper<br/>[HeaderMapper.jsx]"]
  node_invoices["Invoice review<br/>[InvoicesTab.jsx]"]
  node_products["Product review<br/>[ProductsTab.jsx]"]
  node_customers["Customer review<br/>[CustomersTab.jsx]"]
end

subgraph group_backend["Extraction and normalization"]
  node_api["Upload API<br/>[main.py]"]
  node_extractor["File extraction<br/>[extractor.py]"]
end

subgraph group_state["Shared data state"]
  node_store["Redux store<br/>[store.js]"]
  node_slice["Invoice state<br/>[invoiceSlice.js]"]
end

node_user(("Invoice user"))
node_gemini["Gemini AI"]
node_groq["Groq Llama"]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_upload
node_app -->|"renders"| node_invoices
node_app -->|"renders"| node_products
node_app -->|"renders"| node_customers
node_upload -->|"posts files"| node_api
node_upload -->|"renders"| node_mapper
node_mapper -->|"confirms mapping"| node_upload
node_api -->|"dispatches processing"| node_extractor
node_extractor -.->|"extracts documents"| node_gemini
node_extractor -.->|"maps headers"| node_groq
node_upload -->|"sets results"| node_slice
node_store -->|"reduces state"| node_slice
node_invoices -->|"reads and edits"| node_slice
node_products -->|"reads and edits"| node_slice
node_customers -->|"reads and edits"| node_slice
node_app -->|"clears data"| node_slice
node_slice -->|"syncs customer names"| node_invoices
node_slice -->|"syncs customer names"| node_products
node_slice -->|"syncs customer names"| node_customers

click node_app "https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/App.jsx"
click node_upload "https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/components/FileUpload.jsx"
click node_mapper "https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/components/HeaderMapper.jsx"
click node_invoices "https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/components/InvoicesTab.jsx"
click node_products "https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/components/ProductsTab.jsx"
click node_customers "https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/components/CustomersTab.jsx"
click node_api "https://github.com/aathisankar7/swipe-invoice-parser/blob/main/backend/app/main.py"
click node_extractor "https://github.com/aathisankar7/swipe-invoice-parser/blob/main/backend/app/services/extractor.py"
click node_store "https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/store/store.js"
click node_slice "https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/store/invoiceSlice.js"

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_upload,node_mapper,node_invoices,node_products,node_customers,node_user toneBlue
class node_api,node_extractor toneAmber
class node_store,node_slice toneMint
class node_gemini,node_groq toneIndigo
```

## Components

### Upload and review

- [Workspace](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [File upload](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/components/FileUpload.jsx): `frontend/src/components/FileUpload.jsx`
- [Header mapper](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/components/HeaderMapper.jsx): `frontend/src/components/HeaderMapper.jsx`
- [Invoice review](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/components/InvoicesTab.jsx): `frontend/src/components/InvoicesTab.jsx`
- [Product review](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/components/ProductsTab.jsx): `frontend/src/components/ProductsTab.jsx`
- [Customer review](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/components/CustomersTab.jsx): `frontend/src/components/CustomersTab.jsx`

### Extraction and normalization

- [Upload API](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/backend/app/main.py): `backend/app/main.py`
- [File extraction](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/backend/app/services/extractor.py): `backend/app/services/extractor.py`

### Shared data state

- [Redux store](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/store/store.js): `frontend/src/store/store.js`
- [Invoice state](https://github.com/aathisankar7/swipe-invoice-parser/blob/main/frontend/src/store/invoiceSlice.js): `frontend/src/store/invoiceSlice.js`

### Other components

- **Invoice user**
- **Gemini AI**
- **Groq Llama**

## Connections

- Invoice user → Workspace: uses (evidence: `frontend/src/App.jsx`)
- Workspace → File upload: renders (evidence: `frontend/src/App.jsx`)
- Workspace → Invoice review: renders (evidence: `frontend/src/App.jsx`)
- Workspace → Product review: renders (evidence: `frontend/src/App.jsx`)
- Workspace → Customer review: renders (evidence: `frontend/src/App.jsx`)
- File upload → Upload API: posts files (evidence: `frontend/src/components/FileUpload.jsx`)
- File upload → Header mapper: renders (evidence: `frontend/src/components/FileUpload.jsx`)
- Header mapper → File upload: confirms mapping (evidence: `frontend/src/components/FileUpload.jsx`)
- Upload API → File extraction: dispatches processing (evidence: `backend/app/main.py`)
- File extraction → Gemini AI: extracts documents (evidence: `README.md`)
- File extraction → Groq Llama: maps headers (evidence: `README.md`)
- File upload → Invoice state: sets results (evidence: `frontend/src/components/FileUpload.jsx`)
- Redux store → Invoice state: reduces state (evidence: `frontend/src/store/store.js`)
- Invoice review → Invoice state: reads and edits (evidence: `frontend/src/components/InvoicesTab.jsx`)
- Product review → Invoice state: reads and edits (evidence: `frontend/src/components/ProductsTab.jsx`)
- Customer review → Invoice state: reads and edits (evidence: `frontend/src/components/CustomersTab.jsx`)
- Workspace → Invoice state: clears data (evidence: `frontend/src/App.jsx`)
- Invoice state → Invoice review: syncs customer names (evidence: `frontend/src/store/invoiceSlice.js`)
- Invoice state → Product review: syncs customer names (evidence: `frontend/src/store/invoiceSlice.js`)
- Invoice state → Customer review: syncs customer names (evidence: `frontend/src/store/invoiceSlice.js`)
