# maheshm-01/docuforge-ai architecture

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

- Interactive diagram: https://gitdiagram.com/maheshm-01/docuforge-ai
- Repository: https://github.com/maheshm-01/docuforge-ai

## Overview

DocuForge AI is presented as an India-focused document-intelligence platform that turns uploaded documents into validated business data and downstream actions. Its documented workflow is preprocessing/OCR, classification, extraction, validation and human review, then format-specific export and routing. The tree contains API routes for several stages, but the provided source excerpts are empty; relationships and broader capabilities below therefore reflect README documentation, not verified runtime wiring.

Main entry points: [`app/main.py`](https://github.com/maheshm-01/docuforge-ai/blob/main/app/main.py) (FastAPI application), [`app/api/extract.py`](https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/extract.py) (Field extraction), [`app/api/export.py`](https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/export.py) (Output compiler), [`app/api/validate.py`](https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/validate.py) (Human review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Document intake"]
  node_api["FastAPI application<br/>[main.py]"]
  node_ocr_route["OCR route<br/>[ocr.py]"]
  node_ocr_engine["OCR engine<br/>[ocr_engine.py]"]
end

subgraph group_understand["Document understanding"]
  node_classify["Classification<br/>[classify.py]"]
  node_extract["Field extraction<br/>[extract.py]"]
  node_tables["Table extraction<br/>[extract.py]"]
end

subgraph group_verify["Validation and review"]
  node_validate["Validation<br/>[validate.py]"]
  node_review["Human review<br/>[validate.py]"]
  node_frontend["Review interface"]
end

subgraph group_platform["Platform services"]
  node_schemas["Response schemas<br/>[responses.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_database[("Document database")]
  node_search["Document search"]
  node_queue["Task queue"]
  node_llm["Optional LLM add-on"]
end

subgraph group_delivery["Outputs and actions"]
  node_export["Output compiler<br/>[export.py]"]
  node_formats["Business formats"]
  node_workflow["Workflow automation"]
end

node_submitter(("Document source"))
node_business(("Business systems"))

node_submitter -->|"submits documents"| node_api
node_api -.->|"routes requests"| node_ocr_route
node_ocr_route -->|"runs OCR"| node_ocr_engine
node_ocr_engine -->|"supplies recognized text"| node_classify
node_classify -->|"identifies document type"| node_extract
node_extract -->|"extracts tabular fields"| node_tables
node_extract -->|"provides extracted fields"| node_validate
node_validate -->|"flags low confidence"| node_review
node_review -->|"approves data"| node_export
node_export -->|"compiles formats"| node_formats
node_export -->|"routes outputs"| node_business
node_workflow -.->|"automates actions"| node_business
node_frontend -.->|"supports review"| node_review
node_api -.->|"uses response schemas"| node_schemas
node_api -.->|"uses settings"| node_config
node_api -.->|"persists documents"| node_database
node_api -.->|"supports retrieval"| node_search
node_api -.->|"dispatches processing"| node_queue
node_api -.->|"optionally enables"| node_llm

click node_api "https://github.com/maheshm-01/docuforge-ai/blob/main/app/main.py"
click node_ocr_route "https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/ocr.py"
click node_ocr_engine "https://github.com/maheshm-01/docuforge-ai/blob/main/app/core/ocr_engine.py"
click node_classify "https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/classify.py"
click node_extract "https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/extract.py"
click node_tables "https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/extract.py"
click node_validate "https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/validate.py"
click node_review "https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/validate.py"
click node_schemas "https://github.com/maheshm-01/docuforge-ai/blob/main/app/schemas/responses.py"
click node_config "https://github.com/maheshm-01/docuforge-ai/blob/main/app/config.py"
click node_database "https://github.com/maheshm-01/docuforge-ai/tree/main/app/models"
click node_search "https://github.com/maheshm-01/docuforge-ai/tree/main/app"
click node_export "https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/export.py"
click node_formats "https://github.com/maheshm-01/docuforge-ai/tree/main/app/templates"
click node_workflow "https://github.com/maheshm-01/docuforge-ai/tree/main/workflows"
click node_frontend "https://github.com/maheshm-01/docuforge-ai/tree/main/frontend/src"

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_api,node_ocr_route,node_ocr_engine toneBlue
class node_classify,node_extract,node_tables toneAmber
class node_validate,node_review,node_frontend toneMint
class node_schemas,node_config,node_database,node_search,node_queue,node_llm toneRose
class node_export,node_formats,node_workflow,node_submitter,node_business toneIndigo
```

## Components

### Document intake

- [FastAPI application](https://github.com/maheshm-01/docuforge-ai/blob/main/app/main.py): `app/main.py`
- [OCR route](https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/ocr.py): `app/api/ocr.py`
- [OCR engine](https://github.com/maheshm-01/docuforge-ai/blob/main/app/core/ocr_engine.py): `app/core/ocr_engine.py`

### Document understanding

- [Classification](https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/classify.py): `app/api/classify.py`
- [Field extraction](https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/extract.py): `app/api/extract.py`
- [Table extraction](https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/extract.py): `app/api/extract.py`

### Validation and review

- [Validation](https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/validate.py): `app/api/validate.py`
- [Human review](https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/validate.py): `app/api/validate.py`
- [Review interface](https://github.com/maheshm-01/docuforge-ai/tree/main/frontend/src): `frontend/src`

### Platform services

- [Response schemas](https://github.com/maheshm-01/docuforge-ai/blob/main/app/schemas/responses.py): `app/schemas/responses.py`
- [Configuration](https://github.com/maheshm-01/docuforge-ai/blob/main/app/config.py): `app/config.py`
- [Document database](https://github.com/maheshm-01/docuforge-ai/tree/main/app/models): `app/models`
- [Document search](https://github.com/maheshm-01/docuforge-ai/tree/main/app): `app`
- **Task queue**
- **Optional LLM add-on**

### Outputs and actions

- [Output compiler](https://github.com/maheshm-01/docuforge-ai/blob/main/app/api/export.py): `app/api/export.py`
- [Business formats](https://github.com/maheshm-01/docuforge-ai/tree/main/app/templates): `app/templates`
- [Workflow automation](https://github.com/maheshm-01/docuforge-ai/tree/main/workflows): `workflows`

### Other components

- **Document source**
- **Business systems**

## Connections

- Document source → FastAPI application: submits documents (evidence: `README.md`)
- FastAPI application → OCR route: routes requests
- OCR route → OCR engine: runs OCR (evidence: `README.md`)
- OCR engine → Classification: supplies recognized text (evidence: `README.md`)
- Classification → Field extraction: identifies document type (evidence: `README.md`)
- Field extraction → Table extraction: extracts tabular fields (evidence: `README.md`)
- Field extraction → Validation: provides extracted fields (evidence: `README.md`)
- Validation → Human review: flags low confidence (evidence: `README.md`)
- Human review → Output compiler: approves data (evidence: `README.md`)
- Output compiler → Business formats: compiles formats (evidence: `README.md`)
- Output compiler → Business systems: routes outputs (evidence: `README.md`)
- Workflow automation → Business systems: automates actions (evidence: `README.md`)
- Review interface → Human review: supports review (evidence: `README.md`)
- FastAPI application → Response schemas: uses response schemas
- FastAPI application → Configuration: uses settings
- FastAPI application → Document database: persists documents (evidence: `README.md`)
- FastAPI application → Document search: supports retrieval (evidence: `README.md`)
- FastAPI application → Task queue: dispatches processing (evidence: `README.md`)
- FastAPI application → Optional LLM add-on: optionally enables (evidence: `README.md`)
