# sanji-krishna-mp/unreal-veltech architecture

> Architecture diagram of the GitHub repository sanji-krishna-mp/unreal-veltech, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sanji-krishna-mp/unreal-veltech
- Repository: https://github.com/sanji-krishna-mp/unreal-veltech

## Overview

CyberShield runs role-based phishing simulations: officers generate and launch cohort-specific campaigns; employees safely interact with deliveries, with clicks triggering training; officers review engagement and HVI telemetry. The graph preserves the documented training and adaptation branches. Source excerpts expose selected API and scoring relationships; other workflow links are based on README statements, while unsampled internals are represented only at supported directory paths.

Main entry points: [`src/app/api/campaigns/generate/route.ts`](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/campaigns/generate/route.ts) (Content generation), [`src/lib/auth.ts`](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/auth.ts) (Role authorization), [`src/app/campaigns/new/page.tsx`](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/campaigns/new/page.tsx) (Campaign creation), [`src/app/inbox/page.tsx`](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/inbox/page.tsx) (Employee inbox)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_dashboard_ui["Officer console<br/>[page.tsx]"]
  node_campaign_create_ui["Campaign creation<br/>[page.tsx]"]
  node_campaign_detail_ui["Campaign detail<br/>[page.tsx]"]
  node_inbox_ui["Employee inbox<br/>[page.tsx]"]
  node_delivery_ui["Delivery view<br/>[page.tsx]"]
  node_training_ui["Lesson and quiz<br/>[page.tsx]"]
  node_navbar["Role navigation<br/>[Navbar.tsx]"]
end

subgraph group_campaigns["Campaign lifecycle"]
  node_campaign_generation["Content generation<br/>[route.ts]"]
  node_campaign_management["Draft management"]
  node_campaign_launch["Campaign launch<br/>[route.ts]"]
  node_templates["Scenario templates<br/>[templates.ts]"]
  node_gemini["Gemini generation<br/>[gemini.ts]"]
  node_departments_api["Department directory API<br/>[route.ts]"]
end

subgraph group_employee["Employee response"]
  node_inbox_api["Inbox delivery API<br/>[route.ts]"]
  node_delivery_events["Engagement events<br/>[route.ts]"]
  node_training_api["Training and grading"]
end

subgraph group_telemetry["Telemetry and adaptation"]
  node_adaptation["Cohort adaptation<br/>[adaptation.ts]"]
  node_dashboard_api["Dashboard metrics API<br/>[route.ts]"]
  node_scoring["HVI scoring<br/>[scoring.ts]"]
end

subgraph group_platform["Identity and persistence"]
  node_auth["Role authorization<br/>[auth.ts]"]
  node_server_client["Session database client<br/>[server.ts]"]
  node_admin_client["Privileged database client<br/>[admin.ts]"]
  node_supabase[("Supabase data store")]
end

node_officer(("Security officer"))
node_employee_user(("Employee"))

node_officer -->|"configures"| node_campaign_create_ui
node_campaign_create_ui -->|"requests content"| node_campaign_generation
node_campaign_generation -->|"gets recommendation"| node_adaptation
node_campaign_generation -->|"generates content"| node_gemini
node_gemini -->|"uses fallback"| node_templates
node_campaign_create_ui -->|"saves draft"| node_campaign_management
node_campaign_management -->|"launches campaign"| node_campaign_launch
node_campaign_launch -->|"creates deliveries"| node_supabase
node_officer -->|"reviews telemetry"| node_dashboard_ui
node_dashboard_ui -->|"loads metrics"| node_dashboard_api
node_dashboard_api -->|"calculates HVI"| node_scoring
node_employee_user -->|"opens inbox"| node_inbox_ui
node_inbox_ui -->|"loads deliveries"| node_inbox_api
node_inbox_api -->|"reads own deliveries"| node_supabase
node_inbox_ui -->|"opens message"| node_delivery_ui
node_delivery_ui -->|"records interaction"| node_delivery_events
node_delivery_events -->|"assigns lesson on click"| node_training_api
node_training_api -->|"serves lesson and quiz"| node_training_ui
node_training_api -->|"stores attempts"| node_supabase
node_campaign_management -->|"requires officer"| node_auth
node_campaign_generation -->|"requires officer"| node_auth
node_inbox_api -->|"requires employee"| node_auth
node_dashboard_api -->|"requires officer"| node_auth
node_auth -->|"checks session"| node_server_client
node_server_client -->|"queries data"| node_supabase
node_delivery_events -->|"uses privileged access"| node_admin_client
node_admin_client -->|"accesses data"| node_supabase
node_adaptation -->|"returns rationale"| node_campaign_generation
node_campaign_create_ui -->|"selects cohort"| node_departments_api
node_navbar -->|"links officer"| node_dashboard_ui
node_navbar -->|"links employee"| node_inbox_ui

