# madhanahari/docusure-ai architecture

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

- Interactive diagram: https://gitdiagram.com/madhanahari/docusure-ai
- Repository: https://github.com/madhanahari/docusure-ai

## Overview

DocuSure AI is a prototype for reviewer-assisted institutional document scrutiny. A reviewer submits a PDF through the React interface; the FastAPI analysis endpoint extracts text, runs preliminary checks and optional Groq analysis, saves results, and returns findings for dashboard review. The interface also checks API health and presents saved-document history. The README describes broader compliance support, but official-authority verification and comprehensive regulatory checks are future work. The standalone database helper is included, though the available excerpts do not show it wired into the API; relationships reflect only documented or excerpted evidence.

Main entry points: [`backend/main.py`](https://github.com/madhanahari/docusure-ai/blob/main/backend/main.py) (FastAPI endpoints), [`src/App.jsx`](https://github.com/madhanahari/docusure-ai/blob/main/src/App.jsx) (Review dashboard), [`backend/docusure.db`](https://github.com/madhanahari/docusure-ai/blob/main/backend/docusure.db) (SQLite records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_review["Reviewer interface"]
  node_app["Review dashboard<br/>[App.jsx]"]
end

subgraph group_analysis["Document analysis"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_pdf["PDF text extraction<br/>[main.py]"]
  node_checks["Preliminary checks<br/>[main.py]"]
  node_ai["Groq analysis<br/>[main.py]"]
end

subgraph group_persistence["Persistence"]
  node_sqlite[("SQLite records<br/>[docusure.db]")]
  node_dbhelpers["Database helpers<br/>[database.py]"]
end

node_reviewer(("Reviewer"))
node_groq["Groq API"]

node_reviewer -->|"submits PDF"| node_app
node_app -->|"uploads document"| node_api
node_api -->|"extracts text"| node_pdf
node_api -->|"checks findings"| node_checks
node_api -->|"analyzes text"| node_ai
node_ai -->|"requests analysis"| node_groq
node_api -->|"saves records"| node_sqlite
node_api -->|"reads history"| node_sqlite
node_api -->|"returns findings"| node_app
node_reviewer -->|"reviews results"| node_app

click node_app "https://github.com/madhanahari/docusure-ai/blob/main/src/App.jsx"
click node_api "https://github.com/madhanahari/docusure-ai/blob/main/backend/main.py"
click node_pdf "https://github.com/madhanahari/docusure-ai/blob/main/backend/main.py"
click node_checks "https://github.com/madhanahari/docusure-ai/blob/main/backend/main.py"
click node_ai "https://github.com/madhanahari/docusure-ai/blob/main/backend/main.py"
click node_sqlite "https://github.com/madhanahari/docusure-ai/blob/main/backend/docusure.db"
click node_dbhelpers "https://github.com/madhanahari/docusure-ai/blob/main/backend/database.py"

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_reviewer toneBlue
class node_api,node_pdf,node_checks,node_ai toneAmber
class node_sqlite,node_dbhelpers,node_groq toneMint
```

## Components

### Reviewer interface

- [Review dashboard](https://github.com/madhanahari/docusure-ai/blob/main/src/App.jsx): `src/App.jsx`

### Document analysis

- [FastAPI endpoints](https://github.com/madhanahari/docusure-ai/blob/main/backend/main.py): `backend/main.py`
- [PDF text extraction](https://github.com/madhanahari/docusure-ai/blob/main/backend/main.py): `backend/main.py`
- [Preliminary checks](https://github.com/madhanahari/docusure-ai/blob/main/backend/main.py): `backend/main.py`
- [Groq analysis](https://github.com/madhanahari/docusure-ai/blob/main/backend/main.py): `backend/main.py`

### Persistence

- [SQLite records](https://github.com/madhanahari/docusure-ai/blob/main/backend/docusure.db): `backend/docusure.db`
- [Database helpers](https://github.com/madhanahari/docusure-ai/blob/main/backend/database.py): `backend/database.py`

### Other components

- **Reviewer**
- **Groq API**

## Connections

- Reviewer → Review dashboard: submits PDF (evidence: `README.md`)
- Review dashboard → FastAPI endpoints: uploads document (evidence: `README.md`)
- FastAPI endpoints → PDF text extraction: extracts text (evidence: `backend/main.py`)
- FastAPI endpoints → Preliminary checks: checks findings (evidence: `backend/main.py`)
- FastAPI endpoints → Groq analysis: analyzes text (evidence: `backend/main.py`)
- Groq analysis → Groq API: requests analysis (evidence: `backend/main.py`)
- FastAPI endpoints → SQLite records: saves records (evidence: `backend/main.py`)
- FastAPI endpoints → SQLite records: reads history (evidence: `backend/main.py`)
- FastAPI endpoints → Review dashboard: returns findings (evidence: `README.md`)
- Reviewer → Review dashboard: reviews results (evidence: `README.md`)
