# lohitpt252003/code architecture

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

- Interactive diagram: https://gitdiagram.com/lohitpt252003/code
- Repository: https://github.com/lohitpt252003/code

## Overview

##### Main Components Identification
The system consists of these primary components:

a) Frontend Layer (React Application)
- User Interface Components
- Code Editor
- Problem Viewer
- Test Case Display
- Results Display

b) Backend Layer (Python Flask)
- Code Execution Engine
- Problem Management
- Test Case Handler

c) File System Storage
- Problem Repository
- Test Cases Storage (Hidden & Visible)

**┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐**
- Frontend     │     │     Backend     │     │   File System   │
- (React App)    │◄───►│  (Flask App)    │◄───►│    Storage      │
- ┘     └─────────────────┘     └─────────────────┘

##### Detailed Component Breakdown

Frontend (React):
**┌─────────────────────────────┐**
- React Components            │
- ┤
- Navbar                    │
- Problems List            │
- Problem View             │
- Test Cases Display       │
- Code Editor              │
- Results Display          │
- ┘

Backend (Flask):
**┌─────────────────────────────┐**
- Flask Server               │
- ┤
- Code Execution Engine    │
- Problem Manager          │
- Test Case Handler        │
- ┘

Storage Structure:
**┌─────────────────────────────┐**
- Problem Repository         │
- ┤
- Problem Statements       │
- Test Cases              │
- Visible              │
- Hidden               │
- ┘

##### Additional Elements
- Version/environment information
- Security boundaries if applicable
- Async vs sync operations

##### Specific Implementation Notes
- Separation between visible and hidden test cases
- Code execution sandbox environment
- Problem data structure organization
- Frontend component hierarchy

Remember to:
- Use consistent styling
- A title and description
- Timestamps and version information
- Document any assumptions made

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        App["React App"]
        Nav["Navigation"]
        ProbList["Problems List"]
        ProbView["Problem Viewer"]
        TestView["Test Cases Display"]
        CodeEdit["Code Editor"]
        Results["Results Display"]
        CodeExec["Code Execution Interface"]
        TCHandler["Test Case Handler"]
    end

    subgraph Backend
        Server["Flask Server"]
        ExecEngine["Code Execution Engine"]
        ProbManager["Problem Manager"]
        TCProcessor["Test Case Processor"]
    end

    subgraph Storage
        ProbRepo["Problem Repository"]
        TestCases["Test Cases Storage"]
        VisibleTC["Visible Test Cases"]
        HiddenTC["Hidden Test Cases"]
        ProbStatements["Problem Statements"]
    end

    %% Frontend Relationships
    App --> Nav
    App --> ProbList
    App --> ProbView
    App --> TestView
    App --> CodeEdit
    App --> Results
    ProbView --> CodeExec
    TestView --> TCHandler

    %% Backend Relationships
    Server --> ExecEngine
    Server --> ProbManager
    Server --> TCProcessor

    %% Storage Relationships
    ProbRepo --> TestCases
    TestCases --> VisibleTC
    TestCases --> HiddenTC
    ProbRepo --> ProbStatements

    %% Cross-layer Relationships
    CodeExec -.->|API Calls| Server
    TCHandler -.->|Fetch Test Cases| Server
    Server -->|Read/Write| ProbRepo

    %% Click Events
    click App "https://github.com/lohitpt252003/CODE/blob/main/frontend/src/App.js"
    click Nav "https://github.com/lohitpt252003/CODE/blob/main/frontend/src/Components/Navbar/Navbar.jsx"
    click ProbList "https://github.com/lohitpt252003/CODE/blob/main/frontend/src/Components/Problems/Problems.jsx"
    click ProbView "https://github.com/lohitpt252003/CODE/blob/main/frontend/src/Components/Problem/Problem.jsx"
    click TestView "https://github.com/lohitpt252003/CODE/blob/main/frontend/src/Components/TestCases/TestCases.jsx"
    click CodeExec "https://github.com/lohitpt252003/CODE/blob/main/frontend/src/utils/codeExecution.js"
    click TCHandler "https://github.com/lohitpt252003/CODE/blob/main/frontend/src/utils/getCases.js"
    click Server "https://github.com/lohitpt252003/CODE/blob/main/backend/app.py"
    click ExecEngine "https://github.com/lohitpt252003/CODE/blob/main/backend/run_code/run_code.py"
    click ProbRepo "https://github.com/lohitpt252003/CODE/tree/main/backend/problems/"
    click HiddenTC "https://github.com/lohitpt252003/CODE/tree/main/backend/problems/*/testcases/hidden/"
    click VisibleTC "https://github.com/lohitpt252003/CODE/tree/main/backend/problems/*/testcases/visible/"
    click ProbStatements "https://github.com/lohitpt252003/CODE/blob/main/backend/problems/*/statement/statement.txt"

    %% Styling
    classDef frontend fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef backend fill:#b7ffa8,stroke:#333,stroke-width:2px
    classDef storage fill:#ffe4a8,stroke:#333,stroke-width:2px

    class App,Nav,ProbList,ProbView,TestView,CodeEdit,Results,CodeExec,TCHandler frontend
    class Server,ExecEngine,ProbManager,TCProcessor backend
    class ProbRepo,TestCases,VisibleTC,HiddenTC,ProbStatements storage
```
