# kamalesh1214/crypto-discovery architecture

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

- Interactive diagram: https://gitdiagram.com/kamalesh1214/crypto-discovery
- Repository: https://github.com/kamalesh1214/crypto-discovery

## Overview

Cryptographic Discovery accepts a ZIP repository, scans its contents statically, records discovered cryptographic assets and assessments, then presents inventory, risk, dependency, migration, and report views. The backend stages include safe extraction, file discovery, language/configuration detection, rule-based assessment, persistence, and reporting; the frontend coordinates scans and displays results. The scan-service excerpt and source index support the main backend calls. Some capability details are documented only in the README, and dependency analysis has no dedicated backend module in the supplied tree.

Main entry points: [`backend/app/services/scan_service.py`](https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/services/scan_service.py) (Scan orchestrator), [`frontend/src/services/api.js`](https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/services/api.js) (API client), [`frontend/src/App.jsx`](https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/App.jsx) (Application shell), [`backend/app/api/routes.py`](https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/api/routes.py) (Scan API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Scan ingestion"]
  node_zip_api["Scan API<br/>[routes.py]"]
  node_zip_extractor["Safe ZIP extraction<br/>[zip_extractor.py]"]
  node_scan_service["Scan orchestrator<br/>[scan_service.py]"]
end

subgraph group_analysis["Discovery and assessment"]
  node_file_discovery["File discovery<br/>[file_discovery.py]"]
  node_detectors["Crypto detectors"]
  node_risk_engine["Classical risk<br/>[risk_engine.py]"]
  node_exposure_engine["HNDL exposure<br/>[exposure_engine.py]"]
  node_pqc_engine["PQC migration assessment<br/>[pqc_engine.py]"]
end

subgraph group_storage["Results and reports"]
  node_database[("Scan inventory store<br/>[schemas.py]")]
  node_report_service["JSON and CSV reports<br/>[report_service.py]"]
end

subgraph group_experience["User experience"]
  node_discovery_ui["Discovery console<br/>[DiscoveryPage.jsx]"]
  node_frontend_app["Application shell<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_cbom_view["Cryptographic inventory<br/>[CBOMPage.jsx]"]
  node_overview_view["Readiness overview<br/>[OverviewPage.jsx]"]
  node_risk_view["Risk and quantum view<br/>[RiskMoscaPage.jsx]"]
  node_dependency_view["Dependency impact"]
  node_migration_view["Migration planning<br/>[MigrationPage.jsx]"]
  node_reports_view["Report exports<br/>[ReportsPage.jsx]"]
end

node_user(("Repository analyst"))

node_user -->|"uploads ZIP"| node_discovery_ui
node_discovery_ui -->|"starts scan"| node_api_client
node_api_client -->|"sends scan request"| node_zip_api
node_zip_api -->|"invokes scan"| node_scan_service
node_scan_service -->|"extracts safely"| node_zip_extractor
node_scan_service -->|"discovers files"| node_file_discovery
node_scan_service -->|"scans files"| node_detectors
node_scan_service -->|"assesses risk"| node_risk_engine
node_scan_service -->|"assesses exposure"| node_exposure_engine
node_scan_service -->|"estimates migration"| node_pqc_engine
node_scan_service -->|"persists results"| node_database
node_zip_api -->|"reads scan records"| node_database
node_zip_api -->|"generates exports"| node_report_service
node_frontend_app -->|"routes to"| node_discovery_ui
node_frontend_app -->|"routes to"| node_overview_view
node_frontend_app -->|"routes to"| node_cbom_view
node_frontend_app -->|"routes to"| node_risk_view
node_frontend_app -->|"routes to"| node_dependency_view
node_frontend_app -->|"routes to"| node_migration_view
node_api_client -.->|"fetches inventory"| node_database
node_cbom_view -.->|"requests inventory"| node_api_client
node_risk_view -->|"requests risk data"| node_api_client
node_dependency_view -->|"requests scan data"| node_api_client
node_migration_view -->|"requests inventory"| node_api_client
node_reports_view -.->|"requests exports"| node_api_client
node_scan_service -.->|"supports impact analysis"| node_dependency_view

click node_discovery_ui "https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/DiscoveryPage.jsx"
click node_frontend_app "https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/services/api.js"
click node_zip_api "https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/api/routes.py"
click node_zip_extractor "https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/scanner/zip_extractor.py"
click node_scan_service "https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/services/scan_service.py"
click node_file_discovery "https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/scanner/file_discovery.py"
click node_detectors "https://github.com/kamalesh1214/crypto-discovery/tree/main/backend/app/detectors"
click node_risk_engine "https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/rules/risk_engine.py"
click node_exposure_engine "https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/rules/exposure_engine.py"
click node_pqc_engine "https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/rules/pqc_engine.py"
click node_database "https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/models/schemas.py"
click node_report_service "https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/services/report_service.py"
click node_cbom_view "https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/CBOMPage.jsx"
click node_overview_view "https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/OverviewPage.jsx"
click node_risk_view "https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/RiskMoscaPage.jsx"
click node_dependency_view "https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/DependenciesPage.jsx"
click node_migration_view "https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/MigrationPage.jsx"
click node_reports_view "https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/ReportsPage.jsx"

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_zip_api,node_zip_extractor,node_scan_service toneBlue
class node_file_discovery,node_detectors,node_risk_engine,node_exposure_engine,node_pqc_engine toneAmber
class node_database,node_report_service toneMint
class node_discovery_ui,node_frontend_app,node_api_client,node_cbom_view,node_overview_view,node_risk_view,node_dependency_view,node_migration_view,node_reports_view toneRose
class node_user toneIndigo
```

## Components

### Scan ingestion

- [Scan API](https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`
- [Safe ZIP extraction](https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/scanner/zip_extractor.py): `backend/app/scanner/zip_extractor.py`
- [Scan orchestrator](https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/services/scan_service.py): `backend/app/services/scan_service.py`

### Discovery and assessment

- [File discovery](https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/scanner/file_discovery.py): `backend/app/scanner/file_discovery.py`
- [Crypto detectors](https://github.com/kamalesh1214/crypto-discovery/tree/main/backend/app/detectors): `backend/app/detectors`
- [Classical risk](https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/rules/risk_engine.py): `backend/app/rules/risk_engine.py`
- [HNDL exposure](https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/rules/exposure_engine.py): `backend/app/rules/exposure_engine.py`
- [PQC migration assessment](https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/rules/pqc_engine.py): `backend/app/rules/pqc_engine.py`

### Results and reports

- [Scan inventory store](https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/models/schemas.py): `backend/app/models/schemas.py`
- [JSON and CSV reports](https://github.com/kamalesh1214/crypto-discovery/blob/main/backend/app/services/report_service.py): `backend/app/services/report_service.py`

### User experience

- [Discovery console](https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/DiscoveryPage.jsx): `frontend/src/pages/DiscoveryPage.jsx`
- [Application shell](https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Cryptographic inventory](https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/CBOMPage.jsx): `frontend/src/pages/CBOMPage.jsx`
- [Readiness overview](https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/OverviewPage.jsx): `frontend/src/pages/OverviewPage.jsx`
- [Risk and quantum view](https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/RiskMoscaPage.jsx): `frontend/src/pages/RiskMoscaPage.jsx`
- [Dependency impact](https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/DependenciesPage.jsx): `frontend/src/pages/DependenciesPage.jsx`
- [Migration planning](https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/MigrationPage.jsx): `frontend/src/pages/MigrationPage.jsx`
- [Report exports](https://github.com/kamalesh1214/crypto-discovery/blob/main/frontend/src/pages/ReportsPage.jsx): `frontend/src/pages/ReportsPage.jsx`

### Other components

- **Repository analyst**

## Connections

- Repository analyst → Discovery console: uploads ZIP
- Discovery console → API client: starts scan (evidence: `frontend/src/pages/DiscoveryPage.jsx`)
- API client → Scan API: sends scan request (evidence: `frontend/src/services/api.js`)
- Scan API → Scan orchestrator: invokes scan (evidence: `backend/app/api/routes.py`)
- Scan orchestrator → Safe ZIP extraction: extracts safely (evidence: `backend/app/services/scan_service.py`)
- Scan orchestrator → File discovery: discovers files (evidence: `backend/app/services/scan_service.py`)
- Scan orchestrator → Crypto detectors: scans files (evidence: `backend/app/services/scan_service.py`)
- Scan orchestrator → Classical risk: assesses risk (evidence: `backend/app/services/scan_service.py`)
- Scan orchestrator → HNDL exposure: assesses exposure (evidence: `backend/app/services/scan_service.py`)
- Scan orchestrator → PQC migration assessment: estimates migration (evidence: `backend/app/services/scan_service.py`)
- Scan orchestrator → Scan inventory store: persists results (evidence: `backend/app/services/scan_service.py`)
- Scan API → Scan inventory store: reads scan records (evidence: `backend/app/api/routes.py`)
- Scan API → JSON and CSV reports: generates exports (evidence: `backend/app/api/routes.py`)
- Application shell → Discovery console: routes to (evidence: `frontend/src/App.jsx`)
- Application shell → Readiness overview: routes to (evidence: `frontend/src/App.jsx`)
- Application shell → Cryptographic inventory: routes to (evidence: `frontend/src/App.jsx`)
- Application shell → Risk and quantum view: routes to (evidence: `frontend/src/App.jsx`)
- Application shell → Dependency impact: routes to (evidence: `frontend/src/App.jsx`)
- Application shell → Migration planning: routes to (evidence: `frontend/src/App.jsx`)
- API client → Scan inventory store: fetches inventory
- Cryptographic inventory → API client: requests inventory
- Risk and quantum view → API client: requests risk data (evidence: `frontend/src/pages/RiskMoscaPage.jsx`)
- Dependency impact → API client: requests scan data (evidence: `frontend/src/pages/DependenciesPage.jsx`)
- Migration planning → API client: requests inventory (evidence: `frontend/src/pages/MigrationPage.jsx`)
- Report exports → API client: requests exports
- Scan orchestrator → Dependency impact: supports impact analysis
