# didar-ali-deed/identity-verification-system architecture

> Architecture diagram of the GitHub repository didar-ali-deed/identity-verification-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/didar-ali-deed/identity-verification-system
- Repository: https://github.com/didar-ali-deed/identity-verification-system

## Overview

Identity Verification System accepts document and selfie evidence, runs an explainable ten-stage verification, and presents the resulting status and evidence to applicants and reviewers. The main path is browser submission → authenticated API and owned application → queued verification → staged decision and persisted evidence → applicant status or auditable admin review. The README also documents mobile capture, draft replacement, replay safeguards, and the standalone synthetic demo. Edges are limited to relationships shown in excerpts, the source index, or README; unsampled subsystems are represented at directory level where appropriate.

Main entry points: [`backend/app/services/pipeline/orchestrator.py`](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/orchestrator.py) (Pipeline orchestrator), [`frontend/src/App.tsx`](https://github.com/didar-ali-deed/identity-verification-system/blob/main/frontend/src/App.tsx) (Web application), [`backend/app/api/idv.py`](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/api/idv.py) (Verification routes), [`backend/app/database.py`](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/database.py) (Application database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Applicant and reviewer experience"]
  node_web_app["Web application<br/>[App.tsx]"]
  node_submission["Document submission<br/>[IDVSubmission.tsx]"]
  node_status_view["Status and evidence<br/>[IDVStatus.tsx]"]
  node_admin_view["Review dashboard<br/>[AdminDashboard.tsx]"]
  node_demo["Synthetic demo<br/>[Demo.tsx]"]
end

subgraph group_api["Identity API"]
  node_api_entry["FastAPI entry<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_auth_service["Authentication service<br/>[auth_service.py]"]
  node_idv_routes["Verification routes<br/>[idv.py]"]
  node_admin_routes["Admin review routes<br/>[admin.py]"]
  node_idv_service["Application service<br/>[idv_service.py]"]
end

subgraph group_verification["Verification pipeline"]
  node_worker["Verification worker<br/>[verification.py]"]
  node_acceptance["Document acceptance"]
  node_liveness["Liveness screening"]
  node_extraction["OCR extraction"]
  node_normalization["Field normalization"]
  node_internal_checks["Fraud and watchlist"]
  node_similarity["Identity comparisons"]
  node_decision["Scoring and decision<br/>[stage_6_scoring.py]"]
  node_result_stage["Result recording<br/>[stage_9_result.py]"]
  node_orchestrator["Pipeline orchestrator<br/>[orchestrator.py]"]
  node_ocr["OCR engine<br/>[ocr_service.py]"]
  node_face["Face verification<br/>[face_service.py]"]
  node_liveness_engine["Passive liveness"]
end

subgraph group_state["Evidence and persistence"]
  node_outbox["Task outbox<br/>[task_outbox.py]"]
  node_storage["Private file storage<br/>[storage.py]"]
  node_database[("Application database<br/>[database.py]")]
  node_uploads[("Document and selfie files")]
  node_pipeline_evidence[("Pipeline evidence model<br/>[pipeline_result.py]")]
end

node_applicant(("Applicant"))
node_reviewer(("Reviewer"))
node_postgres[("PostgreSQL")]
node_redis[("Redis broker")]

node_applicant -->|"uses"| node_web_app
node_web_app -->|"routes to"| node_submission
node_applicant -->|"submits evidence"| node_submission
node_submission -->|"uploads"| node_idv_routes
node_web_app -->|"routes to"| node_status_view
node_web_app -->|"routes to"| node_admin_view
node_reviewer -->|"reviews"| node_admin_view
node_web_app -->|"routes to"| node_demo
node_api_entry -->|"registers"| node_auth_routes
node_api_entry -->|"registers"| node_idv_routes
node_api_entry -->|"registers"| node_admin_routes
node_auth_routes -->|"calls"| node_auth_service
node_auth_service -->|"queries users"| node_database
node_idv_routes -->|"calls"| node_idv_service
node_idv_routes -.->|"handles files"| node_storage
node_idv_service -.->|"stores applications"| node_database
node_idv_service -.->|"dispatches jobs"| node_outbox
node_outbox -->|"queues tasks"| node_redis
node_redis -->|"dispatches task"| node_worker
node_worker -.->|"runs pipeline"| node_orchestrator
node_orchestrator -->|"runs stage"| node_acceptance
node_orchestrator -->|"runs stage"| node_liveness
node_orchestrator -->|"runs stage"| node_extraction
node_orchestrator -->|"runs stage"| node_normalization
node_orchestrator -->|"runs stage"| node_internal_checks
node_orchestrator -->|"runs stage"| node_similarity
node_orchestrator -->|"runs stages"| node_decision
node_orchestrator -->|"runs stage"| node_result_stage
node_orchestrator -->|"uses"| node_ocr
node_extraction -->|"extracts text"| node_ocr
node_liveness -->|"checks face"| node_face
node_liveness -->|"checks frames"| node_liveness_engine
node_orchestrator -->|"loads evidence"| node_storage
node_storage -->|"reads and writes"| node_uploads
node_result_stage -.->|"records result"| node_pipeline_evidence
node_pipeline_evidence -.->|"persists evidence"| node_database
node_database -->|"connects"| node_postgres
node_admin_routes -->|"reads review data"| node_database
node_admin_routes -->|"serializes result"| node_pipeline_evidence
node_status_view -.->|"reads status"| node_idv_routes
node_admin_view -.->|"requests review"| node_admin_routes

click node_web_app "https://github.com/didar-ali-deed/identity-verification-system/blob/main/frontend/src/App.tsx"
click node_submission "https://github.com/didar-ali-deed/identity-verification-system/blob/main/frontend/src/pages/IDVSubmission.tsx"
click node_status_view "https://github.com/didar-ali-deed/identity-verification-system/blob/main/frontend/src/pages/IDVStatus.tsx"
click node_admin_view "https://github.com/didar-ali-deed/identity-verification-system/blob/main/frontend/src/pages/AdminDashboard.tsx"
click node_demo "https://github.com/didar-ali-deed/identity-verification-system/blob/main/frontend/src/pages/Demo.tsx"
click node_api_entry "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/api/auth.py"
click node_auth_service "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/auth_service.py"
click node_idv_routes "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/api/idv.py"
click node_admin_routes "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/api/admin.py"
click node_idv_service "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/idv_service.py"
click node_outbox "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/task_outbox.py"
click node_worker "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/tasks/verification.py"
click node_acceptance "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_0_acceptance.py"
click node_liveness "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_1_liveness.py"
click node_extraction "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_2_extraction.py"
click node_normalization "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_3_normalization.py"
click node_internal_checks "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_4_internal_checks.py"
click node_similarity "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_5_similarity.py"
click node_decision "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_6_scoring.py"
click node_result_stage "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_9_result.py"
click node_orchestrator "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/orchestrator.py"
click node_ocr "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/ocr_service.py"
click node_face "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/face_service.py"
click node_liveness_engine "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/passive_liveness.py"
click node_storage "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/utils/storage.py"
click node_database "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/database.py"
click node_pipeline_evidence "https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/models/pipeline_result.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_web_app,node_submission,node_status_view,node_admin_view,node_demo,node_reviewer toneBlue
class node_api_entry,node_auth_routes,node_auth_service,node_idv_routes,node_admin_routes,node_idv_service,node_postgres,node_redis toneAmber
class node_worker,node_acceptance,node_liveness,node_extraction,node_normalization,node_internal_checks,node_similarity,node_decision,node_result_stage,node_orchestrator,node_ocr,node_face,node_liveness_engine toneMint
class node_outbox,node_storage,node_database,node_uploads,node_pipeline_evidence toneRose
class node_applicant toneIndigo
```

## Components

### Applicant and reviewer experience

- [Web application](https://github.com/didar-ali-deed/identity-verification-system/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Document submission](https://github.com/didar-ali-deed/identity-verification-system/blob/main/frontend/src/pages/IDVSubmission.tsx): `frontend/src/pages/IDVSubmission.tsx`
- [Status and evidence](https://github.com/didar-ali-deed/identity-verification-system/blob/main/frontend/src/pages/IDVStatus.tsx): `frontend/src/pages/IDVStatus.tsx`
- [Review dashboard](https://github.com/didar-ali-deed/identity-verification-system/blob/main/frontend/src/pages/AdminDashboard.tsx): `frontend/src/pages/AdminDashboard.tsx`
- [Synthetic demo](https://github.com/didar-ali-deed/identity-verification-system/blob/main/frontend/src/pages/Demo.tsx): `frontend/src/pages/Demo.tsx`

### Identity API

- [FastAPI entry](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Authentication service](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [Verification routes](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/api/idv.py): `backend/app/api/idv.py`
- [Admin review routes](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/api/admin.py): `backend/app/api/admin.py`
- [Application service](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/idv_service.py): `backend/app/services/idv_service.py`

### Verification pipeline

- [Verification worker](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/tasks/verification.py): `backend/app/tasks/verification.py`
- [Document acceptance](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_0_acceptance.py): `backend/app/services/pipeline/stage_0_acceptance.py`
- [Liveness screening](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_1_liveness.py): `backend/app/services/pipeline/stage_1_liveness.py`
- [OCR extraction](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_2_extraction.py): `backend/app/services/pipeline/stage_2_extraction.py`
- [Field normalization](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_3_normalization.py): `backend/app/services/pipeline/stage_3_normalization.py`
- [Fraud and watchlist](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_4_internal_checks.py): `backend/app/services/pipeline/stage_4_internal_checks.py`
- [Identity comparisons](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_5_similarity.py): `backend/app/services/pipeline/stage_5_similarity.py`
- [Scoring and decision](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_6_scoring.py): `backend/app/services/pipeline/stage_6_scoring.py`
- [Result recording](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/stage_9_result.py): `backend/app/services/pipeline/stage_9_result.py`
- [Pipeline orchestrator](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/pipeline/orchestrator.py): `backend/app/services/pipeline/orchestrator.py`
- [OCR engine](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/ocr_service.py): `backend/app/services/ocr_service.py`
- [Face verification](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/face_service.py): `backend/app/services/face_service.py`
- [Passive liveness](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/passive_liveness.py): `backend/app/services/passive_liveness.py`

### Evidence and persistence

- [Task outbox](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/services/task_outbox.py): `backend/app/services/task_outbox.py`
- [Private file storage](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/utils/storage.py): `backend/app/utils/storage.py`
- [Application database](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/database.py): `backend/app/database.py`
- **Document and selfie files**
- [Pipeline evidence model](https://github.com/didar-ali-deed/identity-verification-system/blob/main/backend/app/models/pipeline_result.py): `backend/app/models/pipeline_result.py`

### Other components

- **Applicant**
- **Reviewer**
- **PostgreSQL**
- **Redis broker**

## Connections

- Applicant → Web application: uses (evidence: `README.md`)
- Web application → Document submission: routes to (evidence: `frontend/src/App.tsx`)
- Applicant → Document submission: submits evidence (evidence: `README.md`)
- Document submission → Verification routes: uploads (evidence: `README.md`)
- Web application → Status and evidence: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Review dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Reviewer → Review dashboard: reviews (evidence: `README.md`)
- Web application → Synthetic demo: routes to (evidence: `frontend/src/App.tsx`)
- FastAPI entry → Authentication routes: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Verification routes: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Admin review routes: registers (evidence: `backend/app/main.py`)
- Authentication routes → Authentication service: calls (evidence: `backend/app/api/auth.py`)
- Authentication service → Application database: queries users (evidence: `backend/app/services/auth_service.py`)
- Verification routes → Application service: calls (evidence: `backend/app/api/idv.py`)
- Verification routes → Private file storage: handles files
- Application service → Application database: stores applications
- Application service → Task outbox: dispatches jobs (evidence: `README.md`)
- Task outbox → Redis broker: queues tasks (evidence: `README.md`)
- Redis broker → Verification worker: dispatches task (evidence: `README.md`)
- Verification worker → Pipeline orchestrator: runs pipeline (evidence: `README.md`)
- Pipeline orchestrator → Document acceptance: runs stage (evidence: `backend/app/services/pipeline/orchestrator.py`)
- Pipeline orchestrator → Liveness screening: runs stage (evidence: `backend/app/services/pipeline/orchestrator.py`)
- Pipeline orchestrator → OCR extraction: runs stage (evidence: `backend/app/services/pipeline/orchestrator.py`)
- Pipeline orchestrator → Field normalization: runs stage (evidence: `backend/app/services/pipeline/orchestrator.py`)
- Pipeline orchestrator → Fraud and watchlist: runs stage (evidence: `backend/app/services/pipeline/orchestrator.py`)
- Pipeline orchestrator → Identity comparisons: runs stage (evidence: `backend/app/services/pipeline/orchestrator.py`)
- Pipeline orchestrator → Scoring and decision: runs stages (evidence: `backend/app/services/pipeline/orchestrator.py`)
- Pipeline orchestrator → Result recording: runs stage (evidence: `backend/app/services/pipeline/orchestrator.py`)
- Pipeline orchestrator → OCR engine: uses (evidence: `backend/app/services/pipeline/orchestrator.py`)
- OCR extraction → OCR engine: extracts text (evidence: `backend/app/services/pipeline/stage_2_extraction.py`)
- Liveness screening → Face verification: checks face (evidence: `backend/app/services/pipeline/stage_1_liveness.py`)
- Liveness screening → Passive liveness: checks frames (evidence: `backend/app/services/pipeline/stage_1_liveness.py`)
- Pipeline orchestrator → Private file storage: loads evidence (evidence: `backend/app/services/pipeline/orchestrator.py`)
- Private file storage → Document and selfie files: reads and writes (evidence: `backend/app/utils/storage.py`)
- Result recording → Pipeline evidence model: records result
- Pipeline evidence model → Application database: persists evidence (evidence: `backend/app/models/pipeline_result.py`)
- Application database → PostgreSQL: connects (evidence: `backend/app/database.py`)
- Admin review routes → Application database: reads review data (evidence: `backend/app/api/admin.py`)
- Admin review routes → Pipeline evidence model: serializes result (evidence: `backend/app/api/admin.py`)
- Status and evidence → Verification routes: reads status
- Review dashboard → Admin review routes: requests review
