# saur-deshmukh/hackohire-hashhackers architecture

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

- Interactive diagram: https://gitdiagram.com/saur-deshmukh/hackohire-hashhackers
- Repository: https://github.com/saur-deshmukh/hackohire-hashhackers

## Overview

1. **Overall shape**
   - FortiPhrase is a **local, offline password-security platform** split into a **Next.js frontend** and a set of **Python/Flask backend services**.
   - The frontend orchestrates user interaction, while backend services handle password analysis, passphrase generation, crack-time estimation, bulk processing, and PII detection.

2. **Frontend boundary**
   - `Frontend/app/*` defines the main user-facing routes: analyzer, bulk analysis, bulk PII scanning, and passphrase generation.
   - The UI is built from reusable components in `Frontend/components/*` and shared hooks/utils in `Frontend/hooks` and `Frontend/lib`.
   - `Frontend/lib/mock-api.ts` and `Frontend/lib/api-utils.ts` suggest the frontend is wired to call local backend APIs, with mock/fallback behavior for development.

3. **Backend service decomposition**
   - The backend is not a single monolith; it is split into multiple Flask entrypoints:
     - `analyser.py` — single-password strength analysis
     - `bulk.py` — bulk password analysis
     - `bulk_pii.py` — bulk password analysis with PII matching
     - `passphrase.py` — passphrase generation
     - `time_to_crack.py` — crack-time estimation
     - `insights.py` — reports/insights
   - Each service is exposed on its own localhost port, which matters for the architecture diagram because the frontend likely talks to multiple local endpoints rather than one API gateway.

4. **Core analysis pipeline**
   - Password evaluation is driven by a **Decision Tree Regressor** model trained on 15 engineered features.
   - The feature set includes length, character-class counts, repeated characters, consecutive sequences, and common patterns like keyboard/number/alpha sequences.
   - The model artifacts live under `Model/` (`sample_model.joblib` plus preprocessing/data notebooks and sample datasets), indicating an offline ML inference path at runtime.

5. **Time-to-crack subsystem**
   - `time_to_crack.py` provides a distinct computational path from the ML strength score.
   - The README indicates three crack models: **dictionary**, **rainbow table**, and **brute force**.
   - In the diagram, this should be shown as a sibling capability to strength scoring, not just a post-processing step, because it produces independent risk estimates.

6. **Passphrase generation subsystem**
   - `passphrase.py` generates secure passphrases from user-provided keywords.
   - The README says it uses local AI via **Ollama + LLaMA3**, so this service depends on a locally running model server rather than a cloud API.
   - This is the main external runtime dependency in the system and should be drawn outside the app boundary.

7. **Bulk analysis and report flow**
   - `bulk.py` and `bulk_pii.py` process CSV-style inputs, analyze many passwords in one run, and produce outputs in `Backend/outputs/`.
   - The repository includes `Backend/input_file.csv` and `Backend/outputs/output_input_file.csv`, indicating a file-based batch workflow rather than purely in-memory API calls.
   - This is important for the architecture diagram: batch inputs enter via uploaded or local CSV files, are processed server-side, and results are written back as downloadable/generated output files.

8. **PII detection subsystem**
   - `pii_detector.py` and the datasets in `Backend/datasets/` support detecting sensitive information embedded in passwords.
   - The datasets include Indian male/female/common names and a personal-information dataset, which suggests the PII matcher is tuned toward name-based or personal-data leakage checks.
   - This subsystem is specific to the bulk PII route and should be shown as a data enrichment/validation stage in the batch pipeline.

9. **Shared backend utilities and data assets**
   - `Backend/utils.py` likely contains shared feature extraction, scoring helpers, and text-processing logic used across services.
   - `Backend/bulk_passwords.csv`, `Backend/datasets/*.csv`, and `Backend/datasets/datasets.xlsx` act as supporting reference data rather than primary application state.
   - The `Model/data/*.gzip` files and notebooks in `Model/` show an offline training/prep pipeline that is separate from runtime inference.

10. **Runtime and deployment model**
   - The system is intended to run **entirely locally**: frontend in Next.js, multiple Flask processes, and a local Ollama model server.
   - There is no indication of cloud storage or remote auth; privacy is a core architectural boundary, with no password data leaving the machine.
   - For a diagram, the key external nodes are the user, the browser-based frontend, the local Flask services, the local ML model artifacts, and the Ollama/LLaMA3 runtime.

