# uanu0/manba architecture

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

- Interactive diagram: https://gitdiagram.com/uanu0/manba
- Repository: https://github.com/uanu0/manba

## Overview

Manba is a reviewer-facing service for checking Quran and hadith quotations and assessing religious claims against local corpora. The main workflow accepts text, finds and verifies quotations locally, optionally extracts claims with a model, and returns source-backed results; separate routes provide evidence search, fiqh checks, tafsir, OCR, and Dorar gradings. The model proposes or assesses relevance but does not certify claims. Relationships are limited to README statements and the shown source/index references; some route-to-service edges rely on the index, while unsampled UI and integrations are not inferred.

Main entry points: [`app/main.py`](https://github.com/uanu0/manba/blob/main/app/main.py) (FastAPI app), [`app/services/pipeline.py`](https://github.com/uanu0/manba/blob/main/app/services/pipeline.py) (Text pipeline), [`app/routers/verify.py`](https://github.com/uanu0/manba/blob/main/app/routers/verify.py) (Text verify API), [`app/services/claim_card.py`](https://github.com/uanu0/manba/blob/main/app/services/claim_card.py) (Claim assessment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and review"]
  node_review_ui["Reviewer UI<br/>[app.js]"]
  node_app["FastAPI app<br/>[main.py]"]
  node_verify_route["Text verify API<br/>[verify.py]"]
  node_check_route["Paragraph check API<br/>[check.py]"]
  node_claim_route["Claim API<br/>[claim.py]"]
  node_badge_route["Badge API<br/>[badge.py]"]
end

subgraph group_verification["Text verification"]
  node_pipeline["Text pipeline<br/>[pipeline.py]"]
  node_verifier[("Corpus verifier<br/>[verifier.py]")]
  node_quote_finder["Quote finder<br/>[quote_finder.py]"]
end

subgraph group_claims["Claims and evidence"]
  node_text_claims["Text claims<br/>[text_claims.py]"]
  node_claim_card["Claim assessment<br/>[claim_card.py]"]
  node_evidence_card["Evidence search<br/>[evidence_card.py]"]
  node_evidence_index[("Keyword evidence<br/>[evidence.py]")]
  node_llm_query["Model evidence query<br/>[llm_query.py]"]
end

subgraph group_specialized["Specialized checks"]
  node_fiqh_route["Fiqh API<br/>[fiqh.py]"]
  node_fiqh[("Fiqh checker<br/>[fiqh.py]")]
  node_ocr_route["OCR API<br/>[ocr.py]"]
  node_ocr["OCR service<br/>[ocr.py]"]
  node_dorar_route["Dorar API<br/>[dorar.py]"]
  node_dorar["Dorar lookup<br/>[dorar.py]"]
  node_tafsir_route["Tafsir API<br/>[tafsir.py]"]
  node_tafsir["Tafsir service<br/>[tafsir.py]"]
end

subgraph group_shared["Shared services"]
  node_llm_extract["Model extraction<br/>[llm_extractor.py]"]
  node_levels["Content levels<br/>[levels.py]"]
  node_security["Request security<br/>[security.py]"]
  node_badge["Badge signing<br/>[badge.py]"]
end

node_reviewer(("Reviewer"))

node_reviewer -.->|"submits text"| node_review_ui
node_review_ui -.->|"requests review"| node_verify_route
node_app -->|"registers route"| node_verify_route
node_app -->|"registers route"| node_check_route
node_app -->|"registers route"| node_claim_route
node_app -->|"registers route"| node_fiqh_route
node_app -->|"registers route"| node_ocr_route
node_app -->|"registers route"| node_dorar_route
node_app -->|"registers route"| node_tafsir_route
node_app -->|"registers route"| node_badge_route
node_verify_route -->|"runs verification"| node_pipeline
node_pipeline -->|"verifies text"| node_verifier
node_pipeline -->|"locates quotes"| node_quote_finder
node_pipeline -->|"extracts claims"| node_llm_extract
node_pipeline -->|"assigns levels"| node_levels
node_check_route -->|"checks passage"| node_text_claims
node_text_claims -->|"checks claims"| node_claim_card
node_text_claims -->|"checks fiqh"| node_fiqh
node_claim_route -->|"assesses claim"| node_claim_card
node_claim_card -->|"gathers evidence"| node_evidence_card
node_claim_card -->|"checks ruling"| node_fiqh
node_evidence_card -->|"searches corpus"| node_evidence_index
node_evidence_card -->|"recalls candidates"| node_llm_query
node_fiqh_route -->|"checks ruling"| node_fiqh
node_ocr_route -->|"processes image"| node_ocr
node_ocr_route -->|"verifies extracted text"| node_pipeline
node_dorar_route -->|"looks up gradings"| node_dorar
node_tafsir_route -->|"gets commentary"| node_tafsir
node_badge_route -->|"issues or checks"| node_badge
node_verify_route -->|"checks access"| node_security

click node_review_ui "https://github.com/uanu0/manba/blob/main/app/static/app.js"
click node_app "https://github.com/uanu0/manba/blob/main/app/main.py"
click node_verify_route "https://github.com/uanu0/manba/blob/main/app/routers/verify.py"
click node_check_route "https://github.com/uanu0/manba/blob/main/app/routers/check.py"
click node_claim_route "https://github.com/uanu0/manba/blob/main/app/routers/claim.py"
click node_pipeline "https://github.com/uanu0/manba/blob/main/app/services/pipeline.py"
click node_verifier "https://github.com/uanu0/manba/blob/main/app/services/verifier.py"
click node_quote_finder "https://github.com/uanu0/manba/blob/main/app/services/quote_finder.py"
click node_text_claims "https://github.com/uanu0/manba/blob/main/app/services/text_claims.py"
click node_claim_card "https://github.com/uanu0/manba/blob/main/app/services/claim_card.py"
click node_evidence_card "https://github.com/uanu0/manba/blob/main/app/services/evidence_card.py"
click node_evidence_index "https://github.com/uanu0/manba/blob/main/app/services/evidence.py"
click node_llm_query "https://github.com/uanu0/manba/blob/main/app/services/llm_query.py"
click node_fiqh_route "https://github.com/uanu0/manba/blob/main/app/routers/fiqh.py"
click node_fiqh "https://github.com/uanu0/manba/blob/main/app/services/fiqh.py"
click node_ocr_route "https://github.com/uanu0/manba/blob/main/app/routers/ocr.py"
click node_ocr "https://github.com/uanu0/manba/blob/main/app/services/ocr.py"
click node_dorar_route "https://github.com/uanu0/manba/blob/main/app/routers/dorar.py"
click node_dorar "https://github.com/uanu0/manba/blob/main/app/services/dorar.py"
click node_tafsir_route "https://github.com/uanu0/manba/blob/main/app/routers/tafsir.py"
click node_tafsir "https://github.com/uanu0/manba/blob/main/app/services/tafsir.py"
click node_llm_extract "https://github.com/uanu0/manba/blob/main/app/services/llm_extractor.py"
click node_levels "https://github.com/uanu0/manba/blob/main/app/services/levels.py"
click node_security "https://github.com/uanu0/manba/blob/main/app/security.py"
click node_badge_route "https://github.com/uanu0/manba/blob/main/app/routers/badge.py"
click node_badge "https://github.com/uanu0/manba/blob/main/app/services/badge.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_review_ui,node_app,node_verify_route,node_check_route,node_claim_route,node_badge_route,node_reviewer toneBlue
class node_pipeline,node_verifier,node_quote_finder toneAmber
class node_text_claims,node_claim_card,node_evidence_card,node_evidence_index,node_llm_query toneMint
class node_fiqh_route,node_fiqh,node_ocr_route,node_ocr,node_dorar_route,node_dorar,node_tafsir_route,node_tafsir toneRose
class node_llm_extract,node_levels,node_security,node_badge toneIndigo
```

## Components

### Entry and review

- [Reviewer UI](https://github.com/uanu0/manba/blob/main/app/static/app.js): `app/static/app.js`
- [FastAPI app](https://github.com/uanu0/manba/blob/main/app/main.py): `app/main.py`
- [Text verify API](https://github.com/uanu0/manba/blob/main/app/routers/verify.py): `app/routers/verify.py`
- [Paragraph check API](https://github.com/uanu0/manba/blob/main/app/routers/check.py): `app/routers/check.py`
- [Claim API](https://github.com/uanu0/manba/blob/main/app/routers/claim.py): `app/routers/claim.py`
- [Badge API](https://github.com/uanu0/manba/blob/main/app/routers/badge.py): `app/routers/badge.py`

### Text verification

- [Text pipeline](https://github.com/uanu0/manba/blob/main/app/services/pipeline.py): `app/services/pipeline.py`
- [Corpus verifier](https://github.com/uanu0/manba/blob/main/app/services/verifier.py): `app/services/verifier.py`
- [Quote finder](https://github.com/uanu0/manba/blob/main/app/services/quote_finder.py): `app/services/quote_finder.py`

### Claims and evidence

- [Text claims](https://github.com/uanu0/manba/blob/main/app/services/text_claims.py): `app/services/text_claims.py`
- [Claim assessment](https://github.com/uanu0/manba/blob/main/app/services/claim_card.py): `app/services/claim_card.py`
- [Evidence search](https://github.com/uanu0/manba/blob/main/app/services/evidence_card.py): `app/services/evidence_card.py`
- [Keyword evidence](https://github.com/uanu0/manba/blob/main/app/services/evidence.py): `app/services/evidence.py`
- [Model evidence query](https://github.com/uanu0/manba/blob/main/app/services/llm_query.py): `app/services/llm_query.py`

### Specialized checks

- [Fiqh API](https://github.com/uanu0/manba/blob/main/app/routers/fiqh.py): `app/routers/fiqh.py`
- [Fiqh checker](https://github.com/uanu0/manba/blob/main/app/services/fiqh.py): `app/services/fiqh.py`
- [OCR API](https://github.com/uanu0/manba/blob/main/app/routers/ocr.py): `app/routers/ocr.py`
- [OCR service](https://github.com/uanu0/manba/blob/main/app/services/ocr.py): `app/services/ocr.py`
- [Dorar API](https://github.com/uanu0/manba/blob/main/app/routers/dorar.py): `app/routers/dorar.py`
- [Dorar lookup](https://github.com/uanu0/manba/blob/main/app/services/dorar.py): `app/services/dorar.py`
- [Tafsir API](https://github.com/uanu0/manba/blob/main/app/routers/tafsir.py): `app/routers/tafsir.py`
- [Tafsir service](https://github.com/uanu0/manba/blob/main/app/services/tafsir.py): `app/services/tafsir.py`

### Shared services

- [Model extraction](https://github.com/uanu0/manba/blob/main/app/services/llm_extractor.py): `app/services/llm_extractor.py`
- [Content levels](https://github.com/uanu0/manba/blob/main/app/services/levels.py): `app/services/levels.py`
- [Request security](https://github.com/uanu0/manba/blob/main/app/security.py): `app/security.py`
- [Badge signing](https://github.com/uanu0/manba/blob/main/app/services/badge.py): `app/services/badge.py`

### Other components

- **Reviewer**

## Connections

- Reviewer → Reviewer UI: submits text
- Reviewer UI → Text verify API: requests review
- FastAPI app → Text verify API: registers route (evidence: `app/main.py`)
- FastAPI app → Paragraph check API: registers route (evidence: `app/main.py`)
- FastAPI app → Claim API: registers route (evidence: `app/main.py`)
- FastAPI app → Fiqh API: registers route (evidence: `app/main.py`)
- FastAPI app → OCR API: registers route (evidence: `app/main.py`)
- FastAPI app → Dorar API: registers route (evidence: `app/main.py`)
- FastAPI app → Tafsir API: registers route (evidence: `app/main.py`)
- FastAPI app → Badge API: registers route (evidence: `app/main.py`)
- Text verify API → Text pipeline: runs verification (evidence: `app/routers/verify.py`)
- Text pipeline → Corpus verifier: verifies text (evidence: `app/services/pipeline.py`)
- Text pipeline → Quote finder: locates quotes (evidence: `app/services/pipeline.py`)
- Text pipeline → Model extraction: extracts claims (evidence: `app/services/pipeline.py`)
- Text pipeline → Content levels: assigns levels (evidence: `app/services/pipeline.py`)
- Paragraph check API → Text claims: checks passage (evidence: `app/routers/check.py`)
- Text claims → Claim assessment: checks claims (evidence: `app/services/text_claims.py`)
- Text claims → Fiqh checker: checks fiqh (evidence: `app/services/text_claims.py`)
- Claim API → Claim assessment: assesses claim (evidence: `app/routers/claim.py`)
- Claim assessment → Evidence search: gathers evidence (evidence: `app/services/claim_card.py`)
- Claim assessment → Fiqh checker: checks ruling (evidence: `app/services/claim_card.py`)
- Evidence search → Keyword evidence: searches corpus (evidence: `app/services/evidence_card.py`)
- Evidence search → Model evidence query: recalls candidates (evidence: `app/services/evidence_card.py`)
- Fiqh API → Fiqh checker: checks ruling (evidence: `app/routers/fiqh.py`)
- OCR API → OCR service: processes image (evidence: `app/routers/ocr.py`)
- OCR API → Text pipeline: verifies extracted text (evidence: `app/routers/ocr.py`)
- Dorar API → Dorar lookup: looks up gradings (evidence: `app/routers/dorar.py`)
- Tafsir API → Tafsir service: gets commentary (evidence: `app/routers/tafsir.py`)
- Badge API → Badge signing: issues or checks (evidence: `app/routers/badge.py`)
- Text verify API → Request security: checks access (evidence: `app/routers/verify.py`)
