# subhashdoc234xyz/whatifgpt architecture

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

- Interactive diagram: https://gitdiagram.com/subhashdoc234xyz/whatifgpt
- Repository: https://github.com/subhashdoc234xyz/whatifgpt

## Overview

WhatIfGPT is a web app for exploring and modifying AI-generated reasoning. A user submits a question, the app displays the generated steps as a tree, and editing a step creates a fork that continues reasoning from the changed assumption. Users can request alternative steps, compare branches, and synthesize a final report for viewing and copying. The backend routes these operations through a reasoning parser and an LLM client; Groq is the documented model provider. Some frontend request handlers were not excerpted, so those links rely on README documentation.

Main entry points: [`frontend/src/App.jsx`](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/App.jsx) (App state and API), [`backend/main.py`](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/backend/main.py) (Reasoning API), [`backend/gpt_oss_client.py`](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/backend/gpt_oss_client.py) (LLM client), [`frontend/src/components/PromptInput.jsx`](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/components/PromptInput.jsx) (Prompt input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Reasoning interface"]
  node_app["App state and API<br/>[App.jsx]"]
  node_prompt["Prompt input<br/>[PromptInput.jsx]"]
  node_tree["Reasoning tree<br/>[ReasoningTree.jsx]"]
  node_editor["Step editor<br/>[NodeEditor.jsx]"]
  node_compare["Branch comparison<br/>[BranchCompare.jsx]"]
  node_report["Conclusion report<br/>[ConclusionView.jsx]"]
end

subgraph group_backend["Reasoning backend"]
  node_api["Reasoning API<br/>[main.py]"]
  node_parser["Step parser"]
end

subgraph group_ai["AI service"]
  node_client["LLM client<br/>[gpt_oss_client.py]"]
end

node_user(("User"))
node_groq{{"Groq API"}}

node_user -->|"submits question"| node_prompt
node_prompt -->|"submits prompt"| node_app
node_app -->|"renders reasoning"| node_tree
node_app -->|"opens editor"| node_editor
node_app -->|"shows comparison"| node_compare
node_app -->|"shows report"| node_report
node_app -->|"requests fork"| node_api
node_app -->|"requests generation"| node_api
node_app -->|"requests comparison"| node_api
node_app -->|"requests suggestions"| node_api
node_app -->|"requests conclusion"| node_api
node_api -->|"requests generation"| node_client
node_api -->|"requests comparison"| node_client
node_api -->|"requests suggestions"| node_client
node_api -->|"requests synthesis"| node_client
node_api -->|"parses generated steps"| node_parser
node_client -->|"requests completion"| node_groq

click node_app "https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/App.jsx"
click node_prompt "https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/components/PromptInput.jsx"
click node_tree "https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/components/ReasoningTree.jsx"
click node_editor "https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/components/NodeEditor.jsx"
click node_compare "https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/components/BranchCompare.jsx"
click node_report "https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/components/ConclusionView.jsx"
click node_api "https://github.com/subhashdoc234xyz/whatifgpt/blob/main/backend/main.py"
click node_parser "https://github.com/subhashdoc234xyz/whatifgpt/blob/main/backend/reasoning_parser.py"
click node_client "https://github.com/subhashdoc234xyz/whatifgpt/blob/main/backend/gpt_oss_client.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_app,node_prompt,node_tree,node_editor,node_compare,node_report,node_user toneBlue
class node_api,node_parser toneAmber
class node_client,node_groq toneMint
```

## Components

### Reasoning interface

- [App state and API](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Prompt input](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/components/PromptInput.jsx): `frontend/src/components/PromptInput.jsx`
- [Reasoning tree](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/components/ReasoningTree.jsx): `frontend/src/components/ReasoningTree.jsx`
- [Step editor](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/components/NodeEditor.jsx): `frontend/src/components/NodeEditor.jsx`
- [Branch comparison](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/components/BranchCompare.jsx): `frontend/src/components/BranchCompare.jsx`
- [Conclusion report](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/frontend/src/components/ConclusionView.jsx): `frontend/src/components/ConclusionView.jsx`

### Reasoning backend

- [Reasoning API](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/backend/main.py): `backend/main.py`
- [Step parser](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/backend/reasoning_parser.py): `backend/reasoning_parser.py`

### AI service

- [LLM client](https://github.com/subhashdoc234xyz/whatifgpt/blob/main/backend/gpt_oss_client.py): `backend/gpt_oss_client.py`

### Other components

- **User**
- **Groq API**

## Connections

- User → Prompt input: submits question (evidence: `README.md`)
- Prompt input → App state and API: submits prompt (evidence: `frontend/src/components/PromptInput.jsx`)
- App state and API → Reasoning tree: renders reasoning (evidence: `frontend/src/App.jsx`)
- App state and API → Step editor: opens editor (evidence: `frontend/src/App.jsx`)
- App state and API → Branch comparison: shows comparison (evidence: `frontend/src/App.jsx`)
- App state and API → Conclusion report: shows report (evidence: `frontend/src/App.jsx`)
- App state and API → Reasoning API: requests fork (evidence: `frontend/src/App.jsx`)
- App state and API → Reasoning API: requests generation (evidence: `README.md`)
- App state and API → Reasoning API: requests comparison (evidence: `README.md`)
- App state and API → Reasoning API: requests suggestions (evidence: `README.md`)
- App state and API → Reasoning API: requests conclusion (evidence: `README.md`)
- Reasoning API → LLM client: requests generation (evidence: `backend/main.py`)
- Reasoning API → LLM client: requests comparison (evidence: `backend/main.py`)
- Reasoning API → LLM client: requests suggestions (evidence: `backend/main.py`)
- Reasoning API → LLM client: requests synthesis (evidence: `backend/main.py`)
- Reasoning API → Step parser: parses generated steps (evidence: `backend/main.py`)
- LLM client → Groq API: requests completion (evidence: `backend/gpt_oss_client.py`)
