# anmolrawat990/adaptive-file-encryptor architecture

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

- Interactive diagram: https://gitdiagram.com/anmolrawat990/adaptive-file-encryptor
- Repository: https://github.com/anmolrawat990/adaptive-file-encryptor

## Overview

Adaptive File Encryption System accepts browser uploads through a Flask API, profiles and schedules files, encrypts or decrypts them, and returns packaged or session-downloadable results. Its main runtime layers include scheduling and adaptive cost prediction, stream/chunked cryptography, envelope-key storage, and ZIP packaging; startup tuning configures the worker pool. The README documents the UI and API capabilities, while some route details and subsystem implementations were not sampled, so those links are documented rather than source-verified.

Main entry points: [`ai_encryptor_plus/cli_plus.py`](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/cli_plus.py) (Workflow Runner), [`app.py`](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/app.py) (Flask API), [`ai_encryptor_plus/key_vault.py`](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/key_vault.py) (Key Vault), [`ai_encryptor_plus/ui/script.js`](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/ui/script.js) (Web Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_webui["Web Dashboard<br/>[script.js]"]
end

subgraph group_service["API Service"]
  node_flask["Flask API<br/>[app.py]"]
  node_cli["Workflow Runner<br/>[cli_plus.py]"]
end

subgraph group_planning["Planning And Tuning"]
  node_tuner["Worker Auto-Tuner<br/>[autotuner.py]"]
  node_config["Runtime Settings<br/>[config.py]"]
  node_scheduler["File Scheduler<br/>[scheduler_plus.py]"]
  node_cost["Cost Model<br/>[cost_model.py]"]
  node_predictor["Adaptive Predictor"]
end

subgraph group_crypto["Cryptography And Keys"]
  node_streamcrypto["Stream Encryption<br/>[encryptor.py]"]
  node_chunkcrypto["Chunked CTR<br/>[chunked_ctr.py]"]
  node_decryptor["File Decryption<br/>[decryptor.py]"]
  node_vault["Key Vault<br/>[key_vault.py]"]
  node_vaultdb[("Wrapped-Key Database")]
end

subgraph group_delivery["Packaging And Downloads"]
  node_packager["ZIP Packager<br/>[packager.py]"]
  node_downloads["Session Downloads<br/>[app.py]"]
  node_archive["Encrypted Archive"]
end

node_browser(("Browser User"))

node_browser -->|"uses"| node_webui
node_webui -->|"calls API"| node_flask
node_flask -->|"benchmarks workers"| node_tuner
node_flask -->|"runs workflows"| node_cli
node_flask -->|"serves files"| node_downloads
node_cli -->|"reads defaults"| node_config
node_cli -->|"plans files"| node_scheduler
node_scheduler -->|"estimates work"| node_cost
node_cost -->|"predicts cost"| node_predictor
node_cli -->|"encrypts small files"| node_streamcrypto
node_cli -->|"encrypts large files"| node_chunkcrypto
node_cli -->|"decrypts files"| node_decryptor
node_streamcrypto -->|"stores data key"| node_vault
node_chunkcrypto -->|"stores or loads key"| node_vault
node_decryptor -->|"loads data key"| node_vault
node_vault -->|"reads and writes"| node_vaultdb
node_cli -->|"packages outputs"| node_packager
node_packager -->|"creates ZIP"| node_archive
node_flask -->|"returns archive"| node_archive
node_flask -->|"registers session files"| node_downloads
node_downloads -->|"serves downloads"| node_browser

click node_webui "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/ui/script.js"
click node_flask "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/app.py"
click node_cli "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/cli_plus.py"
click node_tuner "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/autotuner.py"
click node_config "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/config.py"
click node_scheduler "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/scheduler_plus.py"
click node_cost "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/cost_model.py"
click node_predictor "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/adaptive_predictor.py"
click node_streamcrypto "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/encryptor.py"
click node_chunkcrypto "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/chunked_ctr.py"
click node_decryptor "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/decryptor.py"
click node_vault "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/key_vault.py"
click node_packager "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/packager.py"
click node_downloads "https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/app.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_webui,node_browser toneBlue
class node_flask,node_cli toneAmber
class node_tuner,node_config,node_scheduler,node_cost,node_predictor toneMint
class node_streamcrypto,node_chunkcrypto,node_decryptor,node_vault,node_vaultdb toneRose
class node_packager,node_downloads,node_archive toneIndigo
```

## Components

### User Interface

- [Web Dashboard](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/ui/script.js): `ai_encryptor_plus/ui/script.js`

### API Service

- [Flask API](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/app.py): `app.py`
- [Workflow Runner](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/cli_plus.py): `ai_encryptor_plus/cli_plus.py`

### Planning And Tuning

- [Worker Auto-Tuner](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/autotuner.py): `ai_encryptor_plus/autotuner.py`
- [Runtime Settings](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/config.py): `ai_encryptor_plus/config.py`
- [File Scheduler](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/scheduler_plus.py): `ai_encryptor_plus/scheduler_plus.py`
- [Cost Model](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/cost_model.py): `ai_encryptor_plus/cost_model.py`
- [Adaptive Predictor](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/adaptive_predictor.py): `ai_encryptor_plus/adaptive_predictor.py`

### Cryptography And Keys

- [Stream Encryption](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/encryptor.py): `ai_encryptor_plus/encryptor.py`
- [Chunked CTR](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/chunked_ctr.py): `ai_encryptor_plus/chunked_ctr.py`
- [File Decryption](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/decryptor.py): `ai_encryptor_plus/decryptor.py`
- [Key Vault](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/key_vault.py): `ai_encryptor_plus/key_vault.py`
- **Wrapped-Key Database**

### Packaging And Downloads

- [ZIP Packager](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/ai_encryptor_plus/packager.py): `ai_encryptor_plus/packager.py`
- [Session Downloads](https://github.com/anmolrawat990/adaptive-file-encryptor/blob/main/app.py): `app.py`
- **Encrypted Archive**

### Other components

- **Browser User**

## Connections

- Browser User → Web Dashboard: uses (evidence: `README.md`)
- Web Dashboard → Flask API: calls API (evidence: `README.md`)
- Flask API → Worker Auto-Tuner: benchmarks workers (evidence: `app.py`)
- Flask API → Workflow Runner: runs workflows (evidence: `app.py`)
- Flask API → Session Downloads: serves files (evidence: `app.py`)
- Workflow Runner → Runtime Settings: reads defaults (evidence: `ai_encryptor_plus/cli_plus.py`)
- Workflow Runner → File Scheduler: plans files (evidence: `ai_encryptor_plus/cli_plus.py`)
- File Scheduler → Cost Model: estimates work (evidence: `ai_encryptor_plus/scheduler_plus.py`)
- Cost Model → Adaptive Predictor: predicts cost (evidence: `ai_encryptor_plus/cost_model.py`)
- Workflow Runner → Stream Encryption: encrypts small files (evidence: `ai_encryptor_plus/cli_plus.py`)
- Workflow Runner → Chunked CTR: encrypts large files (evidence: `ai_encryptor_plus/cli_plus.py`)
- Workflow Runner → File Decryption: decrypts files (evidence: `ai_encryptor_plus/cli_plus.py`)
- Stream Encryption → Key Vault: stores data key (evidence: `ai_encryptor_plus/encryptor.py`)
- Chunked CTR → Key Vault: stores or loads key (evidence: `ai_encryptor_plus/chunked_ctr.py`)
- File Decryption → Key Vault: loads data key (evidence: `ai_encryptor_plus/decryptor.py`)
- Key Vault → Wrapped-Key Database: reads and writes (evidence: `ai_encryptor_plus/key_vault.py`)
- Workflow Runner → ZIP Packager: packages outputs (evidence: `ai_encryptor_plus/cli_plus.py`)
- ZIP Packager → Encrypted Archive: creates ZIP (evidence: `README.md`)
- Flask API → Encrypted Archive: returns archive (evidence: `app.py`)
- Flask API → Session Downloads: registers session files (evidence: `README.md`)
- Session Downloads → Browser User: serves downloads (evidence: `README.md`)
