# kajal-dhanjal/ict-project-a architecture

> Architecture diagram of the GitHub repository kajal-dhanjal/ict-project-a, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kajal-dhanjal/ict-project-a
- Repository: https://github.com/kajal-dhanjal/ict-project-a

## Overview

##### Project type and purpose
- This is a full-stack web application: a Python/Flask-based Identity & Access Management (IAM) system tailored for aged care facilities.
- It provides secure authentication (MFA, JWT), role-based access control, honeypot intrusion detection, activity logging, and a responsive HTML/CSS/JS frontend.

##### File structure
- Top-level files:
- app.py – Flask application entry point and REST endpoints
- README.md, requirements.txt, .env – configuration and docs
- Top-level directories:
- security_protocols/ – all security modules (TLS, authentication, MFA, JWT, RBAC, honeypot, monitoring, password reset, password policies, session management)
- supabase_client/ – wrapper for Supabase database/auth API
- tools/ – utility scripts (e.g., log generation)
- web_interface/ – static assets and Jinja2 templates for UI

##### Key insights from README
- Core components: Flask backend, Supabase PostgreSQL backend & Auth, SMTP mail server, HIBP API, PyOTP TOTP generator, bcrypt hashing
- Security layers: CSRF protection, JWT session handling, MFA (TOTP + QR code), RBAC permissions, honeypot application (Node.js server.js), intrusion logging
- Monitoring: activity and intrusion logs
- Frontend: role-specific dashboards and forms

##### Detailed capturing of essential elements
- Certificate management (TLS/cert) next to transport layer
- Log storage next to the monitoring module
- Interaction with Supabase both for authentication and data storage

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        BrowserAdmin["Admin Browser"]:::frontend
        BrowserNurse["Nurse Browser"]:::frontend
        BrowserCarer["Carer Browser"]:::frontend
        WebUI["Web Interface\n(HTML/CSS/JS & Jinja2 Templates)"]:::frontend
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        FlaskApp["Flask Backend\napp.py + security_protocols + supabase_client"]:::backend
        subgraph "Security Modules"
            direction TB
            TLS["Transport Security (TLS)"]:::security
            Auth["Authentication\n(CSRF & Password)"]:::security
            MFA["Multi-Factor Authentication"]:::security
            JWT["JWT Session Handling"]:::security
            RBAC["Role-Based Access Control"]:::security
            Honeypot["Honeypot Deception Subsystem"]:::security
            Monitoring["Monitoring & Logging"]:::security
            Passwords["Password Policies & Reset"]:::security
            SessionMgmt["Session Management & Rate Limiting"]:::security
        end
        SupabaseClient["Supabase Client Wrapper"]:::backend
    end

    %% Data & Services Layer
    subgraph "Data & Services Layer"
        direction TB
        SupabaseDB["Supabase Auth & PostgreSQL"]:::external
        SMTP["SMTP Mail Server"]:::external
        HIBP["HIBP Password Check API"]:::external
        TOTPApp["TOTP Authenticator\n(Mobile App)"]:::external
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        LogFiles["Log Files\n(activity_logs.log,\nintrusion_logs.log)"]:::database
        CertStore["Certificate Store\n(cert.pem & key.pem)"]:::database
    end

    %% Connections
    BrowserAdmin -->|uses| WebUI
    BrowserNurse -->|uses| WebUI
    BrowserCarer -->|uses| WebUI
    WebUI -->|renders via| FlaskApp
    BrowserAdmin -->|API calls| FlaskApp
    BrowserNurse -->|API calls| FlaskApp
    BrowserCarer -->|API calls| FlaskApp

    FlaskApp -->|calls| SupabaseClient
    SupabaseClient -->|reads/writes| SupabaseDB

    FlaskApp -->|sends email| SMTP
    FlaskApp -->|checks breaches| HIBP
    FlaskApp <-->|generate/validate| MFA
    MFA -->|TOTP code| TOTPApp

    FlaskApp <-->|authenticate| Auth
    FlaskApp <-->|issue/verify| JWT
    FlaskApp <-->|authorize| RBAC
    FlaskApp <-->|trigger| Honeypot
    Honeypot -->|logs intrusion| LogFiles
    Honeypot -->|alerts| SMTP

    FlaskApp -->|log events| Monitoring
    Monitoring -->|writes| LogFiles

    FlaskApp <-->|secure transport| TLS
    TLS -->|uses certs| CertStore

    FlaskApp <-->|session control| SessionMgmt
    FlaskApp <-->|password policies| Passwords

    %% Click Events
    click FlaskApp "https://github.com/kajal-dhanjal/ict-project-a/blob/main/app.py"
    click TLS "https://github.com/kajal-dhanjal/ict-project-a/tree/main/security_protocols/TLS/"
    click CertStore "https://github.com/kajal-dhanjal/ict-project-a/tree/main/security_protocols/TLS/cert/"
    click Auth "https://github.com/kajal-dhanjal/ict-project-a/tree/main/security_protocols/authentication/"
    click MFA "https://github.com/kajal-dhanjal/ict-project-a/tree/main/security_protocols/mfa/"
    click JWT "https://github.com/kajal-dhanjal/ict-project-a/tree/main/security_protocols/jwt/"
    click RBAC "https://github.com/kajal-dhanjal/ict-project-a/tree/main/security_protocols/rbac/"
    click Honeypot "https://github.com/kajal-dhanjal/ict-project-a/tree/main/security_protocols/honeypot/"
    click Monitoring "https://github.com/kajal-dhanjal/ict-project-a/blob/main/security_protocols/monitoring/logger.py"
    click Passwords "https://github.com/kajal-dhanjal/ict-project-a/tree/main/security_protocols/passwords/"
    click SessionMgmt "https://github.com/kajal-dhanjal/ict-project-a/tree/main/security_protocols/session_management/"
    click SupabaseClient "https://github.com/kajal-dhanjal/ict-project-a/blob/main/supabase_client/supabaseClient.py"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#1B4F72,color:#1B2631;
    classDef backend fill:#D5F5E3,stroke:#196F3D,color:#1B2631;
    classDef security fill:#FADBD8,stroke:#C0392B,color:#1B2631;
    classDef external fill:#F2F3F4,stroke:#566573,color:#1B2631;
    classDef database fill:#EBDEF0,stroke:#6C3483,color:#1B2631;
```
