# samuelbino/securedoc architecture

> Architecture diagram of the GitHub repository samuelbino/securedoc, 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/samuelbino/securedoc
- Repository: https://github.com/samuelbino/securedoc

## Overview

SecureDoc is a Flask document-verification app. A signed-in user uploads an identity document; the backend hashes it, extracts fields, validates the document, checks for tampering, creates a QR badge, and stores a record. Users can re-upload for hash comparison and browse document history; admins also manage users and inspect aggregate status. The single backend file combines routing, analysis, authentication, and SQLite access. Templates cover the UI, but their interactions and several route details were not sampled, so edges are limited to documented or excerpted relationships.

Main entry points: [`app.py`](https://github.com/samuelbino/securedoc/blob/main/app.py) (Flask routes), [`templates`](https://github.com/samuelbino/securedoc/tree/main/templates) (Page templates), [`templates/dashboard.html`](https://github.com/samuelbino/securedoc/blob/main/templates/dashboard.html) (Audit dashboard), [`templates/admin_dashboard.html`](https://github.com/samuelbino/securedoc/blob/main/templates/admin_dashboard.html) (Admin dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_flask["Flask routes<br/>[app.py]"]
  node_pages["Page templates"]
end

subgraph group_identity["Identity and access"]
  node_auth["Login and signup<br/>[app.py]"]
  node_account["Admin controls<br/>[app.py]"]
end

subgraph group_analysis["Document analysis"]
  node_hash["SHA-256 hashing<br/>[app.py]"]
  node_extract["Text extraction<br/>[app.py]"]
  node_fields["Field extraction<br/>[app.py]"]
  node_validation["Document validation<br/>[app.py]"]
  node_tamper["Tamper analysis<br/>[app.py]"]
  node_qr["QR generation<br/>[app.py]"]
  node_verify["Hash verification<br/>[app.py]"]
end

subgraph group_records["Records and oversight"]
  node_sqlite[("SQLite records<br/>[app.py]")]
  node_dashboard["Audit dashboard<br/>[dashboard.html]"]
  node_adminview["Admin dashboard"]
end

node_user(("User"))

node_user -->|"uses"| node_flask
node_flask -.->|"renders"| node_pages
node_flask -->|"routes"| node_auth
node_flask -->|"hashes upload"| node_hash
node_flask -->|"extracts text"| node_extract
node_flask -->|"extracts fields"| node_fields
node_flask -->|"validates"| node_validation
node_flask -->|"checks tampering"| node_tamper
node_flask -->|"generates QR"| node_qr
node_flask -->|"stores record"| node_sqlite
node_flask -.->|"handles re-upload"| node_verify
node_verify -.->|"compares hash"| node_sqlite
node_flask -->|"lists records"| node_sqlite
node_user -->|"views"| node_dashboard
node_flask -->|"guards admin routes"| node_account
node_account -->|"updates users"| node_sqlite
node_user -.->|"views"| node_adminview

click node_flask "https://github.com/samuelbino/securedoc/blob/main/app.py"
click node_pages "https://github.com/samuelbino/securedoc/tree/main/templates"
click node_auth "https://github.com/samuelbino/securedoc/blob/main/app.py"
click node_account "https://github.com/samuelbino/securedoc/blob/main/app.py"
click node_hash "https://github.com/samuelbino/securedoc/blob/main/app.py"
click node_extract "https://github.com/samuelbino/securedoc/blob/main/app.py"
click node_fields "https://github.com/samuelbino/securedoc/blob/main/app.py"
click node_validation "https://github.com/samuelbino/securedoc/blob/main/app.py"
click node_tamper "https://github.com/samuelbino/securedoc/blob/main/app.py"
click node_qr "https://github.com/samuelbino/securedoc/blob/main/app.py"
click node_verify "https://github.com/samuelbino/securedoc/blob/main/app.py"
click node_sqlite "https://github.com/samuelbino/securedoc/blob/main/app.py"
click node_dashboard "https://github.com/samuelbino/securedoc/blob/main/templates/dashboard.html"
click node_adminview "https://github.com/samuelbino/securedoc/blob/main/templates/admin_dashboard.html"

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_flask,node_pages,node_user toneBlue
class node_auth,node_account toneAmber
class node_hash,node_extract,node_fields,node_validation,node_tamper,node_qr,node_verify toneMint
class node_sqlite,node_dashboard,node_adminview toneRose
```

## Components

### Web experience

- [Flask routes](https://github.com/samuelbino/securedoc/blob/main/app.py): `app.py`
- [Page templates](https://github.com/samuelbino/securedoc/tree/main/templates): `templates`

### Identity and access

- [Login and signup](https://github.com/samuelbino/securedoc/blob/main/app.py): `app.py`
- [Admin controls](https://github.com/samuelbino/securedoc/blob/main/app.py): `app.py`

### Document analysis

- [SHA-256 hashing](https://github.com/samuelbino/securedoc/blob/main/app.py): `app.py`
- [Text extraction](https://github.com/samuelbino/securedoc/blob/main/app.py): `app.py`
- [Field extraction](https://github.com/samuelbino/securedoc/blob/main/app.py): `app.py`
- [Document validation](https://github.com/samuelbino/securedoc/blob/main/app.py): `app.py`
- [Tamper analysis](https://github.com/samuelbino/securedoc/blob/main/app.py): `app.py`
- [QR generation](https://github.com/samuelbino/securedoc/blob/main/app.py): `app.py`
- [Hash verification](https://github.com/samuelbino/securedoc/blob/main/app.py): `app.py`

### Records and oversight

- [SQLite records](https://github.com/samuelbino/securedoc/blob/main/app.py): `app.py`
- [Audit dashboard](https://github.com/samuelbino/securedoc/blob/main/templates/dashboard.html): `templates/dashboard.html`
- [Admin dashboard](https://github.com/samuelbino/securedoc/blob/main/templates/admin_dashboard.html): `templates/admin_dashboard.html`

### Other components

- **User**

## Connections

- User → Flask routes: uses (evidence: `README.md`)
- Flask routes → Page templates: renders (evidence: `README.md`)
- Flask routes → Login and signup: routes (evidence: `app.py`)
- Flask routes → SHA-256 hashing: hashes upload (evidence: `app.py`)
- Flask routes → Text extraction: extracts text (evidence: `app.py`)
- Flask routes → Field extraction: extracts fields (evidence: `app.py`)
- Flask routes → Document validation: validates (evidence: `app.py`)
- Flask routes → Tamper analysis: checks tampering (evidence: `app.py`)
- Flask routes → QR generation: generates QR (evidence: `app.py`)
- Flask routes → SQLite records: stores record (evidence: `app.py`)
- Flask routes → Hash verification: handles re-upload (evidence: `README.md`)
- Hash verification → SQLite records: compares hash (evidence: `README.md`)
- Flask routes → SQLite records: lists records (evidence: `app.py`)
- User → Audit dashboard: views (evidence: `README.md`)
- Flask routes → Admin controls: guards admin routes (evidence: `app.py`)
- Admin controls → SQLite records: updates users (evidence: `app.py`)
- User → Admin dashboard: views (evidence: `README.md`)