11. **What to emphasize in an architecture diagram**
   - Show the frontend as a single presentation layer that fans out to several specialized backend services.
   - Show the backend services sharing local datasets, ML artifacts, and utility modules.
   - Show file-based batch processing and output generation as a separate path from interactive single-password analysis.
   - Show Ollama/LLaMA3 as the only major external runtime dependency, but still local/offline.

12. **Big-picture data flow**
   - User enters a password or uploads a CSV in the frontend.
   - The frontend calls the relevant Flask service.
   - The service extracts features, runs ML/rule-based checks, optionally queries local LLM support for suggestions, and returns strength/crack-time/PII findings.
   - For bulk flows, results are also persisted to an output CSV for download or review.

Main entry points: [`Frontend/lib`](https://github.com/saur-deshmukh/hackohire-hashhackers/tree/main/Frontend/lib) (API Helpers), [`Frontend/app`](https://github.com/saur-deshmukh/hackohire-hashhackers/tree/main/Frontend/app) (Next.js UI), [`Backend/bulk_pii.py`](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/bulk_pii.py) (Bulk PII), [`Frontend/components`](https://github.com/saur-deshmukh/hackohire-hashhackers/tree/main/Frontend/components) (UI Kit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_webapp["Next.js UI<br/>frontend app"]
  node_home["Landing<br/>route<br/>[page.tsx]"]
  node_analyze_page["Analyze<br/>route<br/>[page.tsx]"]
  node_bulk_page["Bulk<br/>route<br/>[page.tsx]"]
  node_bulk_pii_page["Bulk PII<br/>route<br/>[page.tsx]"]
  node_passphrase_page["Passphrase<br/>route<br/>[page.tsx]"]
  node_ui_components["UI Kit<br/>frontend components"]
  node_client_lib["API Helpers<br/>frontend lib"]
end

subgraph group_backend["Backend"]
  node_analyser_srv["Analyzer<br/>flask service<br/>[analyser.py]"]
  node_bulk_srv["Bulk Analyze<br/>flask service<br/>[bulk.py]"]
  node_bulk_pii_srv["Bulk PII<br/>flask service<br/>[bulk_pii.py]"]
  node_passphrase_srv["Passphrase API<br/>flask service<br/>[passphrase.py]"]
  node_crack_srv["Crack Time<br/>flask service<br/>[time_to_crack.py]"]
  node_insights_srv["Insights<br/>flask service<br/>[insights.py]"]
  node_backend_utils["Shared Utils<br/>backend utilities<br/>[utils.py]"]
  node_pii_detector["PII Detector<br/>backend component<br/>[pii_detector.py]"]
  node_reference_data[("Reference Data<br/>datasets")]
  node_bulk_files["Batch Files<br/>input/output files<br/>[input_file.csv]"]
end

subgraph group_model["Model"]
  node_model_artifacts[("ML Artifacts<br/>offline model")]
  node_training_prep["Prep Pipeline<br/>notebooks"]
end

subgraph group_external["Local Runtime"]
  node_ollama[("Ollama + LLaMA3<br/>local llm runtime")]
end

node_user(("User<br/>actor"))

node_user -->|"uses"| node_webapp
node_webapp -->|"navigates"| node_home
node_webapp -->|"routes"| node_analyze_page
node_webapp -->|"routes"| node_bulk_page
node_webapp -->|"routes"| node_bulk_pii_page
node_webapp -->|"routes"| node_passphrase_page
node_analyze_page -->|"calls"| node_client_lib
node_bulk_page -->|"calls"| node_client_lib
node_bulk_pii_page -->|"calls"| node_client_lib
node_passphrase_page -->|"calls"| node_client_lib
node_client_lib -->|"requests"| node_analyser_srv
node_client_lib -->|"requests"| node_bulk_srv
node_client_lib -->|"requests"| node_bulk_pii_srv
node_client_lib -->|"requests"| node_passphrase_srv
node_client_lib -->|"requests"| node_crack_srv
node_client_lib -->|"requests"| node_insights_srv
node_analyser_srv -->|"uses"| node_backend_utils
node_bulk_srv -->|"uses"| node_backend_utils
node_bulk_pii_srv -->|"uses"| node_backend_utils
node_bulk_pii_srv -->|"uses"| node_pii_detector
node_pii_detector -->|"reads"| node_reference_data
node_bulk_srv -->|"reads/writes"| node_bulk_files
node_bulk_pii_srv -->|"reads/writes"| node_bulk_files
node_analyser_srv -->|"loads"| node_model_artifacts
node_bulk_srv -->|"loads"| node_model_artifacts
node_bulk_pii_srv -->|"loads"| node_model_artifacts
node_crack_srv -->|"uses"| node_backend_utils
node_passphrase_srv -->|"depends on"| node_ollama
node_model_artifacts -.->|"derived from"| node_training_prep
node_home -->|"composes"| node_ui_components
node_analyze_page -->|"composes"| node_ui_components
node_bulk_page -->|"composes"| node_ui_components
node_bulk_pii_page -->|"composes"| node_ui_components
node_passphrase_page -->|"composes"| node_ui_components

click node_webapp "https://github.com/saur-deshmukh/hackohire-hashhackers/tree/main/Frontend/app"
click node_home "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Frontend/app/page.tsx"
click node_analyze_page "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Frontend/app/analyze/page.tsx"
click node_bulk_page "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Frontend/app/bulk/page.tsx"
click node_bulk_pii_page "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Frontend/app/bulk-pii/page.tsx"
click node_passphrase_page "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Frontend/app/passphrase/page.tsx"
click node_ui_components "https://github.com/saur-deshmukh/hackohire-hashhackers/tree/main/Frontend/components"
click node_client_lib "https://github.com/saur-deshmukh/hackohire-hashhackers/tree/main/Frontend/lib"
click node_analyser_srv "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/analyser.py"
click node_bulk_srv "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/bulk.py"
click node_bulk_pii_srv "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/bulk_pii.py"
click node_passphrase_srv "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/passphrase.py"
click node_crack_srv "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/time_to_crack.py"
click node_insights_srv "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/insights.py"
click node_backend_utils "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/utils.py"
click node_pii_detector "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/pii_detector.py"
click node_reference_data "https://github.com/saur-deshmukh/hackohire-hashhackers/tree/main/Backend/datasets"
click node_bulk_files "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/input_file.csv"
click node_model_artifacts "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Model/sample_model.joblib"
click node_training_prep "https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Model/04_make_pipeline.ipynb"

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_webapp,node_home,node_analyze_page,node_bulk_page,node_bulk_pii_page,node_passphrase_page,node_ui_components,node_client_lib toneBlue
class node_analyser_srv,node_bulk_srv,node_bulk_pii_srv,node_passphrase_srv,node_crack_srv,node_insights_srv,node_backend_utils,node_pii_detector,node_reference_data,node_bulk_files toneAmber
class node_model_artifacts,node_training_prep toneMint
class node_ollama toneRose
class node_user toneNeutral
```

## Components

### Frontend

Next.js presentation layer and client orchestration

- [Next.js UI](https://github.com/saur-deshmukh/hackohire-hashhackers/tree/main/Frontend/app): frontend app · Browser-facing app that routes users to analysis workflows · `Frontend/app`
- [Landing](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Frontend/app/page.tsx): route · Entry page and overall navigation · `Frontend/app/page.tsx`
- [Analyze](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Frontend/app/analyze/page.tsx): route · Single-password analysis interface · `Frontend/app/analyze/page.tsx`
- [Bulk](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Frontend/app/bulk/page.tsx): route · Batch password analysis interface · `Frontend/app/bulk/page.tsx`
- [Bulk PII](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Frontend/app/bulk-pii/page.tsx): route · Batch analysis with PII checks · `Frontend/app/bulk-pii/page.tsx`
- [Passphrase](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Frontend/app/passphrase/page.tsx): route · Passphrase generation interface · `Frontend/app/passphrase/page.tsx`
- [UI Kit](https://github.com/saur-deshmukh/hackohire-hashhackers/tree/main/Frontend/components): frontend components · Reusable cards, meters, sections, and controls · `Frontend/components`
- [API Helpers](https://github.com/saur-deshmukh/hackohire-hashhackers/tree/main/Frontend/lib): frontend lib · Local API wiring and mock/fallback behavior · `Frontend/lib`

### Backend

Local Flask services for analysis and generation

- [Analyzer](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/analyser.py): flask service · Single-password strength analysis endpoint · `Backend/analyser.py`
- [Bulk Analyze](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/bulk.py): flask service · CSV-style batch password processing · `Backend/bulk.py`
- [Bulk PII](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/bulk_pii.py): flask service · Batch analysis plus PII matching · `Backend/bulk_pii.py`
- [Passphrase API](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/passphrase.py): flask service · Generates secure passphrases from keywords · `Backend/passphrase.py`
- [Crack Time](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/time_to_crack.py): flask service · Estimates dictionary, rainbow-table, and brute-force risk · `Backend/time_to_crack.py`
- [Insights](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/insights.py): flask service · Produces reports and summary insights · `Backend/insights.py`
- [Shared Utils](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/utils.py): backend utilities · Common feature extraction and scoring helpers · `Backend/utils.py`
- [PII Detector](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/pii_detector.py): backend component · Name and personal-data matching logic · `Backend/pii_detector.py`
- [Reference Data](https://github.com/saur-deshmukh/hackohire-hashhackers/tree/main/Backend/datasets): datasets · CSV/XLSX datasets used for bulk and PII checks · `Backend/datasets`
- [Batch Files](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Backend/input_file.csv): input/output files · Input and generated CSV batch artifacts · `Backend/input_file.csv`

### Model

Offline ML artifacts and training prep

- [ML Artifacts](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Model/sample_model.joblib): offline model · Trained regressor, features, and prep data · `Model/sample_model.joblib`
- [Prep Pipeline](https://github.com/saur-deshmukh/hackohire-hashhackers/blob/main/Model/04_make_pipeline.ipynb): notebooks · Data cleaning, feature engineering, and pipeline notebooks · `Model/04_make_pipeline.ipynb`

### Local Runtime

External local dependency for passphrase generation

- **Ollama + LLaMA3**: local llm runtime · Local model server used for passphrase generation

### Other components

- **User**: actor · Enters passwords, uploads CSVs, and reviews results

## Connections

- User → Next.js UI: uses · User interacts through the browser UI
- Next.js UI → Landing: navigates · Entry and overview routing
- Next.js UI → Analyze: routes · Single-password workflow
- Next.js UI → Bulk: routes · Batch analysis workflow
- Next.js UI → Bulk PII: routes · Batch PII workflow
- Next.js UI → Passphrase: routes · Passphrase workflow
- Analyze → API Helpers: calls · Front-end API access
- Bulk → API Helpers: calls · Front-end API access
- Bulk PII → API Helpers: calls · Front-end API access
- Passphrase → API Helpers: calls · Front-end API access
- API Helpers → Analyzer: requests · Interactive password scoring
- API Helpers → Bulk Analyze: requests · Bulk password scoring
- API Helpers → Bulk PII: requests · Bulk scoring with PII enrichment
- API Helpers → Passphrase API: requests · Passphrase generation
- API Helpers → Crack Time: requests · Time-to-crack estimation
- API Helpers → Insights: requests · Summary/report generation
- Analyzer → Shared Utils: uses · Shared feature extraction and scoring
- Bulk Analyze → Shared Utils: uses · Shared batch processing logic
- Bulk PII → Shared Utils: uses · Shared feature extraction and scoring
- Bulk PII → PII Detector: uses · Detects embedded personal data
- PII Detector → Reference Data: reads · Name and personal-information datasets
- Bulk Analyze → Batch Files: reads/writes · Consumes input CSV and emits output CSV
- Bulk PII → Batch Files: reads/writes · Consumes batch input and emits analyzed output
- Analyzer → ML Artifacts: loads · Offline regressor inference
- Bulk Analyze → ML Artifacts: loads · Offline regressor inference
- Bulk PII → ML Artifacts: loads · Offline regressor inference
- Crack Time → Shared Utils: uses · Shared password parsing helpers
- Passphrase API → Ollama + LLaMA3: depends on · Local LLM-backed generation
- ML Artifacts → Prep Pipeline: derived from · Trained from cleaned and engineered data
- Landing → UI Kit: composes · Shared presentation components
- Analyze → UI Kit: composes · Shared presentation components
- Bulk → UI Kit: composes · Shared presentation components
- Bulk PII → UI Kit: composes · Shared presentation components
- Passphrase → UI Kit: composes · Shared presentation components
