# hugues-dtankouo/problems architecture

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

- Interactive diagram: https://gitdiagram.com/hugues-dtankouo/problems
- Repository: https://github.com/hugues-dtankouo/problems

## Overview

##### Main System Components

a) Web Application Layer:
- Frontend (Templates & Static Assets)
- Backend (FastAPI/Jinja Server)
- Problem Engine
- Testing Framework

b) Core Components:
- Problem Repository
- Code Execution Engine
- Test Runner
- User Interface

**┌─ Web Browser ─┐**
- CodeMirror  │
- HTML/CSS/JS │
- ┬────────┘

**┌─ FastAPI Server ──┐    ┌─ Problem Engine ─┐**
- Route Handling  │←→│ - Problem Loader  │
- Template Engine │    │ - Code Executor  │
- ┬─────────┘    └────────┬────────┘

- ┌────┴───────────────────────┴────┐
- Test Framework           │
- Pytest Integration           │
- Test Case Management        │
- ┬──────────────┘

**┌─ Problem Repository ─┐    ┌─ Test Data ─┐**
- Anagram           │←→│ - Test Cases │
- Knapsack         │    │ - Fixtures  │
- ┘    └────────────┘

##### Implementation Details

- The separation between problem definitions (/src/problems)
- Test implementation (/tests)
- Frontend assets (templates and static folders)
- Configuration files (poetry.toml, pyproject.toml)

##### Key Interactions

Flows:

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef problem fill:#f1c40f,stroke:#f39c12,color:black
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef test fill:#e74c3c,stroke:#c0392b,color:white

    %% User Interface Layer
    subgraph UI
        Browser["Web Browser"]
        CodeMirror["CodeMirror Editor"]
        Templates["Templates & Static"]
    end
    class Browser,CodeMirror,Templates ui

    %% Application Core Layer
    subgraph Core
        FastAPI["FastAPI Server"]
        ProblemEngine["Problem Engine"]
        TestRunner["Test Runner"]
    end
    class FastAPI,ProblemEngine,TestRunner core

    %% Problem Management Layer
    subgraph Problems
        ProbRepo["Problem Repository"]
        Interface["Problem Interface"]
        Scripts["Execution Scripts"]
    end
    class ProbRepo,Interface,Scripts problem

    %% Storage Layer
    subgraph Storage
        TestData["Test Data"]
        Config["Configuration"]
        Types["Type Definitions"]
    end
    class TestData,Config,Types storage

    %% Test Framework Layer
    subgraph Testing
        PyTest["PyTest Integration"]
        TestCases["Test Cases"]
    end
    class PyTest,TestCases test

    %% Relationships
    Browser --> CodeMirror
    CodeMirror --> FastAPI
    FastAPI --> Templates
    FastAPI --> ProblemEngine
    ProblemEngine --> Interface
    Interface --> ProbRepo
    ProblemEngine --> TestRunner
    TestRunner --> PyTest
    PyTest --> TestCases
    TestCases --> TestData
    ProbRepo --> Scripts

    %% Click Events
    click Templates "https://github.com/Hugues-DTANKOUO/problems/tree/main/src/problems/templates/"
    click ProbRepo "https://github.com/Hugues-DTANKOUO/problems/tree/main/src/problems/"
    click Interface "https://github.com/Hugues-DTANKOUO/problems/blob/main/src/problems/interface.py"
    click Scripts "https://github.com/Hugues-DTANKOUO/problems/blob/main/src/problems/scripts.py"
    click TestRunner "https://github.com/Hugues-DTANKOUO/problems/tree/main/tests/"
    click TestCases "https://github.com/Hugues-DTANKOUO/problems/tree/main/src/problems/inside_test/"
    click TestData "https://github.com/Hugues-DTANKOUO/problems/tree/main/src/problems/inside_test/data/"
    click Config "https://github.com/Hugues-DTANKOUO/problems/blob/main/pyproject.toml"
    click Types "https://github.com/Hugues-DTANKOUO/problems/blob/main/src/problems/py.typed"

    %% Legend
    subgraph Legend
        UI_L["User Interface"]:::ui
        Core_L["Core Services"]:::core
        Problem_L["Problem Components"]:::problem
        Storage_L["Storage"]:::storage
        Test_L["Testing"]:::test
    end
```
