# k2aep1/secureconfigai- architecture

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

- Interactive diagram: https://gitdiagram.com/k2aep1/secureconfigai-
- Repository: https://github.com/k2aep1/secureconfigai-

## Overview

SecureConfigAI assesses Windows endpoint configuration through evidence collection, deterministic control evaluation, and reporting; AI is an advisory explanation layer only. The scanner produces evidence, the backend ingests and scores it, and the React client presents results and administrative capabilities. The README documents the overall assessment flow and major capabilities; sampled source and the SOURCE INDEX support the specific module relationships shown. Some backend routes and services were not excerpted, so their internal calls are not expanded.

Main entry points: [`frontend/src/api/client.ts`](https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/api/client.ts) (HTTP API client), [`backend/app/services/scan_service.py`](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/scan_service.py) (Assessment ingestion), [`scanner/cli.py`](https://github.com/k2aep1/secureconfigai-/blob/main/scanner/cli.py) (Scan CLI), [`backend/app/api/v1/scans.py`](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/api/v1/scans.py) (Scan endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scan["Evidence scanner"]
  node_scanner_cli["Scan CLI<br/>[cli.py]"]
  node_collector_engine["Collector orchestration<br/>[collector.py]"]
  node_collectors["Windows collectors<br/>[collectors.py]"]
  node_normalizer["Evidence normalizer<br/>[normalizer.py]"]
  node_snapshot["Evidence snapshot<br/>[snapshot.py]"]
end

subgraph group_backend["Assessment backend"]
  node_api_router["API router<br/>[router.py]"]
  node_scan_api["Scan endpoints<br/>[scans.py]"]
  node_job_manager["Scan job manager<br/>[jobs.py]"]
  node_ingestion["Assessment ingestion<br/>[scan_service.py]"]
  node_baseline["Control baseline<br/>[baseline.py]"]
  node_scoring["Deterministic scoring<br/>[scoring.py]"]
  node_reporting["Report generation<br/>[report_service.py]"]
  node_ai_api["AI explanation API<br/>[ai.py]"]
  node_ai_client["AI provider client<br/>[ai_client.py]"]
end

subgraph group_security["Identity and operations"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_tokens["Token service<br/>[token_service.py]"]
  node_audit["Audit chain<br/>[audit.py]"]
  node_db_engine["Database sessions<br/>[database.py]"]
  node_db_models["Application records<br/>[models.py]"]
end

subgraph group_client["Web client"]
  node_app_routes["Application routes<br/>[App.tsx]"]
  node_session["Session provider"]
  node_api_client["HTTP API client<br/>[client.ts]"]
  node_query_client["Query state<br/>[queryClient.ts]"]
  node_scan_views["Scan and result views<br/>[Scans.tsx]"]
  node_overview["Dashboard view<br/>[Overview.tsx]"]
  node_reports_view["Reports view<br/>[Reports.tsx]"]
  node_admin_view["Administration views<br/>[Admin.tsx]"]
end

node_operator(("Security operator"))
node_windows["Windows endpoint"]
node_postgres[("PostgreSQL")]
node_web_user(("Authenticated user"))

node_operator -->|"starts scan"| node_scanner_cli
node_windows -->|"provides evidence"| node_collectors
node_scanner_cli -->|"runs collectors"| node_collector_engine
node_collector_engine -->|"dispatches to"| node_collectors
node_scanner_cli -->|"normalizes results"| node_normalizer
node_scanner_cli -->|"writes snapshot"| node_snapshot
node_snapshot -->|"uploads evidence"| node_scan_api
node_api_router -->|"mounts routes"| node_scan_api
node_scan_api -.->|"starts jobs"| node_job_manager
node_job_manager -.->|"processes evidence"| node_ingestion
node_scan_api -.->|"ingests uploads"| node_ingestion
node_ingestion -->|"loads controls"| node_baseline
node_ingestion -->|"evaluates controls"| node_scoring
node_scoring -->|"uses baseline"| node_baseline
node_ingestion -->|"stores assessment"| node_db_models
node_db_engine -->|"connects to"| node_postgres
node_db_engine -->|"provides sessions"| node_db_models
node_reporting -->|"uses assessment"| node_scoring
node_ai_api -.->|"requests explanation"| node_ai_client
node_ai_api -->|"uses findings"| node_db_models
node_auth_api -->|"manages tokens"| node_tokens
node_auth_api -->|"records actions"| node_audit
node_tokens -->|"persists tokens"| node_db_models
node_web_user -->|"uses client"| node_app_routes
node_app_routes -->|"gates pages"| node_session
node_session -->|"requests session"| node_api_client
node_query_client -->|"handles API errors"| node_api_client
node_scan_views -.->|"loads scan data"| node_api_client
node_overview -.->|"loads dashboard data"| node_api_client
node_reports_view -.->|"requests reports"| node_api_client
node_admin_view -.->|"requests administration"| node_api_client
node_operator -->|"reviews results"| node_web_user

click node_scanner_cli "https://github.com/k2aep1/secureconfigai-/blob/main/scanner/cli.py"
click node_collector_engine "https://github.com/k2aep1/secureconfigai-/blob/main/scanner/base/collector.py"
click node_collectors "https://github.com/k2aep1/secureconfigai-/blob/main/scanner/collectors.py"
click node_normalizer "https://github.com/k2aep1/secureconfigai-/blob/main/scanner/normalizer.py"
click node_snapshot "https://github.com/k2aep1/secureconfigai-/blob/main/scanner/snapshot.py"
click node_api_router "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/api/v1/router.py"
click node_scan_api "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/api/v1/scans.py"
click node_job_manager "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/jobs.py"
click node_ingestion "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/scan_service.py"
click node_baseline "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/baseline.py"
click node_scoring "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/scoring.py"
click node_reporting "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/report_service.py"
click node_ai_api "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/api/v1/ai.py"
click node_ai_client "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/ai_client.py"
click node_auth_api "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/api/v1/auth.py"
click node_tokens "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/token_service.py"
click node_audit "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/core/audit.py"
click node_db_engine "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/core/database.py"
click node_db_models "https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/db/models.py"
click node_app_routes "https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/App.tsx"
click node_session "https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/auth/SessionProvider.tsx"
click node_api_client "https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/api/client.ts"
click node_query_client "https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/state/queryClient.ts"
click node_scan_views "https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/pages/Scans.tsx"
click node_overview "https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/pages/Overview.tsx"
click node_reports_view "https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/pages/Reports.tsx"
click node_admin_view "https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/pages/Admin.tsx"

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_scanner_cli,node_collector_engine,node_collectors,node_normalizer,node_snapshot,node_web_user toneBlue
class node_api_router,node_scan_api,node_job_manager,node_ingestion,node_baseline,node_scoring,node_reporting,node_ai_api,node_ai_client,node_postgres toneAmber
class node_auth_api,node_tokens,node_audit,node_db_engine,node_db_models toneMint
class node_app_routes,node_session,node_api_client,node_query_client,node_scan_views,node_overview,node_reports_view,node_admin_view toneRose
class node_operator,node_windows toneIndigo
```

## Components

### Evidence scanner

- [Scan CLI](https://github.com/k2aep1/secureconfigai-/blob/main/scanner/cli.py): `scanner/cli.py`
- [Collector orchestration](https://github.com/k2aep1/secureconfigai-/blob/main/scanner/base/collector.py): `scanner/base/collector.py`
- [Windows collectors](https://github.com/k2aep1/secureconfigai-/blob/main/scanner/collectors.py): `scanner/collectors.py`
- [Evidence normalizer](https://github.com/k2aep1/secureconfigai-/blob/main/scanner/normalizer.py): `scanner/normalizer.py`
- [Evidence snapshot](https://github.com/k2aep1/secureconfigai-/blob/main/scanner/snapshot.py): `scanner/snapshot.py`

### Assessment backend

- [API router](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Scan endpoints](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/api/v1/scans.py): `backend/app/api/v1/scans.py`
- [Scan job manager](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/jobs.py): `backend/app/services/jobs.py`
- [Assessment ingestion](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/scan_service.py): `backend/app/services/scan_service.py`
- [Control baseline](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/baseline.py): `backend/app/services/baseline.py`
- [Deterministic scoring](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/scoring.py): `backend/app/services/scoring.py`
- [Report generation](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/report_service.py): `backend/app/services/report_service.py`
- [AI explanation API](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/api/v1/ai.py): `backend/app/api/v1/ai.py`
- [AI provider client](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/ai_client.py): `backend/app/services/ai_client.py`

### Identity and operations

- [Authentication API](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/api/v1/auth.py): `backend/app/api/v1/auth.py`
- [Token service](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/services/token_service.py): `backend/app/services/token_service.py`
- [Audit chain](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/core/audit.py): `backend/app/core/audit.py`
- [Database sessions](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Application records](https://github.com/k2aep1/secureconfigai-/blob/main/backend/app/db/models.py): `backend/app/db/models.py`

### Web client

- [Application routes](https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Session provider](https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/auth/SessionProvider.tsx): `frontend/src/auth/SessionProvider.tsx`
- [HTTP API client](https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Query state](https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/state/queryClient.ts): `frontend/src/state/queryClient.ts`
- [Scan and result views](https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/pages/Scans.tsx): `frontend/src/pages/Scans.tsx`
- [Dashboard view](https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/pages/Overview.tsx): `frontend/src/pages/Overview.tsx`
- [Reports view](https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/pages/Reports.tsx): `frontend/src/pages/Reports.tsx`
- [Administration views](https://github.com/k2aep1/secureconfigai-/blob/main/frontend/src/pages/Admin.tsx): `frontend/src/pages/Admin.tsx`

### Other components

- **Security operator**
- **Windows endpoint**
- **PostgreSQL**
- **Authenticated user**

## Connections

- Security operator → Scan CLI: starts scan
- Windows endpoint → Windows collectors: provides evidence
- Scan CLI → Collector orchestration: runs collectors (evidence: `scanner/cli.py`)
- Collector orchestration → Windows collectors: dispatches to (evidence: `scanner/collectors.py`)
- Scan CLI → Evidence normalizer: normalizes results (evidence: `scanner/cli.py`)
- Scan CLI → Evidence snapshot: writes snapshot (evidence: `scanner/cli.py`)
- Evidence snapshot → Scan endpoints: uploads evidence
- API router → Scan endpoints: mounts routes (evidence: `backend/app/api/v1/router.py`)
- Scan endpoints → Scan job manager: starts jobs
- Scan job manager → Assessment ingestion: processes evidence
- Scan endpoints → Assessment ingestion: ingests uploads
- Assessment ingestion → Control baseline: loads controls (evidence: `backend/app/services/scan_service.py`)
- Assessment ingestion → Deterministic scoring: evaluates controls (evidence: `backend/app/services/scan_service.py`)
- Deterministic scoring → Control baseline: uses baseline (evidence: `backend/app/services/scoring.py`)
- Assessment ingestion → Application records: stores assessment (evidence: `backend/app/services/scan_service.py`)
- Database sessions → PostgreSQL: connects to (evidence: `backend/app/core/database.py`)
- Database sessions → Application records: provides sessions (evidence: `backend/app/core/database.py`)
- Report generation → Deterministic scoring: uses assessment (evidence: `backend/app/services/report_service.py`)
- AI explanation API → AI provider client: requests explanation
- AI explanation API → Application records: uses findings
- Authentication API → Token service: manages tokens (evidence: `backend/app/api/v1/auth.py`)
- Authentication API → Audit chain: records actions (evidence: `backend/app/api/v1/auth.py`)
- Token service → Application records: persists tokens (evidence: `backend/app/services/token_service.py`)
- Authenticated user → Application routes: uses client (evidence: `frontend/src/App.tsx`)
- Application routes → Session provider: gates pages (evidence: `frontend/src/App.tsx`)
- Session provider → HTTP API client: requests session (evidence: `frontend/src/auth/SessionProvider.tsx`)
- Query state → HTTP API client: handles API errors (evidence: `frontend/src/state/queryClient.ts`)
- Scan and result views → HTTP API client: loads scan data
- Dashboard view → HTTP API client: loads dashboard data
- Reports view → HTTP API client: requests reports
- Administration views → HTTP API client: requests administration
- Security operator → Authenticated user: reviews results
