# igna73m/secureflow architecture

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

- Interactive diagram: https://gitdiagram.com/igna73m/secureflow
- Repository: https://github.com/igna73m/secureflow

## Overview

SecureFlow has two related but separate workflows: a directory-scanning CLI that turns scanner results into a fail-closed promotion decision, and an authenticated API for uploaded-source scans and stored scan history, presented through a web console. The graph retains both workflows, the scanner adapters and policy layers, and API authentication and persistence. CLI stages are supported by the README and sampled engine modules; dashboard-to-API wiring and some API internals are not fully shown, so uncertain links are omitted or marked unverified.

Main entry points: [`engine/cli.py`](https://github.com/igna73m/secureflow/blob/master/engine/cli.py) (Scan CLI), [`api/src/app.js`](https://github.com/igna73m/secureflow/blob/master/api/src/app.js) (Express Routes), [`engine/scanners.py`](https://github.com/igna73m/secureflow/blob/master/engine/scanners.py) (Bandit Adapter), [`api/src/auth.js`](https://github.com/igna73m/secureflow/blob/master/api/src/auth.js) (Auth and Sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gate["CLI Security Gate"]
  node_cli["Scan CLI<br/>[cli.py]"]
  node_discovery["Target Discovery<br/>[cli.py]"]
  node_orchestrator["Check Orchestration<br/>[orchestrator.py]"]
  node_policy["Gate Policy<br/>[policy.py]"]
  node_report["Decision Report<br/>[cli.py]"]
end

subgraph group_checks["Scanner Adapters"]
  node_bandit["Bandit Adapter<br/>[scanners.py]"]
  node_semgrep["Semgrep Adapter<br/>[scanners.py]"]
  node_eslint["ESLint Adapter<br/>[scanners.py]"]
  node_normalizer["Finding Normalizer<br/>[normalizer.py]"]
end

subgraph group_service["API Service"]
  node_server["HTTP Server<br/>[server.js]"]
  node_api["Express Routes<br/>[app.js]"]
  node_upload["Source Upload Scan<br/>[app.js]"]
  node_history["Scan History<br/>[app.js]"]
  node_database[("SQLite Records<br/>[db.js]")]
  node_scan_limiter["Scan Limiter<br/>[scan-limiter.js]"]
end

subgraph group_identity["Authentication"]
  node_auth["Auth and Sessions<br/>[auth.js]"]
  node_session_store["SQLite Session Store"]
end

subgraph group_console["Web Console"]
  node_dashboard["Console UI<br/>[App.jsx]"]
  node_dashboard_entry["React Entry<br/>[main.jsx]"]
end

node_developer(("Developer or CI"))
node_scanner_tools["Scanner Tools"]
node_api_client(("API Client"))

node_developer -->|"runs scan"| node_cli
node_cli -->|"finds targets"| node_discovery
node_cli -->|"runs checks"| node_orchestrator
node_cli -->|"selects Python"| node_bandit
node_cli -->|"selects JavaScript"| node_semgrep
node_cli -->|"selects JavaScript"| node_eslint
node_bandit -->|"invokes"| node_scanner_tools
node_semgrep -->|"invokes"| node_scanner_tools
node_eslint -->|"invokes"| node_scanner_tools
node_bandit -->|"normalizes findings"| node_normalizer
node_semgrep -->|"normalizes findings"| node_normalizer
node_eslint -->|"normalizes findings"| node_normalizer
node_orchestrator -->|"evaluates checks"| node_policy
node_cli -->|"emits decision"| node_report
node_api_client -->|"requests API"| node_server
node_server -->|"serves routes"| node_api
node_api -->|"registers auth"| node_auth
node_auth -->|"stores sessions"| node_session_store
node_api -->|"limits scans"| node_scan_limiter
node_api -->|"routes uploads"| node_upload
node_upload -->|"runs scan"| node_cli
node_api -->|"serves history"| node_history
node_api -->|"reads and writes"| node_database
node_auth -->|"reads and writes"| node_database
node_session_store -->|"persists sessions"| node_database
node_dashboard_entry -->|"renders"| node_dashboard
node_dashboard -.->|"uses API"| node_api

click node_cli "https://github.com/igna73m/secureflow/blob/master/engine/cli.py"
click node_discovery "https://github.com/igna73m/secureflow/blob/master/engine/cli.py"
click node_orchestrator "https://github.com/igna73m/secureflow/blob/master/engine/orchestrator.py"
click node_policy "https://github.com/igna73m/secureflow/blob/master/engine/policy.py"
click node_report "https://github.com/igna73m/secureflow/blob/master/engine/cli.py"
click node_bandit "https://github.com/igna73m/secureflow/blob/master/engine/scanners.py"
click node_semgrep "https://github.com/igna73m/secureflow/blob/master/engine/scanners.py"
click node_eslint "https://github.com/igna73m/secureflow/blob/master/engine/scanners.py"
click node_normalizer "https://github.com/igna73m/secureflow/blob/master/engine/normalizer.py"
click node_server "https://github.com/igna73m/secureflow/blob/master/api/src/server.js"
click node_api "https://github.com/igna73m/secureflow/blob/master/api/src/app.js"
click node_upload "https://github.com/igna73m/secureflow/blob/master/api/src/app.js"
click node_history "https://github.com/igna73m/secureflow/blob/master/api/src/app.js"
click node_database "https://github.com/igna73m/secureflow/blob/master/api/src/db.js"
click node_auth "https://github.com/igna73m/secureflow/blob/master/api/src/auth.js"
click node_session_store "https://github.com/igna73m/secureflow/blob/master/api/src/sqlite-session-store.js"
click node_scan_limiter "https://github.com/igna73m/secureflow/blob/master/api/src/scan-limiter.js"
click node_dashboard "https://github.com/igna73m/secureflow/blob/master/dashboard/src/App.jsx"
click node_dashboard_entry "https://github.com/igna73m/secureflow/blob/master/dashboard/src/main.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_cli,node_discovery,node_orchestrator,node_policy,node_report,node_api_client toneBlue
class node_bandit,node_semgrep,node_eslint,node_normalizer toneAmber
class node_server,node_api,node_upload,node_history,node_database,node_scan_limiter toneMint
class node_auth,node_session_store toneRose
class node_dashboard,node_dashboard_entry,node_developer,node_scanner_tools toneIndigo
```

## Components

### CLI Security Gate

- [Scan CLI](https://github.com/igna73m/secureflow/blob/master/engine/cli.py): `engine/cli.py`
- [Target Discovery](https://github.com/igna73m/secureflow/blob/master/engine/cli.py): `engine/cli.py`
- [Check Orchestration](https://github.com/igna73m/secureflow/blob/master/engine/orchestrator.py): `engine/orchestrator.py`
- [Gate Policy](https://github.com/igna73m/secureflow/blob/master/engine/policy.py): `engine/policy.py`
- [Decision Report](https://github.com/igna73m/secureflow/blob/master/engine/cli.py): `engine/cli.py`

### Scanner Adapters

- [Bandit Adapter](https://github.com/igna73m/secureflow/blob/master/engine/scanners.py): `engine/scanners.py`
- [Semgrep Adapter](https://github.com/igna73m/secureflow/blob/master/engine/scanners.py): `engine/scanners.py`
- [ESLint Adapter](https://github.com/igna73m/secureflow/blob/master/engine/scanners.py): `engine/scanners.py`
- [Finding Normalizer](https://github.com/igna73m/secureflow/blob/master/engine/normalizer.py): `engine/normalizer.py`

### API Service

- [HTTP Server](https://github.com/igna73m/secureflow/blob/master/api/src/server.js): `api/src/server.js`
- [Express Routes](https://github.com/igna73m/secureflow/blob/master/api/src/app.js): `api/src/app.js`
- [Source Upload Scan](https://github.com/igna73m/secureflow/blob/master/api/src/app.js): `api/src/app.js`
- [Scan History](https://github.com/igna73m/secureflow/blob/master/api/src/app.js): `api/src/app.js`
- [SQLite Records](https://github.com/igna73m/secureflow/blob/master/api/src/db.js): `api/src/db.js`
- [Scan Limiter](https://github.com/igna73m/secureflow/blob/master/api/src/scan-limiter.js): `api/src/scan-limiter.js`

### Authentication

- [Auth and Sessions](https://github.com/igna73m/secureflow/blob/master/api/src/auth.js): `api/src/auth.js`
- [SQLite Session Store](https://github.com/igna73m/secureflow/blob/master/api/src/sqlite-session-store.js): `api/src/sqlite-session-store.js`

### Web Console

- [Console UI](https://github.com/igna73m/secureflow/blob/master/dashboard/src/App.jsx): `dashboard/src/App.jsx`
- [React Entry](https://github.com/igna73m/secureflow/blob/master/dashboard/src/main.jsx): `dashboard/src/main.jsx`

### Other components

- **Developer or CI**
- **Scanner Tools**
- **API Client**

## Connections

- Developer or CI → Scan CLI: runs scan (evidence: `README.md`)
- Scan CLI → Target Discovery: finds targets (evidence: `README.md`)
- Scan CLI → Check Orchestration: runs checks (evidence: `engine/cli.py`)
- Scan CLI → Bandit Adapter: selects Python (evidence: `engine/cli.py`)
- Scan CLI → Semgrep Adapter: selects JavaScript (evidence: `engine/cli.py`)
- Scan CLI → ESLint Adapter: selects JavaScript (evidence: `engine/cli.py`)
- Bandit Adapter → Scanner Tools: invokes (evidence: `engine/scanners.py`)
- Semgrep Adapter → Scanner Tools: invokes (evidence: `engine/scanners.py`)
- ESLint Adapter → Scanner Tools: invokes (evidence: `engine/scanners.py`)
- Bandit Adapter → Finding Normalizer: normalizes findings (evidence: `engine/scanners.py`)
- Semgrep Adapter → Finding Normalizer: normalizes findings (evidence: `engine/scanners.py`)
- ESLint Adapter → Finding Normalizer: normalizes findings (evidence: `engine/scanners.py`)
- Check Orchestration → Gate Policy: evaluates checks (evidence: `engine/orchestrator.py`)
- Scan CLI → Decision Report: emits decision (evidence: `README.md`)
- API Client → HTTP Server: requests API (evidence: `README.md`)
- HTTP Server → Express Routes: serves routes (evidence: `api/src/server.js`)
- Express Routes → Auth and Sessions: registers auth (evidence: `api/src/app.js`)
- Auth and Sessions → SQLite Session Store: stores sessions (evidence: `api/src/auth.js`)
- Express Routes → Scan Limiter: limits scans (evidence: `api/src/app.js`)
- Express Routes → Source Upload Scan: routes uploads (evidence: `README.md`)
- Source Upload Scan → Scan CLI: runs scan (evidence: `README.md`)
- Express Routes → Scan History: serves history (evidence: `README.md`)
- Express Routes → SQLite Records: reads and writes (evidence: `api/src/app.js`)
- Auth and Sessions → SQLite Records: reads and writes (evidence: `api/src/auth.js`)
- SQLite Session Store → SQLite Records: persists sessions (evidence: `api/src/sqlite-session-store.js`)
- React Entry → Console UI: renders (evidence: `dashboard/src/main.jsx`)
- Console UI → Express Routes: uses API
