# Architecture and Components

### 🏗️ KYC Architecture and Components

#### 📊 KYC Architecture Diagram

![](https://1453876250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRr3zB0xucM3fgCViuJqz%2Fuploads%2FRxD9N3Cd5nkof5O13QKC%2Focr2.jpg?alt=media\&token=a3670168-5ab7-4620-9240-cabc59375c24)

***

#### 🏛️ KYC Architecture and Components

The KYC (Know Your Customer) system is a modular platform for automated identity verification based on uploaded document images, selfies, and other sources. The system architecture flexibly adapts to various business scenarios and requirements — from banking and fintech to marketplaces and government services.

**Supported scenarios:**

* **Document** — the user uploads a photo of a passport, ID card, or other identification document.
* **Selfie with document** — verifying the match between the user's face and the document photo.
* **Selfie** — verification using a single face image.
* **Liveness check** — confirming that a live person is in front of the camera, not a photo or forgery.
* **Combined scenarios** — e.g., document + selfie with document + liveness.

**Component purpose:**

Each KYC component is responsible for a specific stage of processing and verification:

* **Document image processing**: detection, alignment, classification, and segmentation of the document into fields (photo, name, dates, etc.).
* **Text recognition (OCR)**: extracting data and validating checksums.
* **Face image analysis**: comparing the face to the document photo, estimating age and gender.
* **Anti‑fraud mechanisms**: detecting photocopies, screenshots, Photoshop edits, screen captures, physical wear.
* **Liveness check**: detecting whether a living person is in front of the camera.
* **External database integrations**: checking the document and user against police, bailiff, and blacklist databases.
* **Decision Engine**: the final stage, where all results are aggregated and a final decision is formed: “Approved”, “Rejected”, or “Manual review required”.

Thus, the KYC architecture is built around a set of independent, scalable, and interconnected modules that allow it to quickly adapt to any verification scenario.

***

## 🗂️ Architecture and Module Interaction

Text diagram of the typical DOCUMENT + SELFIE WITH DOCUMENT workflow

<details>

<summary>Text diagram of the typical DOCUMENT + SELFIE WITH DOCUMENT workflow</summary>

```
User sends images (document + selfie with document) via WebSDK/API
                                  |
                                  v
                           +---------------+
                           |  API Gateway  |
                           +-------+-------+
                                   |
      +--------------+-------------+-------------+-------------+
      |              |             |             |             |
      v              v             v             v             v
+------------+ +-------------+ +----------------+ +----------------+
|  Document  | |  Selfie     | | Liveness Check | | External       |
|  Detector  | |  Detector   | |                | | Databases      |
|(doc image) | |(selfie+doc) | |                | | (police, etc.) |
+-------+----+ +-------+-----+ +-----------+----+ +-----------+----+
        |              |                   |                  |
        v              v                   |                  |
+-----------------+ +-------------------+  |                  |
|Quality Check    | |Selfie Verification|  |                  |
|(format, size,   | | - Face Matching   |  |                  |
| lighting, align)| | - Gender, age     |  |                  |
+-------+---------+ | - Doc detector    |  |                  |
        |           |                   |  |                  |
        v           |                   |  |                  |
+-----------------+ +---------+---------+  |                  |
|Document Type    |           |            |                  |
|Classification   |           |            |                  |
+-------+---------+           |            |                  |
        |                     |            |                  |
        +-----------+         |            |                  |
        |           |         |            |                  |
        v           v         v            v                  v
+-------------+ +-----------------+ +---------------+ +--------------+
|Segmentation | |Antifraud Checks | |Liveness Result| |External Check|
|(fields, doc | |(screens, copies,| |               | |Results       |
|photo, stamp)| | editors, wear,  | +--------+------+ +-------+------+
+-----+-------+ | logic)          |          |                |
      |         +-----------------+          |                |
      v                                      |                |
+-------------+                              |                |
|    OCR      |                              |                |
|(text, MRZ,  |                              |                |
|tampering)   |                              |                |
+-----+-------+                              |                |
      |                                      |                |
      +-------------+------------------------+----------------+
                    |
                    v
             +----------------+
             | Decision Engine|
             | (Final Decision)|
             +--------+-------+
                      |
                      v
             +--------------+
             |   Result     |
             | (Approved /  |
             | Rejected /   |
             |Manual Review)|
             +------+-------+
                    |
                    v
             +--------------+
             |  API Gateway |
             +-------+------+
                     |
                     v
                    User
```

</details>

***

### 1. Document Detector

Responsible for detecting the presence of a document in the image, validating quality, and preparing it for further processing.

**Functions:**

* File format validation (JPEG, PNG)
* Image size and resolution check
* Lighting and shadow check
* Document alignment and normalization

***

### 2. Selfie with Document Detector

Responsible for verifying the selfie with document, matching identity, and detecting fraud attempts.

**Functions:**

* Face Matching between selfie and document photo
* Age and gender consistency check
* Detection of screen images (photo of a monitor/phone)
* Detection of graphic editor traces
* Detection of photocopies/prints
* Document detection in selfie and document type identification

***

### 3. Liveness Check

Responsible for confirming that a live human is in front of the camera. The module analyzes face behavior, skin texture, micro‑movements, and signs of real presence.

**Functions:**

* Analysis of image sequences or video for liveness signals
* Rejection of photos or screen captures
* **Deepfake detection** — identifying manipulated or AI‑generated face images
* **Detection of fully synthetic images** (GAN/Stable Diffusion/FaceApp etc.)

***

### 4. External Database Verification

Responsible for checking the user against official registries, government databases, financial datasets, and sanctions lists.

**Functions include:**

* **Document & identity checks**
  * Passport validity check
  * Driver license verification
  * Passport validity checks (number verification, lost/stolen database)
* **Debts & financial checks**
  * Court Enforcement Office debt search
  * IRS/ HMRC tax liabilities
  * Self-employment tax status (IRS Schedule SE / HMRC Self Assessment)
  * Credit bureau score (Equifax / Experian / TransUnion)
  * Short-term loan default risk score
  * Mortgage and lien records search
  * Phone number activity & carrier history
  * Name-to-phone reverse lookup validation
* **Legal and judicial checks**
  * U.S. Bankruptcy Register / UK Insolvency Register
  * Commercial court cases (UK: High Court / US: Commercial Division)
  * Civil and criminal court cases
  * Register of company directors (Companies House / SEC records)
  * Corporate affiliation records (SEC/Companies House)
  * Wanted lists: FBI / U.S. Marshals Service / HM Prison & Probation Service
* **Identity data checks**
  * Social Security Number (SSN) ↔ full name validation
  * Taxpayer Identification Number (TIN) lookup by name & ID
  * Email ↔ Full name correspondence check
  * Phone number ownership check
* **Sanctions & restrictions**
  * Terrorist lists
  * Sanctions lists (EU, UK, OFAC, UN)
  * Frozen business accounts (IRS/OFAC compliance)
  * Foreign Agents Registration Act (FARA) register
  * Child support debtors (Federal Office of Child Support Enforcement)

***

### 5. Document Classification & Segmentation

Responsible for determining the document type and extracting important regions.

**Functions:**

* Document type classification (passport, driver license, ID card, etc.)
* Segmentation into fields (photo, text areas, stamps, signatures)

***

### 6. OCR & Field Verification

Recognizes the text and validates authenticity.

**Functions:**

* OCR text extraction
* Detection of tampering (inserted/replaced fields)
* MRZ checksum verification

***

### 7. Document Antifraud Checks

Responsible for identifying attempts to forge or alter the document.

**Functions:**

* Detection of screen images
* Detection of photocopies/printed documents
* Graphic editor manipulation detection
* Document wear/damage detection
* Logical consistency validation (dates, numbers, series)

***

### 8. Decision Engine

Aggregates all results and produces the final KYC decision.

**Functions:**

* Collecting outputs from all modules
* Producing final status: “Approved”, “Rejected”, “Manual review”
* Returning error codes and diagnostic descriptions

***