click node_dashboard_ui "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/dashboard/page.tsx"
click node_campaign_create_ui "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/campaigns/new/page.tsx"
click node_campaign_detail_ui "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/campaigns/%5Bid%5D/page.tsx"
click node_inbox_ui "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/inbox/page.tsx"
click node_delivery_ui "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/inbox/%5BdeliveryId%5D/page.tsx"
click node_training_ui "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/training/%5BassignmentId%5D/page.tsx"
click node_navbar "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/components/Navbar.tsx"
click node_campaign_generation "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/campaigns/generate/route.ts"
click node_campaign_management "https://github.com/sanji-krishna-mp/unreal-veltech/tree/main/src/app/api/campaigns"
click node_campaign_launch "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/campaigns/%5Bid%5D/launch/route.ts"
click node_templates "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/templates.ts"
click node_gemini "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/gemini.ts"
click node_adaptation "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/adaptation.ts"
click node_inbox_api "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/inbox/route.ts"
click node_delivery_events "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/deliveries/%5Bid%5D/events/route.ts"
click node_training_api "https://github.com/sanji-krishna-mp/unreal-veltech/tree/main/src/app/api/training"
click node_dashboard_api "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/dashboard/route.ts"
click node_scoring "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/scoring.ts"
click node_auth "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/auth.ts"
click node_server_client "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/supabase/server.ts"
click node_admin_client "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/supabase/admin.ts"
click node_departments_api "https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/departments/route.ts"

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_dashboard_ui,node_campaign_create_ui,node_campaign_detail_ui,node_inbox_ui,node_delivery_ui,node_training_ui,node_navbar toneBlue
class node_campaign_generation,node_campaign_management,node_campaign_launch,node_templates,node_gemini,node_departments_api toneAmber
class node_inbox_api,node_delivery_events,node_training_api toneMint
class node_adaptation,node_dashboard_api,node_scoring toneRose
class node_auth,node_server_client,node_admin_client,node_supabase,node_officer,node_employee_user toneIndigo
```

## Components

### User experience

- [Officer console](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Campaign creation](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/campaigns/new/page.tsx): `src/app/campaigns/new/page.tsx`
- [Campaign detail](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/campaigns/%5Bid%5D/page.tsx): `src/app/campaigns/[id]/page.tsx`
- [Employee inbox](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/inbox/page.tsx): `src/app/inbox/page.tsx`
- [Delivery view](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/inbox/%5BdeliveryId%5D/page.tsx): `src/app/inbox/[deliveryId]/page.tsx`
- [Lesson and quiz](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/training/%5BassignmentId%5D/page.tsx): `src/app/training/[assignmentId]/page.tsx`
- [Role navigation](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/components/Navbar.tsx): `src/components/Navbar.tsx`

### Campaign lifecycle

- [Content generation](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/campaigns/generate/route.ts): `src/app/api/campaigns/generate/route.ts`
- [Draft management](https://github.com/sanji-krishna-mp/unreal-veltech/tree/main/src/app/api/campaigns): `src/app/api/campaigns`
- [Campaign launch](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/campaigns/%5Bid%5D/launch/route.ts): `src/app/api/campaigns/[id]/launch/route.ts`
- [Scenario templates](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/templates.ts): `src/lib/templates.ts`
- [Gemini generation](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/gemini.ts): `src/lib/gemini.ts`
- [Department directory API](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/departments/route.ts): `src/app/api/departments/route.ts`

### Employee response

- [Inbox delivery API](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/inbox/route.ts): `src/app/api/inbox/route.ts`
- [Engagement events](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/deliveries/%5Bid%5D/events/route.ts): `src/app/api/deliveries/[id]/events/route.ts`
- [Training and grading](https://github.com/sanji-krishna-mp/unreal-veltech/tree/main/src/app/api/training): `src/app/api/training`

### Telemetry and adaptation

- [Cohort adaptation](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/adaptation.ts): `src/lib/adaptation.ts`
- [Dashboard metrics API](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/app/api/dashboard/route.ts): `src/app/api/dashboard/route.ts`
- [HVI scoring](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/scoring.ts): `src/lib/scoring.ts`

### Identity and persistence

- [Role authorization](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Session database client](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- [Privileged database client](https://github.com/sanji-krishna-mp/unreal-veltech/blob/main/src/lib/supabase/admin.ts): `src/lib/supabase/admin.ts`
- **Supabase data store**

### Other components

- **Security officer**
- **Employee**

## Connections

- Security officer → Campaign creation: configures (evidence: `README.md`)
- Campaign creation → Content generation: requests content (evidence: `README.md`)
- Content generation → Cohort adaptation: gets recommendation (evidence: `src/app/api/campaigns/generate/route.ts`)
- Content generation → Gemini generation: generates content (evidence: `src/app/api/campaigns/generate/route.ts`)
- Gemini generation → Scenario templates: uses fallback (evidence: `src/lib/gemini.ts`)
- Campaign creation → Draft management: saves draft (evidence: `README.md`)
- Draft management → Campaign launch: launches campaign (evidence: `README.md`)
- Campaign launch → Supabase data store: creates deliveries (evidence: `README.md`)
- Security officer → Officer console: reviews telemetry (evidence: `README.md`)
- Officer console → Dashboard metrics API: loads metrics (evidence: `README.md`)
- Dashboard metrics API → HVI scoring: calculates HVI (evidence: `src/app/api/dashboard/route.ts`)
- Employee → Employee inbox: opens inbox (evidence: `README.md`)
- Employee inbox → Inbox delivery API: loads deliveries (evidence: `README.md`)
- Inbox delivery API → Supabase data store: reads own deliveries (evidence: `src/app/api/inbox/route.ts`)
- Employee inbox → Delivery view: opens message (evidence: `README.md`)
- Delivery view → Engagement events: records interaction (evidence: `README.md`)
- Engagement events → Training and grading: assigns lesson on click (evidence: `README.md`)
- Training and grading → Lesson and quiz: serves lesson and quiz (evidence: `README.md`)
- Training and grading → Supabase data store: stores attempts (evidence: `src/app/api/training/[id]/attempts/route.ts`)
- Draft management → Role authorization: requires officer (evidence: `src/app/api/campaigns/route.ts`)
- Content generation → Role authorization: requires officer (evidence: `src/app/api/campaigns/generate/route.ts`)
- Inbox delivery API → Role authorization: requires employee (evidence: `src/app/api/inbox/route.ts`)
- Dashboard metrics API → Role authorization: requires officer (evidence: `src/app/api/dashboard/route.ts`)
- Role authorization → Session database client: checks session (evidence: `src/lib/auth.ts`)
- Session database client → Supabase data store: queries data (evidence: `src/lib/supabase/server.ts`)
- Engagement events → Privileged database client: uses privileged access (evidence: `src/app/api/deliveries/[id]/events/route.ts`)
- Privileged database client → Supabase data store: accesses data (evidence: `src/lib/supabase/admin.ts`)
- Cohort adaptation → Content generation: returns rationale (evidence: `src/app/api/campaigns/generate/route.ts`)
- Campaign creation → Department directory API: selects cohort (evidence: `README.md`)
- Role navigation → Officer console: links officer (evidence: `src/components/Navbar.tsx`)
- Role navigation → Employee inbox: links employee (evidence: `src/components/Navbar.tsx`)
