# omarzidane0/authix architecture

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

- Interactive diagram: https://gitdiagram.com/omarzidane0/authix
- Repository: https://github.com/omarzidane0/authix

## Overview

This Flask application provides registration, email-OTP verification, login/logout, JWT-backed sessions, and a JWT-protected home page. Registration creates an unverified account; login either starts verification or issues a token, and OTP verification marks the account verified and issues a token. The graph separates application wiring, authentication flows, and account/session concerns. Source excerpts show route-to-helper and initialization relationships; unsampled templates and helper implementations are represented only where the tree or README supports their role.

Main entry points: [`app/__init__.py`](https://github.com/omarzidane0/authix/blob/master/app/__init__.py) (Flask App Factory), [`app/routes/auth/otp.py`](https://github.com/omarzidane0/authix/blob/master/app/routes/auth/otp.py) (OTP Verification), [`app/routes/auth/login.py`](https://github.com/omarzidane0/authix/blob/master/app/routes/auth/login.py) (Login and Logout), [`app/models/model.py`](https://github.com/omarzidane0/authix/blob/master/app/models/model.py) (Account and OTP Models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_wiring["Application Wiring"]
  node_app_factory["Flask App Factory<br/>[__init__.py]"]
  node_settings["App Configuration<br/>[config.py]"]
  node_extensions["Flask Extensions<br/>[extensions.py]"]
end

subgraph group_auth["Authentication Flows"]
  node_register["Registration<br/>[register.py]"]
  node_login["Login and Logout<br/>[login.py]"]
  node_otp["OTP Verification<br/>[otp.py]"]
  node_passwords["Password and OTP Helpers<br/>[password_hash.py]"]
  node_email["OTP Email Sender<br/>[email_sender.py]"]
end

subgraph group_session["Accounts and Sessions"]
  node_account_models["Account and OTP Models<br/>[model.py]"]
  node_database[("SQLite Database<br/>[config.py]")]
  node_jwt_handlers["JWT Error Handlers<br/>[jwt_f.py]"]
  node_home["Protected Home<br/>[home_p.py]"]
end

node_visitor(("User"))
node_smtp["SMTP Email Service"]

node_visitor -->|"registers"| node_register
node_visitor -->|"logs in"| node_login
node_visitor -->|"submits OTP"| node_otp
node_visitor -->|"requests page"| node_home
node_app_factory -->|"loads config"| node_settings
node_app_factory -->|"initializes"| node_extensions
node_app_factory -->|"registers route"| node_register
node_app_factory -->|"registers route"| node_login
node_app_factory -->|"registers route"| node_otp
node_app_factory -->|"registers route"| node_home
node_app_factory -->|"registers callbacks"| node_jwt_handlers
node_register -->|"creates account"| node_account_models
node_register -->|"hashes password"| node_passwords
node_login -->|"looks up account"| node_account_models
node_login -->|"checks password"| node_passwords
node_login -->|"routes unverified user"| node_otp
node_login -.->|"creates JWT"| node_extensions
node_otp -->|"checks and updates"| node_account_models
node_otp -->|"generates OTP"| node_passwords
node_otp -->|"sends OTP"| node_email
node_otp -.->|"creates JWT"| node_extensions
node_email -.->|"sends message"| node_smtp
node_account_models -->|"uses ORM"| node_extensions
node_account_models -.->|"persists records"| node_database
node_home -->|"requires JWT"| node_extensions

click node_app_factory "https://github.com/omarzidane0/authix/blob/master/app/__init__.py"
click node_settings "https://github.com/omarzidane0/authix/blob/master/app/config.py"
click node_extensions "https://github.com/omarzidane0/authix/blob/master/app/extensions.py"
click node_register "https://github.com/omarzidane0/authix/blob/master/app/routes/auth/register.py"
click node_login "https://github.com/omarzidane0/authix/blob/master/app/routes/auth/login.py"
click node_otp "https://github.com/omarzidane0/authix/blob/master/app/routes/auth/otp.py"
click node_passwords "https://github.com/omarzidane0/authix/blob/master/app/utils/password_hash.py"
click node_email "https://github.com/omarzidane0/authix/blob/master/app/utils/email_sender.py"
click node_account_models "https://github.com/omarzidane0/authix/blob/master/app/models/model.py"
click node_database "https://github.com/omarzidane0/authix/blob/master/app/config.py"
click node_jwt_handlers "https://github.com/omarzidane0/authix/blob/master/app/routes/auth/jwt_f.py"
click node_home "https://github.com/omarzidane0/authix/blob/master/app/routes/home/home_p.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_app_factory,node_settings,node_extensions,node_visitor toneBlue
class node_register,node_login,node_otp,node_passwords,node_email toneAmber
class node_account_models,node_database,node_jwt_handlers,node_home toneMint
class node_smtp toneIndigo
```

## Components

### Application Wiring

- [Flask App Factory](https://github.com/omarzidane0/authix/blob/master/app/__init__.py): `app/__init__.py`
- [App Configuration](https://github.com/omarzidane0/authix/blob/master/app/config.py): `app/config.py`
- [Flask Extensions](https://github.com/omarzidane0/authix/blob/master/app/extensions.py): `app/extensions.py`

### Authentication Flows

- [Registration](https://github.com/omarzidane0/authix/blob/master/app/routes/auth/register.py): `app/routes/auth/register.py`
- [Login and Logout](https://github.com/omarzidane0/authix/blob/master/app/routes/auth/login.py): `app/routes/auth/login.py`
- [OTP Verification](https://github.com/omarzidane0/authix/blob/master/app/routes/auth/otp.py): `app/routes/auth/otp.py`
- [Password and OTP Helpers](https://github.com/omarzidane0/authix/blob/master/app/utils/password_hash.py): `app/utils/password_hash.py`
- [OTP Email Sender](https://github.com/omarzidane0/authix/blob/master/app/utils/email_sender.py): `app/utils/email_sender.py`

### Accounts and Sessions

- [Account and OTP Models](https://github.com/omarzidane0/authix/blob/master/app/models/model.py): `app/models/model.py`
- [SQLite Database](https://github.com/omarzidane0/authix/blob/master/app/config.py): `app/config.py`
- [JWT Error Handlers](https://github.com/omarzidane0/authix/blob/master/app/routes/auth/jwt_f.py): `app/routes/auth/jwt_f.py`
- [Protected Home](https://github.com/omarzidane0/authix/blob/master/app/routes/home/home_p.py): `app/routes/home/home_p.py`

### Other components

- **User**
- **SMTP Email Service**

## Connections

- User → Registration: registers (evidence: `README.md`)
- User → Login and Logout: logs in (evidence: `README.md`)
- User → OTP Verification: submits OTP (evidence: `app/routes/auth/otp.py`)
- User → Protected Home: requests page (evidence: `app/routes/home/home_p.py`)
- Flask App Factory → App Configuration: loads config (evidence: `app/__init__.py`)
- Flask App Factory → Flask Extensions: initializes (evidence: `app/__init__.py`)
- Flask App Factory → Registration: registers route (evidence: `app/__init__.py`)
- Flask App Factory → Login and Logout: registers route (evidence: `app/__init__.py`)
- Flask App Factory → OTP Verification: registers route (evidence: `app/__init__.py`)
- Flask App Factory → Protected Home: registers route (evidence: `app/__init__.py`)
- Flask App Factory → JWT Error Handlers: registers callbacks (evidence: `app/__init__.py`)
- Registration → Account and OTP Models: creates account (evidence: `app/routes/auth/register.py`)
- Registration → Password and OTP Helpers: hashes password (evidence: `app/routes/auth/register.py`)
- Login and Logout → Account and OTP Models: looks up account (evidence: `app/routes/auth/login.py`)
- Login and Logout → Password and OTP Helpers: checks password (evidence: `app/routes/auth/login.py`)
- Login and Logout → OTP Verification: routes unverified user (evidence: `app/routes/auth/login.py`)
- Login and Logout → Flask Extensions: creates JWT (evidence: `app/routes/auth/login.py`)
- OTP Verification → Account and OTP Models: checks and updates (evidence: `app/routes/auth/otp.py`)
- OTP Verification → Password and OTP Helpers: generates OTP (evidence: `app/routes/auth/otp.py`)
- OTP Verification → OTP Email Sender: sends OTP (evidence: `app/routes/auth/otp.py`)
- OTP Verification → Flask Extensions: creates JWT
- OTP Email Sender → SMTP Email Service: sends message
- Account and OTP Models → Flask Extensions: uses ORM (evidence: `app/models/model.py`)
- Account and OTP Models → SQLite Database: persists records
- Protected Home → Flask Extensions: requires JWT (evidence: `app/routes/home/home_p.py`)
