# subhani257/cyberguard_ai architecture

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

- Interactive diagram: https://gitdiagram.com/subhani257/cyberguard_ai
- Repository: https://github.com/subhani257/cyberguard_ai

## Overview

CyberGuard AI is a prototype for cybersecurity decision training: learners enter a situation, choose an action, explain their reasoning, and view a review. The implemented scenario API retrieves role-based policy context, sanitizes it, and asks an LLM to generate a scenario. The README describes broader evaluation, coaching, and adaptation capabilities, but the sampled backend does not implement those stages; the evaluation and dashboard views shown are frontend experiences. The graph omits unsupported frontend-to-API wiring and persistent storage. Source evidence is limited to the supplied tree, README excerpt, and sampled files.

Main entry points: [`backend/api/scenario_routes.py`](https://github.com/subhani257/cyberguard_ai/blob/main/backend/api/scenario_routes.py) (Scenario Endpoint), [`frontend/app/page.tsx`](https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/page.tsx) (Landing Page), [`frontend/app/dashboard/page.tsx`](https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/dashboard/page.tsx) (Dashboard), [`frontend/app/scenario/page.tsx`](https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/scenario/page.tsx) (Scenario Experience)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learner_ui["Learner Experience"]
  node_landing["Landing Page<br/>[page.tsx]"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_scenario_ui["Scenario Experience<br/>[page.tsx]"]
  node_scenario_card["Decision Card<br/>[ScenarioCard.tsx]"]
  node_evaluation_ui["Decision Review<br/>[page.tsx]"]
  node_admin_ui["Admin Review<br/>[page.tsx]"]
end

subgraph group_scenario_service["Scenario Service"]
  node_api_app["FastAPI App<br/>[main.py]"]
  node_scenario_route["Scenario Endpoint<br/>[scenario_routes.py]"]
  node_scenario_agent["Scenario Generator<br/>[scenario_agent.py]"]
end

subgraph group_knowledge_privacy["Context and Privacy"]
  node_org_context["Role Policy Context<br/>[retrieval.py]"]
  node_sanitizer["Input Sanitizer<br/>[ner.py]"]
end

node_learner(("Learner"))
node_llm{{"OpenAI API"}}
node_api_client(("API Client"))

node_learner -->|"opens"| node_landing
node_landing -->|"links to"| node_dashboard
node_dashboard -->|"enters"| node_scenario_ui
node_scenario_ui -->|"renders"| node_scenario_card
node_scenario_card -->|"routes to"| node_evaluation_ui
node_learner -->|"reviews cases"| node_admin_ui
node_api_app -->|"mounts router"| node_scenario_route
node_api_client -->|"requests scenario"| node_scenario_route
node_scenario_route -->|"retrieves context"| node_org_context
node_scenario_route -->|"sanitizes context"| node_sanitizer
node_scenario_route -->|"requests generation"| node_scenario_agent
node_scenario_agent -->|"generates JSON"| node_llm
node_scenario_route -->|"returns scenario"| node_api_client

click node_landing "https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/page.tsx"
click node_dashboard "https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/dashboard/page.tsx"
click node_scenario_ui "https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/scenario/page.tsx"
click node_scenario_card "https://github.com/subhani257/cyberguard_ai/blob/main/frontend/components/ScenarioCard.tsx"
click node_evaluation_ui "https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/evaluation/page.tsx"
click node_admin_ui "https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/admin/page.tsx"
click node_api_app "https://github.com/subhani257/cyberguard_ai/blob/main/backend/main.py"
click node_scenario_route "https://github.com/subhani257/cyberguard_ai/blob/main/backend/api/scenario_routes.py"
click node_scenario_agent "https://github.com/subhani257/cyberguard_ai/blob/main/backend/agents/scenario_agent.py"
click node_org_context "https://github.com/subhani257/cyberguard_ai/blob/main/backend/rag/retrieval.py"
click node_sanitizer "https://github.com/subhani257/cyberguard_ai/blob/main/backend/nlp/ner.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_landing,node_dashboard,node_scenario_ui,node_scenario_card,node_evaluation_ui,node_admin_ui,node_api_client toneBlue
class node_api_app,node_scenario_route,node_scenario_agent toneAmber
class node_org_context,node_sanitizer,node_llm toneMint
class node_learner toneIndigo
```

## Components

### Learner Experience

- [Landing Page](https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Dashboard](https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/dashboard/page.tsx): `frontend/app/dashboard/page.tsx`
- [Scenario Experience](https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/scenario/page.tsx): `frontend/app/scenario/page.tsx`
- [Decision Card](https://github.com/subhani257/cyberguard_ai/blob/main/frontend/components/ScenarioCard.tsx): `frontend/components/ScenarioCard.tsx`
- [Decision Review](https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/evaluation/page.tsx): `frontend/app/evaluation/page.tsx`
- [Admin Review](https://github.com/subhani257/cyberguard_ai/blob/main/frontend/app/admin/page.tsx): `frontend/app/admin/page.tsx`

### Scenario Service

- [FastAPI App](https://github.com/subhani257/cyberguard_ai/blob/main/backend/main.py): `backend/main.py`
- [Scenario Endpoint](https://github.com/subhani257/cyberguard_ai/blob/main/backend/api/scenario_routes.py): `backend/api/scenario_routes.py`
- [Scenario Generator](https://github.com/subhani257/cyberguard_ai/blob/main/backend/agents/scenario_agent.py): `backend/agents/scenario_agent.py`

### Context and Privacy

- [Role Policy Context](https://github.com/subhani257/cyberguard_ai/blob/main/backend/rag/retrieval.py): `backend/rag/retrieval.py`
- [Input Sanitizer](https://github.com/subhani257/cyberguard_ai/blob/main/backend/nlp/ner.py): `backend/nlp/ner.py`

### Other components

- **Learner**
- **OpenAI API**
- **API Client**

## Connections

- Learner → Landing Page: opens
- Landing Page → Dashboard: links to
- Dashboard → Scenario Experience: enters
- Scenario Experience → Decision Card: renders
- Decision Card → Decision Review: routes to
- Learner → Admin Review: reviews cases
- FastAPI App → Scenario Endpoint: mounts router
- API Client → Scenario Endpoint: requests scenario
- Scenario Endpoint → Role Policy Context: retrieves context
- Scenario Endpoint → Input Sanitizer: sanitizes context
- Scenario Endpoint → Scenario Generator: requests generation
- Scenario Generator → OpenAI API: generates JSON
- Scenario Endpoint → API Client: returns scenario
