# aavesh09/aiformsfiller architecture

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

- Interactive diagram: https://gitdiagram.com/aavesh09/aiformsfiller
- Repository: https://github.com/aavesh09/aiformsfiller

## Overview

This is an AI-assisted form-filling product: users provide a blank form and supporting documents, receive form analysis or document verification, then get AI-suggested field values and can generate a filled form. The tree also shows a static Astro site with informational pages. Backend excerpts support the OCR/rendering and Gemini call paths; frontend request wiring and several page implementations were not sampled, so those links are omitted.

Main entry points: [`backend/main.py`](https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py) (Analyze form), [`backend/ocr_service.py`](https://github.com/aavesh09/aiformsfiller/blob/main/backend/ocr_service.py) (Text extraction), [`src/pages/index.astro`](https://github.com/aavesh09/aiformsfiller/blob/main/src/pages/index.astro) (Product pages), [`backend/gemini_service.py`](https://github.com/aavesh09/aiformsfiller/blob/main/backend/gemini_service.py) (AI form analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_tool["Form tool<br/>[tool.astro]"]
  node_landing["Product pages<br/>[index.astro]"]
  node_site_sections["Site sections"]
end

subgraph group_api["Form API"]
  node_health["Health check<br/>[main.py]"]
  node_analyze["Analyze form<br/>[main.py]"]
  node_verify["Verify document<br/>[main.py]"]
  node_fill["Fill form<br/>[main.py]"]
  node_generate["Generate filled form<br/>[main.py]"]
end

subgraph group_documents["Document processing"]
  node_ocr["Text extraction<br/>[ocr_service.py]"]
  node_render["Page rendering<br/>[main.py]"]
  node_pdf_output["PDF output<br/>[main.py]"]
end

subgraph group_ai["AI services"]
  node_gemini_analyze["AI form analysis<br/>[gemini_service.py]"]
  node_gemini_verify["AI document check<br/>[gemini_service.py]"]
  node_gemini_fill["AI field matching<br/>[gemini_service.py]"]
end

node_visitor(("Visitor"))
node_gemini_service{{"Gemini API"}}

node_visitor -->|"opens"| node_tool
node_visitor -->|"browses"| node_landing
node_landing -->|"presents"| node_site_sections
node_analyze -->|"extracts text"| node_ocr
node_analyze -->|"renders pages"| node_render
node_analyze -->|"requests analysis"| node_gemini_analyze
node_gemini_analyze -->|"calls"| node_gemini_service
node_verify -->|"extracts text"| node_ocr
node_verify -->|"requests verification"| node_gemini_verify
node_gemini_verify -->|"calls"| node_gemini_service
node_fill -->|"extracts text"| node_ocr
node_fill -->|"renders pages"| node_render
node_fill -->|"requests field matching"| node_gemini_fill
node_gemini_fill -->|"calls"| node_gemini_service
node_generate -->|"writes fields"| node_pdf_output

click node_tool "https://github.com/aavesh09/aiformsfiller/blob/main/src/pages/tool.astro"
click node_landing "https://github.com/aavesh09/aiformsfiller/blob/main/src/pages/index.astro"
click node_site_sections "https://github.com/aavesh09/aiformsfiller/tree/main/src/components"
click node_health "https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py"
click node_analyze "https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py"
click node_verify "https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py"
click node_fill "https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py"
click node_generate "https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py"
click node_ocr "https://github.com/aavesh09/aiformsfiller/blob/main/backend/ocr_service.py"
click node_render "https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py"
click node_pdf_output "https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py"
click node_gemini_analyze "https://github.com/aavesh09/aiformsfiller/blob/main/backend/gemini_service.py"
click node_gemini_verify "https://github.com/aavesh09/aiformsfiller/blob/main/backend/gemini_service.py"
click node_gemini_fill "https://github.com/aavesh09/aiformsfiller/blob/main/backend/gemini_service.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_tool,node_landing,node_site_sections toneBlue
class node_health,node_analyze,node_verify,node_fill,node_generate toneAmber
class node_ocr,node_render,node_pdf_output,node_gemini_service toneMint
class node_gemini_analyze,node_gemini_verify,node_gemini_fill toneRose
class node_visitor toneIndigo
```

## Components

### Web experience

- [Form tool](https://github.com/aavesh09/aiformsfiller/blob/main/src/pages/tool.astro): `src/pages/tool.astro`
- [Product pages](https://github.com/aavesh09/aiformsfiller/blob/main/src/pages/index.astro): `src/pages/index.astro`
- [Site sections](https://github.com/aavesh09/aiformsfiller/tree/main/src/components): `src/components`

### Form API

- [Health check](https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py): `backend/main.py`
- [Analyze form](https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py): `backend/main.py`
- [Verify document](https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py): `backend/main.py`
- [Fill form](https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py): `backend/main.py`
- [Generate filled form](https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py): `backend/main.py`

### Document processing

- [Text extraction](https://github.com/aavesh09/aiformsfiller/blob/main/backend/ocr_service.py): `backend/ocr_service.py`
- [Page rendering](https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py): `backend/main.py`
- [PDF output](https://github.com/aavesh09/aiformsfiller/blob/main/backend/main.py): `backend/main.py`

### AI services

- [AI form analysis](https://github.com/aavesh09/aiformsfiller/blob/main/backend/gemini_service.py): `backend/gemini_service.py`
- [AI document check](https://github.com/aavesh09/aiformsfiller/blob/main/backend/gemini_service.py): `backend/gemini_service.py`
- [AI field matching](https://github.com/aavesh09/aiformsfiller/blob/main/backend/gemini_service.py): `backend/gemini_service.py`

### Other components

- **Visitor**
- **Gemini API**

## Connections

- Visitor → Form tool: opens
- Visitor → Product pages: browses
- Product pages → Site sections: presents
- Analyze form → Text extraction: extracts text
- Analyze form → Page rendering: renders pages
- Analyze form → AI form analysis: requests analysis
- AI form analysis → Gemini API: calls
- Verify document → Text extraction: extracts text
- Verify document → AI document check: requests verification
- AI document check → Gemini API: calls
- Fill form → Text extraction: extracts text
- Fill form → Page rendering: renders pages
- Fill form → AI field matching: requests field matching
- AI field matching → Gemini API: calls
- Generate filled form → PDF output: writes fields
