# varni1512/compileverse architecture

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

- Interactive diagram: https://gitdiagram.com/varni1512/compileverse
- Repository: https://github.com/varni1512/compileverse

## Overview

CompileVerse is a browser IDE for editing and running C++, Java, and Python, with test cases, complexity analysis, and an AI coding tutor. The main workflow runs from the IDE through execution state in `useCodeExecution`, to the Express API and sandbox, and back to the output panel. A separate tutor workflow uses `useAiChat`, server-side AI review, and RAG retrieval; voice interaction and admin analytics are additional capabilities. Some subsystems are documented but unsampled, so their internal wiring is shown only where the README or sampled code supports it.

Main entry points: [`frontend/src/App.jsx`](https://github.com/varni1512/compileverse/blob/main/frontend/src/App.jsx) (IDE Workspace), [`backend/index.js`](https://github.com/varni1512/compileverse/blob/main/backend/index.js) (Express API), [`backend/langchainRag.js`](https://github.com/varni1512/compileverse/blob/main/backend/langchainRag.js) (RAG Agent), [`frontend/src/hooks/useCodeExecution.js`](https://github.com/varni1512/compileverse/blob/main/frontend/src/hooks/useCodeExecution.js) (Execution State)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ide["IDE Client"]
  node_app["IDE Workspace<br/>[App.jsx]"]
  node_editor["Code Editor<br/>[CodeEditor.jsx]"]
  node_toolbar["Editor Toolbar<br/>[EditorToolbar.jsx]"]
  node_input["Input Panel<br/>[InputPanel.jsx]"]
  node_output["Output Panel<br/>[OutputPanel.jsx]"]
  node_bulk["Test Import<br/>[BulkAddModal.jsx]"]
  node_execution_hook["Execution State"]
  node_chat_hook["Chat State<br/>[useAiChat.js]"]
  node_voice["Voice Assistant<br/>[useVoiceAi.js]"]
  node_chat_ui["Tutor Chat<br/>[AiTutorChat.jsx]"]
  node_dashboard["Analytics Dashboard"]
end

subgraph group_api["API and Controls"]
  node_server["Express API<br/>[index.js]"]
  node_limits["AI Rate Limits<br/>[aiLimiter.js]"]
end

subgraph group_execution["Code Execution"]
  node_runner["Sandbox Runner<br/>[executeCode.js]"]
  node_runtime["Language Runtimes"]
end

subgraph group_tutor["AI Tutor"]
  node_review["AI Review<br/>[aiCodeReview.js]"]
  node_rag["RAG Agent<br/>[langchainRag.js]"]
  node_knowledge["Curated Knowledge"]
end

subgraph group_operations["Usage Analytics"]
  node_analytics["Usage Analytics<br/>[analytics.js]"]
end

node_developer(("Developer"))
node_groq{{"Groq LLM"}}
node_mongodb[("MongoDB")]
node_browser_speech{{"Browser Speech APIs"}}

node_developer -->|"uses IDE"| node_app
node_app -->|"renders"| node_editor
node_app -->|"renders"| node_toolbar
node_app -->|"renders"| node_input
node_app -->|"renders"| node_output
node_app -->|"opens import"| node_bulk
node_app -->|"invokes"| node_execution_hook
node_app -->|"invokes"| node_chat_hook
node_app -->|"shows dashboard"| node_dashboard
node_editor -->|"edits code"| node_app
node_toolbar -->|"sets language"| node_app
node_input -->|"sets input"| node_app
node_bulk -->|"imports cases"| node_app
node_execution_hook -->|"POST run, tests, analyze"| node_server
node_server -->|"executes code"| node_runner
node_runner -->|"runs in sandbox"| node_runtime
node_server -->|"requests analysis"| node_review
node_server -->|"checks AI quota"| node_limits
node_chat_hook -->|"POST review, fetch limits"| node_server
node_review -->|"uses RAG chat"| node_rag
node_review -->|"requests completion"| node_groq
node_rag -->|"indexes documents"| node_knowledge
node_rag -->|"invokes model"| node_groq
node_rag -->|"agent executes code"| node_runner
node_chat_ui -->|"uses voice controls"| node_voice
node_voice -.->|"recognizes and speaks"| node_browser_speech
node_dashboard -->|"requests statistics"| node_server
node_server -->|"records usage"| node_analytics
node_analytics -.->|"stores metrics"| node_mongodb
node_limits -.->|"stores quota state"| node_mongodb
node_execution_hook -->|"provides results"| node_output
node_chat_hook -->|"provides tutor state"| node_output

click node_app "https://github.com/varni1512/compileverse/blob/main/frontend/src/App.jsx"
click node_editor "https://github.com/varni1512/compileverse/blob/main/frontend/src/components/editor/CodeEditor.jsx"
click node_toolbar "https://github.com/varni1512/compileverse/blob/main/frontend/src/components/editor/EditorToolbar.jsx"
click node_input "https://github.com/varni1512/compileverse/blob/main/frontend/src/components/panels/InputPanel.jsx"
click node_output "https://github.com/varni1512/compileverse/blob/main/frontend/src/components/panels/OutputPanel.jsx"
click node_bulk "https://github.com/varni1512/compileverse/blob/main/frontend/src/components/modals/BulkAddModal.jsx"
click node_execution_hook "https://github.com/varni1512/compileverse/blob/main/frontend/src/hooks/useCodeExecution.js"
click node_chat_hook "https://github.com/varni1512/compileverse/blob/main/frontend/src/hooks/useAiChat.js"
click node_voice "https://github.com/varni1512/compileverse/blob/main/frontend/src/hooks/useVoiceAi.js"
click node_chat_ui "https://github.com/varni1512/compileverse/blob/main/frontend/src/components/chat/AiTutorChat.jsx"
click node_dashboard "https://github.com/varni1512/compileverse/blob/main/frontend/src/components/dashboard/AnalyticsDashboard.jsx"
click node_server "https://github.com/varni1512/compileverse/blob/main/backend/index.js"
click node_limits "https://github.com/varni1512/compileverse/blob/main/backend/aiLimiter.js"
click node_runner "https://github.com/varni1512/compileverse/blob/main/backend/executeCode.js"
click node_review "https://github.com/varni1512/compileverse/blob/main/backend/aiCodeReview.js"
click node_rag "https://github.com/varni1512/compileverse/blob/main/backend/langchainRag.js"
click node_knowledge "https://github.com/varni1512/compileverse/blob/main/backend/ragKnowledgeBase.js"
click node_analytics "https://github.com/varni1512/compileverse/blob/main/backend/analytics.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_editor,node_toolbar,node_input,node_output,node_bulk,node_execution_hook,node_chat_hook,node_voice,node_chat_ui,node_dashboard,node_browser_speech toneBlue
class node_server,node_limits,node_mongodb toneAmber
class node_runner,node_runtime toneMint
class node_review,node_rag,node_knowledge toneRose
class node_analytics,node_developer,node_groq toneIndigo
```

## Components

### IDE Client

- [IDE Workspace](https://github.com/varni1512/compileverse/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Code Editor](https://github.com/varni1512/compileverse/blob/main/frontend/src/components/editor/CodeEditor.jsx): `frontend/src/components/editor/CodeEditor.jsx`
- [Editor Toolbar](https://github.com/varni1512/compileverse/blob/main/frontend/src/components/editor/EditorToolbar.jsx): `frontend/src/components/editor/EditorToolbar.jsx`
- [Input Panel](https://github.com/varni1512/compileverse/blob/main/frontend/src/components/panels/InputPanel.jsx): `frontend/src/components/panels/InputPanel.jsx`
- [Output Panel](https://github.com/varni1512/compileverse/blob/main/frontend/src/components/panels/OutputPanel.jsx): `frontend/src/components/panels/OutputPanel.jsx`
- [Test Import](https://github.com/varni1512/compileverse/blob/main/frontend/src/components/modals/BulkAddModal.jsx): `frontend/src/components/modals/BulkAddModal.jsx`
- [Execution State](https://github.com/varni1512/compileverse/blob/main/frontend/src/hooks/useCodeExecution.js): `frontend/src/hooks/useCodeExecution.js`
- [Chat State](https://github.com/varni1512/compileverse/blob/main/frontend/src/hooks/useAiChat.js): `frontend/src/hooks/useAiChat.js`
- [Voice Assistant](https://github.com/varni1512/compileverse/blob/main/frontend/src/hooks/useVoiceAi.js): `frontend/src/hooks/useVoiceAi.js`
- [Tutor Chat](https://github.com/varni1512/compileverse/blob/main/frontend/src/components/chat/AiTutorChat.jsx): `frontend/src/components/chat/AiTutorChat.jsx`
- [Analytics Dashboard](https://github.com/varni1512/compileverse/blob/main/frontend/src/components/dashboard/AnalyticsDashboard.jsx): `frontend/src/components/dashboard/AnalyticsDashboard.jsx`

### API and Controls

- [Express API](https://github.com/varni1512/compileverse/blob/main/backend/index.js): `backend/index.js`
- [AI Rate Limits](https://github.com/varni1512/compileverse/blob/main/backend/aiLimiter.js): `backend/aiLimiter.js`

### Code Execution

- [Sandbox Runner](https://github.com/varni1512/compileverse/blob/main/backend/executeCode.js): `backend/executeCode.js`
- **Language Runtimes**

### AI Tutor

- [AI Review](https://github.com/varni1512/compileverse/blob/main/backend/aiCodeReview.js): `backend/aiCodeReview.js`
- [RAG Agent](https://github.com/varni1512/compileverse/blob/main/backend/langchainRag.js): `backend/langchainRag.js`
- [Curated Knowledge](https://github.com/varni1512/compileverse/blob/main/backend/ragKnowledgeBase.js): `backend/ragKnowledgeBase.js`

### Usage Analytics

- [Usage Analytics](https://github.com/varni1512/compileverse/blob/main/backend/analytics.js): `backend/analytics.js`

### Other components

- **Developer**
- **Groq LLM**
- **MongoDB**
- **Browser Speech APIs**

## Connections

- Developer → IDE Workspace: uses IDE
- IDE Workspace → Code Editor: renders
- IDE Workspace → Editor Toolbar: renders
- IDE Workspace → Input Panel: renders
- IDE Workspace → Output Panel: renders
- IDE Workspace → Test Import: opens import
- IDE Workspace → Execution State: invokes
- IDE Workspace → Chat State: invokes
- IDE Workspace → Analytics Dashboard: shows dashboard
- Code Editor → IDE Workspace: edits code
- Editor Toolbar → IDE Workspace: sets language
- Input Panel → IDE Workspace: sets input
- Test Import → IDE Workspace: imports cases
- Execution State → Express API: POST run, tests, analyze
- Express API → Sandbox Runner: executes code
- Sandbox Runner → Language Runtimes: runs in sandbox
- Express API → AI Review: requests analysis
- Express API → AI Rate Limits: checks AI quota
- Chat State → Express API: POST review, fetch limits
- AI Review → RAG Agent: uses RAG chat
- AI Review → Groq LLM: requests completion
- RAG Agent → Curated Knowledge: indexes documents
- RAG Agent → Groq LLM: invokes model
- RAG Agent → Sandbox Runner: agent executes code
- Tutor Chat → Voice Assistant: uses voice controls
- Voice Assistant → Browser Speech APIs: recognizes and speaks
- Analytics Dashboard → Express API: requests statistics
- Express API → Usage Analytics: records usage
- Usage Analytics → MongoDB: stores metrics
- AI Rate Limits → MongoDB: stores quota state
- Execution State → Output Panel: provides results
- Chat State → Output Panel: provides tutor state
