# uzankhan/authsheild-360 architecture

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

- Interactive diagram: https://gitdiagram.com/uzankhan/authsheild-360
- Repository: https://github.com/uzankhan/authsheild-360

## Overview

AuthShield 360 is a Flask school-portal authentication service. A user reaches the web app, which registers authentication, portal, and administration APIs; authentication applies role-specific password/OTP stages and issues sessions, while authorized users access portal data or administrators manage accounts and records. Shared security, persistence, and audit services support those flows. The README documents lockout, RBAC, and security controls; sampled files confirm several integrations, but the frontend-to-API wiring and some route internals were not inspected, so those links are omitted.

Main entry points: [`app.py`](https://github.com/uzankhan/authsheild-360/blob/main/app.py) (Flask app), [`backend/services/audit.py`](https://github.com/uzankhan/authsheild-360/blob/main/backend/services/audit.py) (Audit logging), [`backend/routes/auth.py`](https://github.com/uzankhan/authsheild-360/blob/main/backend/routes/auth.py) (Authentication API), [`backend/models.py`](https://github.com/uzankhan/authsheild-360/blob/main/backend/models.py) (Domain models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry"]
  node_flask_app["Flask app<br/>[app.py]"]
  node_web_ui["Portal interface<br/>[index.html]"]
end

subgraph group_identity["Authentication"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_security["Security core<br/>[security.py]"]
  node_sms["Mobile OTP delivery<br/>[sms.py]"]
  node_email["Email OTP delivery<br/>[email.py]"]
end

subgraph group_portal["Portal services"]
  node_admin_api["Admin API<br/>[admin.py]"]
  node_portal_api["Portal API<br/>[portal.py]"]
end

subgraph group_shared["Shared services"]
  node_models["Domain models<br/>[models.py]"]
  node_database[("Database layer<br/>[database.py]")]
  node_audit["Audit logging<br/>[audit.py]"]
  node_middleware["Security middleware<br/>[middleware.py]"]
  node_config["App configuration<br/>[config.py]"]
  node_seed["Initial data<br/>[seed.py]"]
end

node_user(("Portal user"))
node_whatsapp{{"WhatsApp Cloud API"}}
node_smtp{{"SMTP service"}}

node_user -->|"visits"| node_flask_app
node_flask_app -->|"renders"| node_web_ui
node_flask_app -->|"registers"| node_auth_api
node_flask_app -->|"registers"| node_portal_api
node_flask_app -->|"registers"| node_admin_api
node_flask_app -->|"initializes"| node_database
node_flask_app -->|"registers"| node_middleware
node_flask_app -->|"loads"| node_config
node_flask_app -->|"runs"| node_seed
node_auth_api -->|"queries"| node_models
node_auth_api -->|"uses"| node_security
node_auth_api -->|"records events"| node_audit
node_auth_api -->|"sends mobile OTP"| node_sms
node_auth_api -->|"sends email OTP"| node_email
node_sms -->|"posts messages"| node_whatsapp
node_email -->|"sends mail"| node_smtp
node_portal_api -->|"queries"| node_models
node_portal_api -->|"checks roles"| node_security
node_portal_api -->|"uses"| node_audit
node_admin_api -->|"manages records"| node_models
node_admin_api -->|"checks roles"| node_security
node_admin_api -->|"guards routes"| node_middleware
node_admin_api -->|"records events"| node_audit
node_models -->|"defines tables"| node_database
node_audit -->|"writes logs"| node_models
node_audit -->|"commits entries"| node_database
node_audit -->|"gets client IP"| node_security
node_middleware -->|"gets client IP"| node_security
node_middleware -->|"logs probes"| node_audit
node_seed -->|"creates sample data"| node_models
node_seed -->|"hashes passwords"| node_security
node_seed -->|"persists records"| node_database

click node_flask_app "https://github.com/uzankhan/authsheild-360/blob/main/app.py"
click node_web_ui "https://github.com/uzankhan/authsheild-360/blob/main/templates/index.html"
click node_auth_api "https://github.com/uzankhan/authsheild-360/blob/main/backend/routes/auth.py"
click node_security "https://github.com/uzankhan/authsheild-360/blob/main/backend/security.py"
click node_admin_api "https://github.com/uzankhan/authsheild-360/blob/main/backend/routes/admin.py"
click node_portal_api "https://github.com/uzankhan/authsheild-360/blob/main/backend/routes/portal.py"
click node_models "https://github.com/uzankhan/authsheild-360/blob/main/backend/models.py"
click node_database "https://github.com/uzankhan/authsheild-360/blob/main/backend/database.py"
click node_audit "https://github.com/uzankhan/authsheild-360/blob/main/backend/services/audit.py"
click node_middleware "https://github.com/uzankhan/authsheild-360/blob/main/backend/middleware.py"
click node_config "https://github.com/uzankhan/authsheild-360/blob/main/config.py"
click node_seed "https://github.com/uzankhan/authsheild-360/blob/main/backend/seed.py"
click node_sms "https://github.com/uzankhan/authsheild-360/blob/main/backend/services/sms.py"
click node_email "https://github.com/uzankhan/authsheild-360/blob/main/backend/services/email.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_flask_app,node_web_ui,node_user toneBlue
class node_auth_api,node_security,node_sms,node_email toneAmber
class node_admin_api,node_portal_api,node_whatsapp toneMint
class node_models,node_database,node_audit,node_middleware,node_config,node_seed toneRose
class node_smtp toneIndigo
```

## Components

### Web entry

- [Flask app](https://github.com/uzankhan/authsheild-360/blob/main/app.py): `app.py`
- [Portal interface](https://github.com/uzankhan/authsheild-360/blob/main/templates/index.html): `templates/index.html`

### Authentication

- [Authentication API](https://github.com/uzankhan/authsheild-360/blob/main/backend/routes/auth.py): `backend/routes/auth.py`
- [Security core](https://github.com/uzankhan/authsheild-360/blob/main/backend/security.py): `backend/security.py`
- [Mobile OTP delivery](https://github.com/uzankhan/authsheild-360/blob/main/backend/services/sms.py): `backend/services/sms.py`
- [Email OTP delivery](https://github.com/uzankhan/authsheild-360/blob/main/backend/services/email.py): `backend/services/email.py`

### Portal services

- [Admin API](https://github.com/uzankhan/authsheild-360/blob/main/backend/routes/admin.py): `backend/routes/admin.py`
- [Portal API](https://github.com/uzankhan/authsheild-360/blob/main/backend/routes/portal.py): `backend/routes/portal.py`

### Shared services

- [Domain models](https://github.com/uzankhan/authsheild-360/blob/main/backend/models.py): `backend/models.py`
- [Database layer](https://github.com/uzankhan/authsheild-360/blob/main/backend/database.py): `backend/database.py`
- [Audit logging](https://github.com/uzankhan/authsheild-360/blob/main/backend/services/audit.py): `backend/services/audit.py`
- [Security middleware](https://github.com/uzankhan/authsheild-360/blob/main/backend/middleware.py): `backend/middleware.py`
- [App configuration](https://github.com/uzankhan/authsheild-360/blob/main/config.py): `config.py`
- [Initial data](https://github.com/uzankhan/authsheild-360/blob/main/backend/seed.py): `backend/seed.py`

### Other components

- **Portal user**
- **WhatsApp Cloud API**
- **SMTP service**

## Connections

- Portal user → Flask app: visits (evidence: `app.py`)
- Flask app → Portal interface: renders (evidence: `app.py`)
- Flask app → Authentication API: registers (evidence: `app.py`)
- Flask app → Portal API: registers (evidence: `app.py`)
- Flask app → Admin API: registers (evidence: `app.py`)
- Flask app → Database layer: initializes (evidence: `app.py`)
- Flask app → Security middleware: registers (evidence: `app.py`)
- Flask app → App configuration: loads (evidence: `app.py`)
- Flask app → Initial data: runs (evidence: `app.py`)
- Authentication API → Domain models: queries (evidence: `backend/routes/auth.py`)
- Authentication API → Security core: uses (evidence: `backend/routes/auth.py`)
- Authentication API → Audit logging: records events (evidence: `backend/routes/auth.py`)
- Authentication API → Mobile OTP delivery: sends mobile OTP (evidence: `backend/routes/auth.py`)
- Authentication API → Email OTP delivery: sends email OTP (evidence: `backend/routes/auth.py`)
- Mobile OTP delivery → WhatsApp Cloud API: posts messages (evidence: `backend/services/sms.py`)
- Email OTP delivery → SMTP service: sends mail (evidence: `backend/services/email.py`)
- Portal API → Domain models: queries (evidence: `backend/routes/portal.py`)
- Portal API → Security core: checks roles (evidence: `backend/routes/portal.py`)
- Portal API → Audit logging: uses (evidence: `backend/routes/portal.py`)
- Admin API → Domain models: manages records (evidence: `backend/routes/admin.py`)
- Admin API → Security core: checks roles (evidence: `backend/routes/admin.py`)
- Admin API → Security middleware: guards routes (evidence: `backend/routes/admin.py`)
- Admin API → Audit logging: records events (evidence: `backend/routes/admin.py`)
- Domain models → Database layer: defines tables (evidence: `backend/models.py`)
- Audit logging → Domain models: writes logs (evidence: `backend/services/audit.py`)
- Audit logging → Database layer: commits entries (evidence: `backend/services/audit.py`)
- Audit logging → Security core: gets client IP (evidence: `backend/services/audit.py`)
- Security middleware → Security core: gets client IP (evidence: `backend/middleware.py`)
- Security middleware → Audit logging: logs probes (evidence: `backend/middleware.py`)
- Initial data → Domain models: creates sample data (evidence: `backend/seed.py`)
- Initial data → Security core: hashes passwords (evidence: `backend/seed.py`)
- Initial data → Database layer: persists records (evidence: `backend/seed.py`)
