# saihemanth022004/secureshare architecture

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

- Interactive diagram: https://gitdiagram.com/saihemanth022004/secureshare
- Repository: https://github.com/saihemanth022004/secureshare

## Overview

SecureShare is a file-scanning and protected file-sharing web application. Users sign in, upload files for malware analysis, and receive a share code and QR link for safe files; they can later manage uploads or retrieve shared files with expiry and password checks. The graph reflects the sampled Flask, scanner, model-loading, Firebase, and browser code. Some route and scanner wiring is inferred from the module responsibilities and partial excerpts; uncertain links are omitted.

Main entry points: [`backend/app.py`](https://github.com/saihemanth022004/secureshare/blob/main/backend/app.py) (Flask API), [`backend/model_loader.py`](https://github.com/saihemanth022004/secureshare/blob/main/backend/model_loader.py) (Model loading), [`frontend/js/script.js`](https://github.com/saihemanth022004/secureshare/blob/main/frontend/js/script.js) (Page handlers), [`backend/scanner.py`](https://github.com/saihemanth022004/secureshare/blob/main/backend/scanner.py) (File scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Web client"]
  node_upload_ui["Upload page<br/>[upload.html]"]
  node_download_ui["Download page<br/>[download.html]"]
  node_dashboard_ui["Dashboard<br/>[dashboard.html]"]
  node_browser_logic["Page handlers<br/>[script.js]"]
  node_browser_auth["Client auth<br/>[auth.js]"]
end

subgraph group_api["Application API"]
  node_flask["Flask API<br/>[app.py]"]
  node_utils["Sharing utilities<br/>[utils.py]"]
end

subgraph group_analysis["Malware analysis"]
  node_scanner["File scanner<br/>[scanner.py]"]
  node_features["Feature extraction"]
  node_model_loader["Model loading<br/>[model_loader.py]"]
  node_model_class["Ensemble detector<br/>[model_classes.py]"]
  node_model_artifacts["Model artifacts"]
  node_feature_artifacts["Feature schemas"]
  node_scaler_artifacts["Feature scalers"]
end

subgraph group_data["Storage and sharing"]
  node_database[("Application records<br/>[database.py]")]
  node_firebase_service["Firebase adapter"]
end

node_user(("User"))
node_firebase[("Firebase services")]
node_filescan["Filescan service"]

node_user -->|"uploads file"| node_upload_ui
node_user -->|"enters code"| node_download_ui
node_user -->|"manages files"| node_dashboard_ui
node_upload_ui -->|"uses handlers"| node_browser_logic
node_download_ui -->|"uses handlers"| node_browser_logic
node_dashboard_ui -->|"uses handlers"| node_browser_logic
node_browser_logic -->|"calls API"| node_flask
node_browser_logic -->|"gets token"| node_browser_auth
node_browser_auth -->|"authenticates"| node_firebase
node_flask -->|"verifies token"| node_firebase_service
node_flask -->|"scans upload"| node_scanner
node_scanner -->|"extracts features"| node_features
node_scanner -->|"gets models"| node_model_loader
node_model_loader -->|"loads models"| node_model_artifacts
node_model_loader -->|"loads schemas"| node_feature_artifacts
node_model_loader -->|"loads scalers"| node_scaler_artifacts
node_model_loader -->|"restores detector"| node_model_class
node_scanner -.->|"requests scan"| node_filescan
node_flask -->|"creates share data"| node_utils
node_flask -->|"reads and writes"| node_database
node_flask -->|"stores file bytes"| node_firebase_service
node_database -->|"gets database"| node_firebase_service
node_firebase_service -->|"uses storage and auth"| node_firebase

click node_upload_ui "https://github.com/saihemanth022004/secureshare/blob/main/frontend/upload.html"
click node_download_ui "https://github.com/saihemanth022004/secureshare/blob/main/frontend/download.html"
click node_dashboard_ui "https://github.com/saihemanth022004/secureshare/blob/main/frontend/dashboard.html"
click node_browser_logic "https://github.com/saihemanth022004/secureshare/blob/main/frontend/js/script.js"
click node_browser_auth "https://github.com/saihemanth022004/secureshare/blob/main/frontend/js/auth.js"
click node_flask "https://github.com/saihemanth022004/secureshare/blob/main/backend/app.py"
click node_scanner "https://github.com/saihemanth022004/secureshare/blob/main/backend/scanner.py"
click node_features "https://github.com/saihemanth022004/secureshare/blob/main/backend/feature_extractor.py"
click node_model_loader "https://github.com/saihemanth022004/secureshare/blob/main/backend/model_loader.py"
click node_model_class "https://github.com/saihemanth022004/secureshare/blob/main/backend/model_classes.py"
click node_model_artifacts "https://github.com/saihemanth022004/secureshare/tree/main/models"
click node_feature_artifacts "https://github.com/saihemanth022004/secureshare/tree/main/features"
click node_scaler_artifacts "https://github.com/saihemanth022004/secureshare/tree/main/scalers"
click node_utils "https://github.com/saihemanth022004/secureshare/blob/main/backend/utils.py"
click node_database "https://github.com/saihemanth022004/secureshare/blob/main/backend/database.py"
click node_firebase_service "https://github.com/saihemanth022004/secureshare/blob/main/backend/firebase_service.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_upload_ui,node_download_ui,node_dashboard_ui,node_browser_logic,node_browser_auth,node_user toneBlue
class node_flask,node_utils,node_firebase toneAmber
class node_scanner,node_features,node_model_loader,node_model_class,node_model_artifacts,node_feature_artifacts,node_scaler_artifacts toneMint
class node_database,node_firebase_service toneRose
class node_filescan toneIndigo
```

## Components

### Web client

- [Upload page](https://github.com/saihemanth022004/secureshare/blob/main/frontend/upload.html): `frontend/upload.html`
- [Download page](https://github.com/saihemanth022004/secureshare/blob/main/frontend/download.html): `frontend/download.html`
- [Dashboard](https://github.com/saihemanth022004/secureshare/blob/main/frontend/dashboard.html): `frontend/dashboard.html`
- [Page handlers](https://github.com/saihemanth022004/secureshare/blob/main/frontend/js/script.js): `frontend/js/script.js`
- [Client auth](https://github.com/saihemanth022004/secureshare/blob/main/frontend/js/auth.js): `frontend/js/auth.js`

### Application API

- [Flask API](https://github.com/saihemanth022004/secureshare/blob/main/backend/app.py): `backend/app.py`
- [Sharing utilities](https://github.com/saihemanth022004/secureshare/blob/main/backend/utils.py): `backend/utils.py`

### Malware analysis

- [File scanner](https://github.com/saihemanth022004/secureshare/blob/main/backend/scanner.py): `backend/scanner.py`
- [Feature extraction](https://github.com/saihemanth022004/secureshare/blob/main/backend/feature_extractor.py): `backend/feature_extractor.py`
- [Model loading](https://github.com/saihemanth022004/secureshare/blob/main/backend/model_loader.py): `backend/model_loader.py`
- [Ensemble detector](https://github.com/saihemanth022004/secureshare/blob/main/backend/model_classes.py): `backend/model_classes.py`
- [Model artifacts](https://github.com/saihemanth022004/secureshare/tree/main/models): `models`
- [Feature schemas](https://github.com/saihemanth022004/secureshare/tree/main/features): `features`
- [Feature scalers](https://github.com/saihemanth022004/secureshare/tree/main/scalers): `scalers`

### Storage and sharing

- [Application records](https://github.com/saihemanth022004/secureshare/blob/main/backend/database.py): `backend/database.py`
- [Firebase adapter](https://github.com/saihemanth022004/secureshare/blob/main/backend/firebase_service.py): `backend/firebase_service.py`

### Other components

- **User**
- **Firebase services**
- **Filescan service**

## Connections

- User → Upload page: uploads file
- User → Download page: enters code
- User → Dashboard: manages files
- Upload page → Page handlers: uses handlers
- Download page → Page handlers: uses handlers
- Dashboard → Page handlers: uses handlers
- Page handlers → Flask API: calls API
- Page handlers → Client auth: gets token
- Client auth → Firebase services: authenticates
- Flask API → Firebase adapter: verifies token
- Flask API → File scanner: scans upload
- File scanner → Feature extraction: extracts features
- File scanner → Model loading: gets models
- Model loading → Model artifacts: loads models
- Model loading → Feature schemas: loads schemas
- Model loading → Feature scalers: loads scalers
- Model loading → Ensemble detector: restores detector
- File scanner → Filescan service: requests scan
- Flask API → Sharing utilities: creates share data
- Flask API → Application records: reads and writes
- Flask API → Firebase adapter: stores file bytes
- Application records → Firebase adapter: gets database
- Firebase adapter → Firebase services: uses storage and auth
