# dhruviltech/docshield-ai architecture

> Architecture diagram of the GitHub repository dhruviltech/docshield-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/dhruviltech/docshield-ai
- Repository: https://github.com/dhruviltech/docshield-ai

## Overview

DocShield AI is an enterprise identity and document-screening platform: an officer uses the web application to submit credentials, then the backend processes them and presents verification and risk results. The documented domain stages include OCR and field extraction, document validation and watchlist checks, tampering forensics, face matching and liveness, and screening/risk aggregation. The backend also handles encrypted document storage, audit, and organization workflows. Source excerpts show key orchestration and persistence calls; several cross-service and UI-to-API links are documented capabilities rather than inspected call sites, so those links are marked dashed.

Main entry points: [`backend/src/services/processingPipeline.service.js`](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/processingPipeline.service.js) (Processing Pipeline), [`AI/app.py`](https://github.com/dhruviltech/docshield-ai/blob/main/AI/app.py) (AI API), [`backend/src/services/verification/verificationPipeline.service.js`](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/verification/verificationPipeline.service.js) (Verification Pipeline), [`backend/src/services/ai/aiAnalysis.service.js`](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/ai/aiAnalysis.service.js) (AI Analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Screening UI"]
  node_webapp["Web Application<br/>[App.tsx]"]
  node_docui["Document Screening UI<br/>[index.tsx]"]
end

subgraph group_backend["Backend Workflows"]
  node_routes["Document Routes<br/>[document.routes.js]"]
  node_doccontroller["Document Controller"]
  node_processing["Processing Pipeline"]
  node_verification["Verification Pipeline"]
  node_extract["Document Extraction"]
  node_aianalysis["AI Analysis"]
  node_tampering["Tampering Detection"]
  node_faceverify["Face Verification"]
  node_screening["Screening Verdict"]
  node_risk["Risk Scoring"]
end

subgraph group_records["Records and Security"]
  node_storage["Encrypted Storage<br/>[storage.service.js]"]
  node_repositories[("Screening Records")]
  node_audit["Audit Service<br/>[audit.service.js]"]
end

subgraph group_ai["AI Screening Engine"]
  node_aiapp["AI API<br/>[app.py]"]
  node_ocr["OCR and Extraction<br/>[service.py]"]
  node_validation["Document Validation<br/>[service.py]"]
  node_forensic["Forensic Pipeline<br/>[pipeline.py]"]
  node_fusion["Evidence Fusion<br/>[engine.py]"]
  node_biometrics["Face Biometrics<br/>[service.py]"]
end

node_officer(("Screening Officer"))

node_officer -.->|"uses"| node_webapp
node_webapp -->|"routes to"| node_docui
node_docui -.->|"submits document"| node_routes
node_routes -->|"dispatches"| node_doccontroller
node_doccontroller -.->|"starts processing"| node_processing
node_processing -->|"extracts fields"| node_extract
node_processing -->|"stores document"| node_storage
node_processing -->|"persists job and extraction"| node_repositories
node_processing -->|"runs analysis"| node_aianalysis
node_processing -->|"checks tampering"| node_tampering
node_processing -->|"verifies face"| node_faceverify
node_processing -->|"runs screening"| node_screening
node_processing -->|"logs outcome"| node_audit
node_verification -->|"runs analysis"| node_aianalysis
node_verification -->|"calculates risk"| node_risk
node_verification -->|"aggregates verdict"| node_screening
node_aianalysis -.->|"requests AI screening"| node_aiapp
node_aiapp -->|"routes OCR requests"| node_ocr
node_aiapp -->|"routes validation requests"| node_validation
node_aiapp -->|"routes forensic requests"| node_forensic
node_aiapp -->|"routes face requests"| node_biometrics
node_forensic -->|"fuses detector evidence"| node_fusion

click node_webapp "https://github.com/dhruviltech/docshield-ai/blob/main/frontend/src/App.tsx"
click node_docui "https://github.com/dhruviltech/docshield-ai/blob/main/frontend/src/pages/Scanner/index.tsx"
click node_routes "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/routes/document.routes.js"
click node_doccontroller "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/controllers/document.controller.js"
click node_processing "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/processingPipeline.service.js"
click node_verification "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/verification/verificationPipeline.service.js"
click node_extract "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/extractors/documentExtractor.js"
click node_aianalysis "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/ai/aiAnalysis.service.js"
click node_tampering "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/tampering/tamperingDetector.service.js"
click node_faceverify "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/faceVerification/faceVerification.service.js"
click node_screening "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/screening/screening.service.js"
click node_risk "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/risk/riskScore.service.js"
click node_storage "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/storage.service.js"
click node_repositories "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/repositories/document.repository.js"
click node_audit "https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/audit.service.js"
click node_aiapp "https://github.com/dhruviltech/docshield-ai/blob/main/AI/app.py"
click node_ocr "https://github.com/dhruviltech/docshield-ai/blob/main/AI/document_detection/ocr/service.py"
click node_validation "https://github.com/dhruviltech/docshield-ai/blob/main/AI/document_detection/validation/service.py"
click node_forensic "https://github.com/dhruviltech/docshield-ai/blob/main/AI/image_tampering/forensic/pipeline.py"
click node_fusion "https://github.com/dhruviltech/docshield-ai/blob/main/AI/image_tampering/fusion/engine.py"
click node_biometrics "https://github.com/dhruviltech/docshield-ai/blob/main/AI/face/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_webapp,node_docui,node_officer toneBlue
class node_routes,node_doccontroller,node_processing,node_verification,node_extract,node_aianalysis,node_tampering,node_faceverify,node_screening,node_risk toneAmber
class node_storage,node_repositories,node_audit toneMint
class node_aiapp,node_ocr,node_validation,node_forensic,node_fusion,node_biometrics toneRose
```

## Components

### Screening UI

- [Web Application](https://github.com/dhruviltech/docshield-ai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Document Screening UI](https://github.com/dhruviltech/docshield-ai/blob/main/frontend/src/pages/Scanner/index.tsx): `frontend/src/pages/Scanner/index.tsx`

### Backend Workflows

- [Document Routes](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/routes/document.routes.js): `backend/src/routes/document.routes.js`
- [Document Controller](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/controllers/document.controller.js): `backend/src/controllers/document.controller.js`
- [Processing Pipeline](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/processingPipeline.service.js): `backend/src/services/processingPipeline.service.js`
- [Verification Pipeline](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/verification/verificationPipeline.service.js): `backend/src/services/verification/verificationPipeline.service.js`
- [Document Extraction](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/extractors/documentExtractor.js): `backend/src/services/extractors/documentExtractor.js`
- [AI Analysis](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/ai/aiAnalysis.service.js): `backend/src/services/ai/aiAnalysis.service.js`
- [Tampering Detection](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/tampering/tamperingDetector.service.js): `backend/src/services/tampering/tamperingDetector.service.js`
- [Face Verification](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/faceVerification/faceVerification.service.js): `backend/src/services/faceVerification/faceVerification.service.js`
- [Screening Verdict](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/screening/screening.service.js): `backend/src/services/screening/screening.service.js`
- [Risk Scoring](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/risk/riskScore.service.js): `backend/src/services/risk/riskScore.service.js`

### Records and Security

- [Encrypted Storage](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/storage.service.js): `backend/src/services/storage.service.js`
- [Screening Records](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/repositories/document.repository.js): `backend/src/repositories/document.repository.js`
- [Audit Service](https://github.com/dhruviltech/docshield-ai/blob/main/backend/src/services/audit.service.js): `backend/src/services/audit.service.js`

### AI Screening Engine

- [AI API](https://github.com/dhruviltech/docshield-ai/blob/main/AI/app.py): `AI/app.py`
- [OCR and Extraction](https://github.com/dhruviltech/docshield-ai/blob/main/AI/document_detection/ocr/service.py): `AI/document_detection/ocr/service.py`
- [Document Validation](https://github.com/dhruviltech/docshield-ai/blob/main/AI/document_detection/validation/service.py): `AI/document_detection/validation/service.py`
- [Forensic Pipeline](https://github.com/dhruviltech/docshield-ai/blob/main/AI/image_tampering/forensic/pipeline.py): `AI/image_tampering/forensic/pipeline.py`
- [Evidence Fusion](https://github.com/dhruviltech/docshield-ai/blob/main/AI/image_tampering/fusion/engine.py): `AI/image_tampering/fusion/engine.py`
- [Face Biometrics](https://github.com/dhruviltech/docshield-ai/blob/main/AI/face/service.py): `AI/face/service.py`

### Other components

- **Screening Officer**

## Connections

- Screening Officer → Web Application: uses (evidence: `README.md`)
- Web Application → Document Screening UI: routes to (evidence: `frontend/src/App.tsx`)
- Document Screening UI → Document Routes: submits document (evidence: `README.md`)
- Document Routes → Document Controller: dispatches (evidence: `backend/src/routes/document.routes.js`)
- Document Controller → Processing Pipeline: starts processing (evidence: `backend/src/controllers/document.controller.js`)
- Processing Pipeline → Document Extraction: extracts fields (evidence: `backend/src/services/processingPipeline.service.js`)
- Processing Pipeline → Encrypted Storage: stores document (evidence: `backend/src/services/processingPipeline.service.js`)
- Processing Pipeline → Screening Records: persists job and extraction (evidence: `backend/src/services/processingPipeline.service.js`)
- Processing Pipeline → AI Analysis: runs analysis (evidence: `backend/src/services/processingPipeline.service.js`)
- Processing Pipeline → Tampering Detection: checks tampering (evidence: `backend/src/services/processingPipeline.service.js`)
- Processing Pipeline → Face Verification: verifies face (evidence: `backend/src/services/processingPipeline.service.js`)
- Processing Pipeline → Screening Verdict: runs screening (evidence: `backend/src/services/processingPipeline.service.js`)
- Processing Pipeline → Audit Service: logs outcome (evidence: `backend/src/services/processingPipeline.service.js`)
- Verification Pipeline → AI Analysis: runs analysis (evidence: `backend/src/services/verification/verificationPipeline.service.js`)
- Verification Pipeline → Risk Scoring: calculates risk (evidence: `backend/src/services/verification/verificationPipeline.service.js`)
- Verification Pipeline → Screening Verdict: aggregates verdict (evidence: `backend/src/services/verification/verificationPipeline.service.js`)
- AI Analysis → AI API: requests AI screening (evidence: `README.md`)
- AI API → OCR and Extraction: routes OCR requests (evidence: `AI/app.py`)
- AI API → Document Validation: routes validation requests (evidence: `AI/app.py`)
- AI API → Forensic Pipeline: routes forensic requests (evidence: `AI/app.py`)
- AI API → Face Biometrics: routes face requests (evidence: `AI/app.py`)
- Forensic Pipeline → Evidence Fusion: fuses detector evidence (evidence: `AI/image_tampering/forensic/pipeline.py`)
