# guna-72/cdset_v4 architecture

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

- Interactive diagram: https://gitdiagram.com/guna-72/cdset_v4
- Repository: https://github.com/guna-72/cdset_v4

## Overview

Chaos Tutor/CD-SET accepts project archives or Git repositories, analyzes resilience failure surfaces, generates and safety-checks experiments, runs them in isolated sandboxes, and presents diagnostics and learning guidance. The graph preserves those stages alongside the React client, persistence, authentication, diagnosis providers, and the separate conversational tutor service. Relationships follow shown imports/calls or README descriptions; some unsampled subsystem links are omitted rather than inferred.

Main entry points: [`backend/app/orchestrator.py`](https://github.com/guna-72/cdset_v4/blob/main/backend/app/orchestrator.py) (Pipeline orchestration), [`backend/app/api.py`](https://github.com/guna-72/cdset_v4/blob/main/backend/app/api.py) (HTTP API), [`chaos/src/api.js`](https://github.com/guna-72/cdset_v4/blob/main/chaos/src/api.js) (Backend client), [`chaos/src/pages`](https://github.com/guna-72/cdset_v4/tree/main/chaos/src/pages) (Product screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Frontend"]
  node_app["App navigation<br/>[App.jsx]"]
  node_screens["Product screens"]
  node_tutor_screen["Tutor screen<br/>[TutorPage.jsx]"]
  node_web_api["Backend client<br/>[api.js]"]
  node_auth_context["Auth context<br/>[AuthContext.jsx]"]
end

subgraph group_service["Core backend"]
  node_api_routes["HTTP API<br/>[api.py]"]
  node_orchestrator["Pipeline orchestration<br/>[orchestrator.py]"]
  node_intake["Archive intake<br/>[intake.py]"]
  node_git_intake["Git intake<br/>[git_intake.py]"]
  node_analyzer["Static analysis<br/>[analyzer.py]"]
  node_failure_discovery["Failure discovery"]
  node_generator["Experiment generation"]
  node_safety["Safety gate<br/>[safety_gate.py]"]
  node_diagnosis["Failure diagnosis<br/>[diagnosis.py]"]
  node_database[("SQLite persistence<br/>[db.py]")]
end

subgraph group_execution["Experiment runtime"]
  node_chaos_engine["Fault injection<br/>[chaos_engine.py]"]
  node_sandbox["Sandbox execution<br/>[sandbox.py]"]
end

subgraph group_learning["AI tutoring"]
  node_tutor_service["Tutor guidance<br/>[tutor.py]"]
  node_tutor_context["Tutor context<br/>[tutor_context.py]"]
  node_tutor_backend["Tutor microservice<br/>[app.py]"]
end

subgraph group_integrations["Identity and providers"]
  node_providers["LLM providers<br/>[llm_providers.py]"]
  node_firebase["Firebase identity<br/>[firebase.js]"]
end

node_developer(("Developer"))
node_user(("User"))

node_developer -->|"uses"| node_app
node_app -->|"routes to"| node_screens
node_screens -->|"requests"| node_web_api
node_screens -->|"requests"| node_web_api
node_tutor_screen -->|"requests"| node_web_api
node_web_api -->|"sends requests"| node_api_routes
node_auth_context -->|"uses"| node_firebase
node_api_routes -->|"calls"| node_orchestrator
node_api_routes -->|"calls"| node_tutor_service
node_api_routes -->|"calls"| node_tutor_context
node_orchestrator -->|"validates archives"| node_intake
node_orchestrator -->|"imports repositories"| node_git_intake
node_orchestrator -->|"analyzes project"| node_analyzer
node_orchestrator -->|"discovers surfaces"| node_failure_discovery
node_orchestrator -->|"generates experiments"| node_generator
node_orchestrator -->|"checks safety"| node_safety
node_orchestrator -->|"runs approved tests"| node_chaos_engine
node_chaos_engine -->|"launches in"| node_sandbox
node_orchestrator -->|"diagnoses failures"| node_diagnosis
node_diagnosis -.->|"uses providers"| node_providers
node_orchestrator -->|"stores run history"| node_database
node_tutor_service -.->|"uses context"| node_tutor_context
node_user -.->|"asks questions"| node_tutor_backend

click node_app "https://github.com/guna-72/cdset_v4/blob/main/chaos/src/App.jsx"
click node_screens "https://github.com/guna-72/cdset_v4/tree/main/chaos/src/pages"
click node_tutor_screen "https://github.com/guna-72/cdset_v4/blob/main/chaos/src/pages/TutorPage.jsx"
click node_web_api "https://github.com/guna-72/cdset_v4/blob/main/chaos/src/api.js"
click node_auth_context "https://github.com/guna-72/cdset_v4/blob/main/chaos/src/context/AuthContext.jsx"
click node_api_routes "https://github.com/guna-72/cdset_v4/blob/main/backend/app/api.py"
click node_orchestrator "https://github.com/guna-72/cdset_v4/blob/main/backend/app/orchestrator.py"
click node_intake "https://github.com/guna-72/cdset_v4/blob/main/backend/app/intake.py"
click node_git_intake "https://github.com/guna-72/cdset_v4/blob/main/backend/app/git_intake.py"
click node_analyzer "https://github.com/guna-72/cdset_v4/blob/main/backend/app/analyzer.py"
click node_failure_discovery "https://github.com/guna-72/cdset_v4/blob/main/backend/app/failure_discovery.py"
click node_generator "https://github.com/guna-72/cdset_v4/blob/main/backend/app/experiment_generator.py"
click node_safety "https://github.com/guna-72/cdset_v4/blob/main/backend/app/safety_gate.py"
click node_chaos_engine "https://github.com/guna-72/cdset_v4/blob/main/backend/app/chaos_engine.py"
click node_sandbox "https://github.com/guna-72/cdset_v4/blob/main/backend/app/sandbox.py"
click node_diagnosis "https://github.com/guna-72/cdset_v4/blob/main/backend/app/diagnosis.py"
click node_providers "https://github.com/guna-72/cdset_v4/blob/main/backend/app/llm_providers.py"
click node_database "https://github.com/guna-72/cdset_v4/blob/main/backend/app/db.py"
click node_tutor_service "https://github.com/guna-72/cdset_v4/blob/main/backend/app/tutor.py"
click node_tutor_context "https://github.com/guna-72/cdset_v4/blob/main/backend/app/tutor_context.py"
click node_tutor_backend "https://github.com/guna-72/cdset_v4/blob/main/ai_tutor_backend/app.py"
click node_firebase "https://github.com/guna-72/cdset_v4/blob/main/chaos/src/firebase.js"

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_app,node_screens,node_tutor_screen,node_web_api,node_auth_context,node_user toneBlue
class node_api_routes,node_orchestrator,node_intake,node_git_intake,node_analyzer,node_failure_discovery,node_generator,node_safety,node_diagnosis,node_database toneAmber
class node_chaos_engine,node_sandbox toneMint
class node_tutor_service,node_tutor_context,node_tutor_backend toneRose
class node_providers,node_firebase,node_developer toneIndigo
```

## Components

### Frontend

- [App navigation](https://github.com/guna-72/cdset_v4/blob/main/chaos/src/App.jsx): `chaos/src/App.jsx`
- [Product screens](https://github.com/guna-72/cdset_v4/tree/main/chaos/src/pages): `chaos/src/pages`
- [Tutor screen](https://github.com/guna-72/cdset_v4/blob/main/chaos/src/pages/TutorPage.jsx): `chaos/src/pages/TutorPage.jsx`
- [Backend client](https://github.com/guna-72/cdset_v4/blob/main/chaos/src/api.js): `chaos/src/api.js`
- [Auth context](https://github.com/guna-72/cdset_v4/blob/main/chaos/src/context/AuthContext.jsx): `chaos/src/context/AuthContext.jsx`

### Core backend

- [HTTP API](https://github.com/guna-72/cdset_v4/blob/main/backend/app/api.py): `backend/app/api.py`
- [Pipeline orchestration](https://github.com/guna-72/cdset_v4/blob/main/backend/app/orchestrator.py): `backend/app/orchestrator.py`
- [Archive intake](https://github.com/guna-72/cdset_v4/blob/main/backend/app/intake.py): `backend/app/intake.py`
- [Git intake](https://github.com/guna-72/cdset_v4/blob/main/backend/app/git_intake.py): `backend/app/git_intake.py`
- [Static analysis](https://github.com/guna-72/cdset_v4/blob/main/backend/app/analyzer.py): `backend/app/analyzer.py`
- [Failure discovery](https://github.com/guna-72/cdset_v4/blob/main/backend/app/failure_discovery.py): `backend/app/failure_discovery.py`
- [Experiment generation](https://github.com/guna-72/cdset_v4/blob/main/backend/app/experiment_generator.py): `backend/app/experiment_generator.py`
- [Safety gate](https://github.com/guna-72/cdset_v4/blob/main/backend/app/safety_gate.py): `backend/app/safety_gate.py`
- [Failure diagnosis](https://github.com/guna-72/cdset_v4/blob/main/backend/app/diagnosis.py): `backend/app/diagnosis.py`
- [SQLite persistence](https://github.com/guna-72/cdset_v4/blob/main/backend/app/db.py): `backend/app/db.py`

### Experiment runtime

- [Fault injection](https://github.com/guna-72/cdset_v4/blob/main/backend/app/chaos_engine.py): `backend/app/chaos_engine.py`
- [Sandbox execution](https://github.com/guna-72/cdset_v4/blob/main/backend/app/sandbox.py): `backend/app/sandbox.py`

### AI tutoring

- [Tutor guidance](https://github.com/guna-72/cdset_v4/blob/main/backend/app/tutor.py): `backend/app/tutor.py`
- [Tutor context](https://github.com/guna-72/cdset_v4/blob/main/backend/app/tutor_context.py): `backend/app/tutor_context.py`
- [Tutor microservice](https://github.com/guna-72/cdset_v4/blob/main/ai_tutor_backend/app.py): `ai_tutor_backend/app.py`

### Identity and providers

- [LLM providers](https://github.com/guna-72/cdset_v4/blob/main/backend/app/llm_providers.py): `backend/app/llm_providers.py`
- [Firebase identity](https://github.com/guna-72/cdset_v4/blob/main/chaos/src/firebase.js): `chaos/src/firebase.js`

### Other components

- **Developer**
- **User**

## Connections

- Developer → App navigation: uses
- App navigation → Product screens: routes to (evidence: `chaos/src/App.jsx`)
- Product screens → Backend client: requests (evidence: `chaos/src/pages/ChaosLabPage.jsx`)
- Product screens → Backend client: requests (evidence: `chaos/src/pages/DashboardPage.jsx`)
- Tutor screen → Backend client: requests (evidence: `chaos/src/pages/TutorPage.jsx`)
- Backend client → HTTP API: sends requests
- Auth context → Firebase identity: uses (evidence: `chaos/src/context/AuthContext.jsx`)
- HTTP API → Pipeline orchestration: calls (evidence: `backend/app/api.py`)
- HTTP API → Tutor guidance: calls (evidence: `backend/app/api.py`)
- HTTP API → Tutor context: calls (evidence: `backend/app/api.py`)
- Pipeline orchestration → Archive intake: validates archives (evidence: `backend/app/orchestrator.py`)
- Pipeline orchestration → Git intake: imports repositories (evidence: `backend/app/orchestrator.py`)
- Pipeline orchestration → Static analysis: analyzes project (evidence: `backend/app/orchestrator.py`)
- Pipeline orchestration → Failure discovery: discovers surfaces (evidence: `backend/app/orchestrator.py`)
- Pipeline orchestration → Experiment generation: generates experiments (evidence: `backend/app/orchestrator.py`)
- Pipeline orchestration → Safety gate: checks safety (evidence: `backend/app/orchestrator.py`)
- Pipeline orchestration → Fault injection: runs approved tests (evidence: `backend/app/chaos_engine.py`)
- Fault injection → Sandbox execution: launches in (evidence: `backend/app/chaos_engine.py`)
- Pipeline orchestration → Failure diagnosis: diagnoses failures
- Failure diagnosis → LLM providers: uses providers
- Pipeline orchestration → SQLite persistence: stores run history (evidence: `backend/app/orchestrator.py`)
- Tutor guidance → Tutor context: uses context
- User → Tutor microservice: asks questions
