# tombovelo/framework architecture

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

- Interactive diagram: https://gitdiagram.com/tombovelo/framework
- Repository: https://github.com/tombovelo/framework

## Overview

##### Project type and purpose
- A FrontController to centralize all HTTP requests
- Annotation classes (@Get, @Post, @RestAPI, @Url, etc.) for mapping URLs to controller methods
- A ModelView abstraction for returning data + view name
- Wrappers for request- and session-handling (MyRequestWrapper, MySession)
- Validation and error-handling (Required, RequiredRoles, DetailedValidationException, ErrorPage)
- Utility components (MyFile, Utils)

##### File structure
- All classes live at top level (no subdirs). They fall into these logical packages/components:
a. Core Controller Layer: FrontController.java, Controller.java, Mapping.java, VerbAction.java
b. Annotations & Routing: Get.java, Post.java, Url.java, RestAPI.java
c. Model & View: ModelView.java, UserInterface.java
d. Request/Session Wrappers: MyRequestWrapper.java, MySession.java
e. Validation & Errors: Required.java, RequiredRoles.java, DetailedValidationException.java, DuplicateUrlException.java, BuildException.java, ErrorPage.java
f. Utilities & Helpers: MyFile.java, Params.java, Numerique.java, Utils.java

##### README
- The README only states “framework” and contains garbled characters—no additional architecture guidance.

##### Elements
- Extension points (Annotations, Validation) in another
- Utility modules (MyFile, Utils) in a third

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External
    External["Client (Browser / HTTP Consumer)"]:::external
    %% Web Container
    WebContainer["Web Container / Servlet Engine"]:::core

    %% Framework Core
    subgraph "Framework Core"
        FC["FrontController"]:::core
        AS["Annotation Scanner"]:::core
        subgraph "Routing/Mapping Registry"
            Map["Mapping Registry (Mapping.java)"]:::core
            Verb["HTTP Verb Actions (VerbAction.java)"]:::core
        end
        PB["Parameter Binder"]:::core
        VR["View Resolver"]:::core
        ED["Response Dispatcher"]:::core
    end

    %% Annotations & Routing
    subgraph "Annotations & Routing"
        GET["@Get"]:::annotations
        POST["@Post"]:::annotations
        REST["@RestAPI"]:::annotations
        URLA["@Url"]:::annotations
    end

    %% User Controllers
    subgraph "Controller Layer"
        CTRL_IF["Controller Interface (Controller.java)"]:::controllers
        CH["Controller Handlers"]:::controllers
    end

    %% Model & View
    subgraph "Model & View"
        MV["ModelView Factory (ModelView.java)"]:::modelview
        UI["View Interface (UserInterface.java)"]:::modelview
    end

    %% Wrappers
    subgraph "Request & Session Wrappers"
        REQ_WRAP["MyRequestWrapper"]:::wrappers
        SES["MySession"]:::wrappers
    end

    %% Validation & Errors
    subgraph "Validation & Error Handling"
        subgraph Validation
            VF["Required Annotation (Required.java)"]:::validation
            VRoles["RequiredRoles Annotation (RequiredRoles.java)"]:::validation
            DVE["DetailedValidationException (DetailedValidationException.java)"]:::validation
        end
        subgraph Exceptions
            DUP["DuplicateUrlException (DuplicateUrlException.java)"]:::errors
            BE["BuildException (BuildException.java)"]:::errors
        end
        EP["ErrorPage Generator (ErrorPage.java)"]:::errors
    end

    %% Utilities
    subgraph "Utilities & Helpers"
        MF["MyFile (MyFile.java)"]:::utils
        PM["Params Parser (Params.java)"]:::utils
        NUM["Numerique Converter (Numerique.java)"]:::utils
        U["Utils (Utils.java)"]:::utils
    end

    %% Flow
    External -->|"HTTP Request"| WebContainer
    WebContainer -->|"forwards"| FC
    FC -->|"scan annotations at startup"| AS
    AS --> Map
    AS --> Verb
    FC -->|"lookup route"| Map
    Map -->|"select action"| Verb
    FC -->|"wrap request"| REQ_WRAP
    REQ_WRAP -->|"bind params"| PB
    PB --> PM
    PB --> NUM
    PB -->|"validate"| VF
    PB -->|"validate"| VRoles
    VF --> DVE
    VRoles --> DVE
    DVE --> EP
    FC --> CTRL_IF
    CTRL_IF --> CH
    CH -->|"invoke"| PB
    CH -->|"execute method"| MV
    MV --> UI
    MV --> VR
    VR --> ED
    ED -->|"render response"| WebContainer
    WebContainer -->|"HTTP Response"| External
    %% Utilities usage
    CH --> MF
    CH --> U
    sesLink(SES) -.-> FC
    EP -->|"generate error page"| ED

    %% Click Events
    click FC "https://github.com/tombovelo/framework/blob/main/FrontController.java"
    click Map "https://github.com/tombovelo/framework/blob/main/Mapping.java"
    click Verb "https://github.com/tombovelo/framework/blob/main/VerbAction.java"
    click GET "https://github.com/tombovelo/framework/blob/main/Get.java"
    click POST "https://github.com/tombovelo/framework/blob/main/Post.java"
    click REST "https://github.com/tombovelo/framework/blob/main/RestAPI.java"
    click URLA "https://github.com/tombovelo/framework/blob/main/Url.java"
    click CTRL_IF "https://github.com/tombovelo/framework/blob/main/Controller.java"
    click MV "https://github.com/tombovelo/framework/blob/main/ModelView.java"
    click UI "https://github.com/tombovelo/framework/blob/main/UserInterface.java"
    click REQ_WRAP "https://github.com/tombovelo/framework/blob/main/MyRequestWrapper.java"
    click SES "https://github.com/tombovelo/framework/blob/main/MySession.java"
    click VF "https://github.com/tombovelo/framework/blob/main/Required.java"
    click VRoles "https://github.com/tombovelo/framework/blob/main/RequiredRoles.java"
    click DVE "https://github.com/tombovelo/framework/blob/main/DetailedValidationException.java"
    click DUP "https://github.com/tombovelo/framework/blob/main/DuplicateUrlException.java"
    click BE "https://github.com/tombovelo/framework/blob/main/BuildException.java"
    click EP "https://github.com/tombovelo/framework/blob/main/ErrorPage.java"
    click MF "https://github.com/tombovelo/framework/blob/main/MyFile.java"
    click PM "https://github.com/tombovelo/framework/blob/main/Params.java"
    click NUM "https://github.com/tombovelo/framework/blob/main/Numerique.java"
    click U "https://github.com/tombovelo/framework/blob/main/Utils.java"

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-width:1px
    classDef core fill:#bbf,stroke:#333,stroke-width:1px
    classDef annotations fill:#bfb,stroke:#333,stroke-width:1px
    classDef controllers fill:#fbf,stroke:#333,stroke-width:1px
    classDef modelview fill:#ffb,stroke:#333,stroke-width:1px
    classDef wrappers fill:#fbb,stroke:#333,stroke-width:1px
    classDef validation fill:#fb8,stroke:#333,stroke-width:1px
    classDef errors fill:#f88,stroke:#333,stroke-width:1px
    classDef utils fill:#8bf,stroke:#333,stroke-width:1px
```
