# vaibhav11464/auth-x architecture

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

- Interactive diagram: https://gitdiagram.com/vaibhav11464/auth-x
- Repository: https://github.com/vaibhav11464/auth-x

## Overview

AuthX is a Flask identity-verification application. Users authenticate, enroll a face, then complete a Look step and a Speak step; the server measures face identity, liveness, voice and lip motion, combines evidence into a trust decision, and can issue a hash-linked certificate. Faculty and administrators also review sessions, while a separate public identification demo can compare a visitor with enrolled students without signing them in. The graph preserves these documented stages and the evidence, persistence and profile layers. Some route and service internals were not excerpted, so uncertain internal calls are omitted.

Main entry points: [`app/routes/verification.py`](https://github.com/vaibhav11464/auth-x/blob/master/app/routes/verification.py) (Look / Speak API), [`app/models.py`](https://github.com/vaibhav11464/auth-x/blob/master/app/models.py) (Accounts and sessions store), [`app/services/verification_profiles.py`](https://github.com/vaibhav11464/auth-x/blob/master/app/services/verification_profiles.py) (Verification profiles), [`app/routes/auth.py`](https://github.com/vaibhav11464/auth-x/blob/master/app/routes/auth.py) (Authentication API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and sessions"]
  node_auth_routes["Authentication API<br/>[auth.py]"]
  node_auth_guard["JWT and role guards<br/>[decorators.py]"]
  node_sessions["Session lifecycle"]
end

subgraph group_capture["Capture and scoring"]
  node_enrollment_route["Face enrollment API<br/>[face.py]"]
  node_enrollment["Enrollment processing<br/>[enrollment.py]"]
  node_verification_api["Look / Speak API<br/>[verification.py]"]
  node_profiles["Verification profiles"]
  node_face_quality["Face quality gates<br/>[face_quality.py]"]
  node_face_detector["Face detection<br/>[face_detector.py]"]
  node_voice_analysis["Voice and lip scoring<br/>[voice_detector.py]"]
  node_speech["Challenge-word speech<br/>[speech.py]"]
end

subgraph group_evidence["Evidence and records"]
  node_score["Trust and SAFE gates<br/>[risk_engine.py]"]
  node_decision_evidence["Decision evidence"]
  node_records[("Accounts and sessions store<br/>[models.py]")]
  node_certificates["Verification certificates<br/>[certificate.py]"]
end

subgraph group_views["User-facing flows"]
  node_identification_api["Identify API<br/>[identify.py]"]
  node_identification["Student matching<br/>[identification.py]"]
  node_pages["Student / faculty views<br/>[pages.py]"]
end

node_student(("Student"))
node_faculty(("Faculty / admin"))
node_visitor(("Demo visitor"))

node_student -->|"signs in"| node_auth_routes
node_auth_routes -->|"checks account"| node_records
node_auth_routes -->|"issues tokens"| node_auth_guard
node_student -->|"enrolls face"| node_enrollment_route
node_enrollment_route -->|"processes samples"| node_enrollment
node_enrollment -->|"checks quality"| node_face_quality
node_enrollment -.->|"stores enrollment"| node_records
node_student -->|"submits Look / Speak"| node_verification_api
node_verification_api -->|"checks access"| node_auth_guard
node_verification_api -->|"checks lifecycle"| node_sessions
node_verification_api -->|"scores steps"| node_profiles
node_verification_api -->|"reads / writes results"| node_records
node_profiles -->|"gates face frames"| node_face_quality
node_face_quality -->|"checks faces"| node_face_detector
node_profiles -.->|"scores voice"| node_voice_analysis
node_profiles -.->|"verifies challenge word"| node_speech
node_verification_api -.->|"fuses evidence"| node_score
node_score -->|"evaluates SAFE gates"| node_decision_evidence
node_decision_evidence -->|"checks stored word"| node_speech
node_verification_api -->|"issues certificate"| node_certificates
node_certificates -->|"reads certificate data"| node_records
node_faculty -->|"reviews sessions"| node_pages
node_pages -->|"reads session data"| node_records
node_visitor -->|"requests match"| node_identification_api
node_identification_api -->|"compares identity"| node_identification
node_identification -->|"detects faces"| node_face_detector
node_identification -->|"reads enrollments"| node_records
node_identification_api -->|"checks speech"| node_speech

click node_auth_routes "https://github.com/vaibhav11464/auth-x/blob/master/app/routes/auth.py"
click node_auth_guard "https://github.com/vaibhav11464/auth-x/blob/master/app/auth/decorators.py"
click node_sessions "https://github.com/vaibhav11464/auth-x/blob/master/app/services/session_lifecycle.py"
click node_enrollment_route "https://github.com/vaibhav11464/auth-x/blob/master/app/routes/face.py"
click node_enrollment "https://github.com/vaibhav11464/auth-x/blob/master/app/services/enrollment.py"
click node_verification_api "https://github.com/vaibhav11464/auth-x/blob/master/app/routes/verification.py"
click node_profiles "https://github.com/vaibhav11464/auth-x/blob/master/app/services/verification_profiles.py"
click node_face_quality "https://github.com/vaibhav11464/auth-x/blob/master/app/services/face_quality.py"
click node_face_detector "https://github.com/vaibhav11464/auth-x/blob/master/app/services/face_detector.py"
click node_voice_analysis "https://github.com/vaibhav11464/auth-x/blob/master/app/services/voice_detector.py"
click node_speech "https://github.com/vaibhav11464/auth-x/blob/master/app/services/speech.py"
click node_identification_api "https://github.com/vaibhav11464/auth-x/blob/master/app/routes/identify.py"
click node_identification "https://github.com/vaibhav11464/auth-x/blob/master/app/services/identification.py"
click node_score "https://github.com/vaibhav11464/auth-x/blob/master/app/services/risk_engine.py"
click node_decision_evidence "https://github.com/vaibhav11464/auth-x/blob/master/app/services/decision_evidence.py"
click node_records "https://github.com/vaibhav11464/auth-x/blob/master/app/models.py"
click node_certificates "https://github.com/vaibhav11464/auth-x/blob/master/app/services/certificate.py"
click node_pages "https://github.com/vaibhav11464/auth-x/blob/master/app/routes/pages.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_auth_routes,node_auth_guard,node_sessions toneBlue
class node_enrollment_route,node_enrollment,node_verification_api,node_profiles,node_face_quality,node_face_detector,node_voice_analysis,node_speech toneAmber
class node_score,node_decision_evidence,node_records,node_certificates toneMint
class node_identification_api,node_identification,node_pages toneRose
class node_student,node_faculty,node_visitor toneIndigo
```

## Components

### Access and sessions

- [Authentication API](https://github.com/vaibhav11464/auth-x/blob/master/app/routes/auth.py): `app/routes/auth.py`
- [JWT and role guards](https://github.com/vaibhav11464/auth-x/blob/master/app/auth/decorators.py): `app/auth/decorators.py`
- [Session lifecycle](https://github.com/vaibhav11464/auth-x/blob/master/app/services/session_lifecycle.py): `app/services/session_lifecycle.py`

### Capture and scoring

- [Face enrollment API](https://github.com/vaibhav11464/auth-x/blob/master/app/routes/face.py): `app/routes/face.py`
- [Enrollment processing](https://github.com/vaibhav11464/auth-x/blob/master/app/services/enrollment.py): `app/services/enrollment.py`
- [Look / Speak API](https://github.com/vaibhav11464/auth-x/blob/master/app/routes/verification.py): `app/routes/verification.py`
- [Verification profiles](https://github.com/vaibhav11464/auth-x/blob/master/app/services/verification_profiles.py): `app/services/verification_profiles.py`
- [Face quality gates](https://github.com/vaibhav11464/auth-x/blob/master/app/services/face_quality.py): `app/services/face_quality.py`
- [Face detection](https://github.com/vaibhav11464/auth-x/blob/master/app/services/face_detector.py): `app/services/face_detector.py`
- [Voice and lip scoring](https://github.com/vaibhav11464/auth-x/blob/master/app/services/voice_detector.py): `app/services/voice_detector.py`
- [Challenge-word speech](https://github.com/vaibhav11464/auth-x/blob/master/app/services/speech.py): `app/services/speech.py`

### Evidence and records

- [Trust and SAFE gates](https://github.com/vaibhav11464/auth-x/blob/master/app/services/risk_engine.py): `app/services/risk_engine.py`
- [Decision evidence](https://github.com/vaibhav11464/auth-x/blob/master/app/services/decision_evidence.py): `app/services/decision_evidence.py`
- [Accounts and sessions store](https://github.com/vaibhav11464/auth-x/blob/master/app/models.py): `app/models.py`
- [Verification certificates](https://github.com/vaibhav11464/auth-x/blob/master/app/services/certificate.py): `app/services/certificate.py`

### User-facing flows

- [Identify API](https://github.com/vaibhav11464/auth-x/blob/master/app/routes/identify.py): `app/routes/identify.py`
- [Student matching](https://github.com/vaibhav11464/auth-x/blob/master/app/services/identification.py): `app/services/identification.py`
- [Student / faculty views](https://github.com/vaibhav11464/auth-x/blob/master/app/routes/pages.py): `app/routes/pages.py`

### Other components

- **Student**
- **Faculty / admin**
- **Demo visitor**

## Connections

- Student → Authentication API: signs in (evidence: `README.md`)
- Authentication API → Accounts and sessions store: checks account (evidence: `app/routes/auth.py`)
- Authentication API → JWT and role guards: issues tokens (evidence: `app/routes/auth.py`)
- Student → Face enrollment API: enrolls face (evidence: `README.md`)
- Face enrollment API → Enrollment processing: processes samples (evidence: `app/routes/face.py`)
- Enrollment processing → Face quality gates: checks quality (evidence: `app/services/enrollment.py`)
- Enrollment processing → Accounts and sessions store: stores enrollment
- Student → Look / Speak API: submits Look / Speak (evidence: `README.md`)
- Look / Speak API → JWT and role guards: checks access (evidence: `app/routes/verification.py`)
- Look / Speak API → Session lifecycle: checks lifecycle (evidence: `app/routes/verification.py`)
- Look / Speak API → Verification profiles: scores steps (evidence: `app/routes/verification.py`)
- Look / Speak API → Accounts and sessions store: reads / writes results (evidence: `app/routes/verification.py`)
- Verification profiles → Face quality gates: gates face frames (evidence: `app/services/verification_profiles.py`)
- Face quality gates → Face detection: checks faces (evidence: `app/services/face_quality.py`)
- Verification profiles → Voice and lip scoring: scores voice (evidence: `app/services/verification_profiles.py`)
- Verification profiles → Challenge-word speech: verifies challenge word (evidence: `app/services/verification_profiles.py`)
- Look / Speak API → Trust and SAFE gates: fuses evidence
- Trust and SAFE gates → Decision evidence: evaluates SAFE gates (evidence: `app/services/risk_engine.py`)
- Decision evidence → Challenge-word speech: checks stored word (evidence: `app/services/decision_evidence.py`)
- Look / Speak API → Verification certificates: issues certificate (evidence: `app/routes/verification.py`)
- Verification certificates → Accounts and sessions store: reads certificate data (evidence: `app/services/certificate.py`)
- Faculty / admin → Student / faculty views: reviews sessions (evidence: `README.md`)
- Student / faculty views → Accounts and sessions store: reads session data (evidence: `app/routes/pages.py`)
- Demo visitor → Identify API: requests match (evidence: `README.md`)
- Identify API → Student matching: compares identity (evidence: `app/routes/identify.py`)
- Student matching → Face detection: detects faces (evidence: `app/services/identification.py`)
- Student matching → Accounts and sessions store: reads enrollments (evidence: `app/services/identification.py`)
- Identify API → Challenge-word speech: checks speech (evidence: `app/routes/identify.py`)
