# kamalsrivastava/code_reviewer architecture

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

- Interactive diagram: https://gitdiagram.com/kamalsrivastava/code_reviewer
- Repository: https://github.com/kamalsrivastava/code_reviewer

## Overview

This is a React/Flask code review and unit-testing application for Python, Java, and JavaScript. Users edit code, choose a language, then execute it or request a review; review also triggers function extraction, AI test generation, and test execution. Results appear in the UI and can be downloaded as a PDF. The frontend request and response flow and the review implementation are sampled; test-generator and runner internals are represented only at their documented module boundaries.

Main entry points: [`backend/app.py`](https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/app.py) (Flask API), [`frontend/src/components/LeftSide.js`](https://github.com/kamalsrivastava/code_reviewer/blob/main/frontend/src/components/LeftSide.js) (Editor and Actions), [`frontend/src/components/RightSide.js`](https://github.com/kamalsrivastava/code_reviewer/blob/main/frontend/src/components/RightSide.js) (Results and Tabs), [`backend/code_reviewer.py`](https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/code_reviewer.py) (Review Orchestrator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_editor["Editor and Actions<br/>[LeftSide.js]"]
  node_appstate["App State<br/>[App.js]"]
  node_results["Results and Tabs<br/>[RightSide.js]"]
  node_pdf["PDF Report<br/>[RightSide.js]"]
end

subgraph group_api["API and Execution"]
  node_flask["Flask API<br/>[app.py]"]
  node_execution["Code Execution<br/>[app.py]"]
end

subgraph group_review["Code Review"]
  node_reviewer["Review Orchestrator<br/>[code_reviewer.py]"]
  node_static["Static Analysis<br/>[code_reviewer.py]"]
end

subgraph group_testing["Test Generation"]
  node_extractor["Function Extractor"]
  node_generator["Test Generator<br/>[test_generator.py]"]
  node_runner["Test Runner<br/>[test_runner.py]"]
end

node_user(("Developer"))
node_language_tools["Language Runtimes"]
node_openai["OpenAI API"]
node_test_tools["Test Frameworks"]

node_user -->|"enters code"| node_editor
node_editor -->|"requests execution"| node_flask
node_editor -->|"requests review"| node_flask
node_editor -->|"updates state"| node_appstate
node_appstate -->|"passes results"| node_results
node_results -->|"displays results"| node_user
node_results -->|"generates report"| node_pdf
node_pdf -->|"downloads PDF"| node_user
node_flask -->|"dispatches code"| node_execution
node_execution -->|"runs or compiles"| node_language_tools
node_flask -->|"calls review"| node_reviewer
node_reviewer -->|"runs analysis"| node_static
node_reviewer -->|"requests suggestions"| node_openai
node_flask -->|"extracts functions"| node_extractor
node_flask -->|"generates tests"| node_generator
node_flask -->|"runs generated tests"| node_runner
node_runner -.->|"executes tests"| node_test_tools
node_flask -->|"returns API results"| node_editor

click node_editor "https://github.com/kamalsrivastava/code_reviewer/blob/main/frontend/src/components/LeftSide.js"
click node_appstate "https://github.com/kamalsrivastava/code_reviewer/blob/main/frontend/src/App.js"
click node_results "https://github.com/kamalsrivastava/code_reviewer/blob/main/frontend/src/components/RightSide.js"
click node_pdf "https://github.com/kamalsrivastava/code_reviewer/blob/main/frontend/src/components/RightSide.js"
click node_flask "https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/app.py"
click node_execution "https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/app.py"
click node_reviewer "https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/code_reviewer.py"
click node_static "https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/code_reviewer.py"
click node_extractor "https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/function_extractor.py"
click node_generator "https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/test_generator.py"
click node_runner "https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/test_runner.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_editor,node_appstate,node_results,node_pdf toneBlue
class node_flask,node_execution toneAmber
class node_reviewer,node_static,node_openai toneMint
class node_extractor,node_generator,node_runner toneRose
class node_user,node_language_tools,node_test_tools toneIndigo
```

## Components

### Frontend

- [Editor and Actions](https://github.com/kamalsrivastava/code_reviewer/blob/main/frontend/src/components/LeftSide.js): `frontend/src/components/LeftSide.js`
- [App State](https://github.com/kamalsrivastava/code_reviewer/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Results and Tabs](https://github.com/kamalsrivastava/code_reviewer/blob/main/frontend/src/components/RightSide.js): `frontend/src/components/RightSide.js`
- [PDF Report](https://github.com/kamalsrivastava/code_reviewer/blob/main/frontend/src/components/RightSide.js): `frontend/src/components/RightSide.js`

### API and Execution

- [Flask API](https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/app.py): `backend/app.py`
- [Code Execution](https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/app.py): `backend/app.py`

### Code Review

- [Review Orchestrator](https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/code_reviewer.py): `backend/code_reviewer.py`
- [Static Analysis](https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/code_reviewer.py): `backend/code_reviewer.py`

### Test Generation

- [Function Extractor](https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/function_extractor.py): `backend/function_extractor.py`
- [Test Generator](https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/test_generator.py): `backend/test_generator.py`
- [Test Runner](https://github.com/kamalsrivastava/code_reviewer/blob/main/backend/test_runner.py): `backend/test_runner.py`

### Other components

- **Developer**
- **Language Runtimes**
- **OpenAI API**
- **Test Frameworks**

## Connections

- Developer → Editor and Actions: enters code
- Editor and Actions → Flask API: requests execution
- Editor and Actions → Flask API: requests review
- Editor and Actions → App State: updates state
- App State → Results and Tabs: passes results
- Results and Tabs → Developer: displays results
- Results and Tabs → PDF Report: generates report
- PDF Report → Developer: downloads PDF
- Flask API → Code Execution: dispatches code
- Code Execution → Language Runtimes: runs or compiles
- Flask API → Review Orchestrator: calls review
- Review Orchestrator → Static Analysis: runs analysis
- Review Orchestrator → OpenAI API: requests suggestions
- Flask API → Function Extractor: extracts functions
- Flask API → Test Generator: generates tests
- Flask API → Test Runner: runs generated tests
- Test Runner → Test Frameworks: executes tests
- Flask API → Editor and Actions: returns API results
