# ak4nda/sentinel-document-security architecture

> Architecture diagram of the GitHub repository ak4nda/sentinel-document-security, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ak4nda/sentinel-document-security
- Repository: https://github.com/ak4nda/sentinel-document-security

## Overview

Sentinel is an API service for secure document management with MFA, role-based access, sharing, search, and auditable activity. Users authenticate and complete MFA before using protected document and account endpoints; document operations support versioning, encrypted content, and sharing, while administrators can manage users and inspect audit records and alerts. The graph shows API-to-service ownership and the shared persistence layer. Relationships are based on the provided source excerpts and SOURCE INDEX references; unsampled internals and external storage details are not inferred.

Main entry points: [`app/main.py`](https://github.com/ak4nda/sentinel-document-security/blob/main/app/main.py) (Application), [`app/api/auth.py`](https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/auth.py) (Auth API), [`app/services/audit.py`](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/audit.py) (Audit Chain), [`app/api/documents.py`](https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/documents.py) (Documents API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Identity &amp; Access"]
  node_auth_api["Auth API<br/>[auth.py]"]
  node_auth_service["Authentication<br/>[auth.py]"]
  node_mfa["MFA<br/>[mfa.py]"]
  node_sessions["Sessions<br/>[sessions.py]"]
  node_auth_deps["Auth Dependencies<br/>[deps.py]"]
  node_users_api["Users API<br/>[users.py]"]
  node_users_service["User Management<br/>[users.py]"]
end

subgraph group_documents["Document Management"]
  node_documents_api["Documents API<br/>[documents.py]"]
  node_documents_service["Document Service<br/>[documents.py]"]
  node_search["Search<br/>[search.py]"]
  node_shares_api["Shares API<br/>[shares.py]"]
  node_shares["Sharing<br/>[shares.py]"]
  node_blob["Blob Storage<br/>[blob_store.py]"]
end

subgraph group_oversight["Audit &amp; Operations"]
  node_audit_api["Audit API<br/>[audit.py]"]
  node_audit["Audit Chain<br/>[audit.py]"]
  node_alerts_api["Alerts API<br/>[alerts.py]"]
  node_alerts["Alerts<br/>[alerts.py]"]
  node_maintenance["Maintenance<br/>[maintenance.py]"]
end

subgraph group_runtime["Runtime &amp; Data"]
  node_main["Application<br/>[main.py]"]
  node_db["Database Session<br/>[database.py]"]
  node_models["Domain Models"]
end

node_user(("User"))
node_database[("SQL Database")]

node_user -->|"authenticates"| node_auth_api
node_auth_api -->|"handles login"| node_auth_service
node_auth_api -->|"verifies MFA"| node_mfa
node_auth_api -.->|"uses sessions"| node_sessions
node_auth_api -->|"records denial"| node_audit
node_auth_deps -->|"validates session"| node_sessions
node_auth_deps -->|"audits denials"| node_audit
node_users_api -->|"manages users"| node_users_service
node_users_api -->|"manages MFA"| node_mfa
node_documents_api -->|"runs operations"| node_documents_service
node_documents_api -->|"runs search"| node_search
node_documents_api -->|"manages shares"| node_shares
node_shares_api -->|"manages shares"| node_shares
node_documents_service -->|"uses blob store"| node_blob
node_documents_service -->|"records activity"| node_audit
node_search -->|"records activity"| node_audit
node_audit_api -->|"queries and verifies"| node_audit
node_audit -->|"raises alerts"| node_alerts
node_alerts_api -->|"manages alerts"| node_alerts
node_maintenance -->|"records activity"| node_audit
node_main -->|"registers routes"| node_auth_api
node_main -->|"registers routes"| node_documents_api
node_main -->|"registers routes"| node_shares_api
node_main -->|"registers routes"| node_users_api
node_main -->|"registers routes"| node_audit_api
node_main -->|"registers routes"| node_alerts_api
node_main -->|"starts maintenance"| node_maintenance
node_db -->|"opens sessions"| node_database
node_auth_api -->|"gets request session"| node_db
node_documents_api -.->|"gets request session"| node_db
node_db -.->|"persists records"| node_models

click node_auth_api "https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/auth.py"
click node_auth_service "https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/auth.py"
click node_mfa "https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/mfa.py"
click node_sessions "https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/sessions.py"
click node_auth_deps "https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/deps.py"
click node_users_api "https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/users.py"
click node_users_service "https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/users.py"
click node_documents_api "https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/documents.py"
click node_documents_service "https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/documents.py"
click node_search "https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/search.py"
click node_shares_api "https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/shares.py"
click node_shares "https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/shares.py"
click node_blob "https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/blob_store.py"
click node_audit_api "https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/audit.py"
click node_audit "https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/audit.py"
click node_alerts_api "https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/alerts.py"
click node_alerts "https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/alerts.py"
click node_maintenance "https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/maintenance.py"
click node_main "https://github.com/ak4nda/sentinel-document-security/blob/main/app/main.py"
click node_db "https://github.com/ak4nda/sentinel-document-security/blob/main/app/core/database.py"
click node_models "https://github.com/ak4nda/sentinel-document-security/tree/main/app/models"

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_api,node_auth_service,node_mfa,node_sessions,node_auth_deps,node_users_api,node_users_service,node_user toneBlue
class node_documents_api,node_documents_service,node_search,node_shares_api,node_shares,node_blob,node_database toneAmber
class node_audit_api,node_audit,node_alerts_api,node_alerts,node_maintenance toneMint
class node_main,node_db,node_models toneRose
```

## Components

### Identity & Access

- [Auth API](https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/auth.py): `app/api/auth.py`
- [Authentication](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/auth.py): `app/services/auth.py`
- [MFA](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/mfa.py): `app/services/mfa.py`
- [Sessions](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/sessions.py): `app/services/sessions.py`
- [Auth Dependencies](https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/deps.py): `app/api/deps.py`
- [Users API](https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/users.py): `app/api/users.py`
- [User Management](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/users.py): `app/services/users.py`

### Document Management

- [Documents API](https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/documents.py): `app/api/documents.py`
- [Document Service](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/documents.py): `app/services/documents.py`
- [Search](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/search.py): `app/services/search.py`
- [Shares API](https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/shares.py): `app/api/shares.py`
- [Sharing](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/shares.py): `app/services/shares.py`
- [Blob Storage](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/blob_store.py): `app/services/blob_store.py`

### Audit & Operations

- [Audit API](https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/audit.py): `app/api/audit.py`
- [Audit Chain](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/audit.py): `app/services/audit.py`
- [Alerts API](https://github.com/ak4nda/sentinel-document-security/blob/main/app/api/alerts.py): `app/api/alerts.py`
- [Alerts](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/alerts.py): `app/services/alerts.py`
- [Maintenance](https://github.com/ak4nda/sentinel-document-security/blob/main/app/services/maintenance.py): `app/services/maintenance.py`

### Runtime & Data

- [Application](https://github.com/ak4nda/sentinel-document-security/blob/main/app/main.py): `app/main.py`
- [Database Session](https://github.com/ak4nda/sentinel-document-security/blob/main/app/core/database.py): `app/core/database.py`
- [Domain Models](https://github.com/ak4nda/sentinel-document-security/tree/main/app/models): `app/models`

### Other components

- **User**
- **SQL Database**

## Connections

- User → Auth API: authenticates (evidence: `app/api/auth.py`)
- Auth API → Authentication: handles login (evidence: `app/api/auth.py`)
- Auth API → MFA: verifies MFA (evidence: `app/api/auth.py`)
- Auth API → Sessions: uses sessions
- Auth API → Audit Chain: records denial (evidence: `app/api/auth.py`)
- Auth Dependencies → Sessions: validates session (evidence: `app/api/deps.py`)
- Auth Dependencies → Audit Chain: audits denials (evidence: `app/api/deps.py`)
- Users API → User Management: manages users (evidence: `app/api/users.py`)
- Users API → MFA: manages MFA (evidence: `app/api/users.py`)
- Documents API → Document Service: runs operations (evidence: `app/api/documents.py`)
- Documents API → Search: runs search (evidence: `app/api/documents.py`)
- Documents API → Sharing: manages shares (evidence: `app/api/documents.py`)
- Shares API → Sharing: manages shares (evidence: `app/api/shares.py`)
- Document Service → Blob Storage: uses blob store (evidence: `app/services/documents.py`)
- Document Service → Audit Chain: records activity (evidence: `app/services/documents.py`)
- Search → Audit Chain: records activity (evidence: `app/services/search.py`)
- Audit API → Audit Chain: queries and verifies (evidence: `app/api/audit.py`)
- Audit Chain → Alerts: raises alerts (evidence: `app/services/audit.py`)
- Alerts API → Alerts: manages alerts (evidence: `app/api/alerts.py`)
- Maintenance → Audit Chain: records activity (evidence: `app/services/maintenance.py`)
- Application → Auth API: registers routes (evidence: `app/main.py`)
- Application → Documents API: registers routes (evidence: `app/main.py`)
- Application → Shares API: registers routes (evidence: `app/main.py`)
- Application → Users API: registers routes (evidence: `app/main.py`)
- Application → Audit API: registers routes (evidence: `app/main.py`)
- Application → Alerts API: registers routes (evidence: `app/main.py`)
- Application → Maintenance: starts maintenance (evidence: `app/main.py`)
- Database Session → SQL Database: opens sessions (evidence: `app/core/database.py`)
- Auth API → Database Session: gets request session (evidence: `app/api/auth.py`)
- Documents API → Database Session: gets request session (evidence: `app/api/documents.py`)
- Database Session → Domain Models: persists records
