# miarantsoo/springlike architecture

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

- Interactive diagram: https://gitdiagram.com/miarantsoo/springlike
- Repository: https://github.com/miarantsoo/springlike

## Overview

##### Project type and purpose
- This is a lightweight, annotation-driven Java web framework (MVC+REST) that runs on any Servlet container.
- It scans user-defined controllers (@Controller/@RestAPI), maps HTTP verbs (@Get/@Post) and URLs (@Url), validates input, manages sessions, and renders responses (ModelAndView or JSON via Gson).

##### File structure
- Top-level:
- bin/… compiled .class files
- lib/… external JARs (servlet-api, Gson, Paranamer)
- src/… Java source
- jar_transform scripts (build wrapper)
- Under src/itu/etu2779:
- annotation/… all custom annotations (Controller, Get, Post, Url, validation, auth)
- controller/FrontController.java (Servlet entry point)
- mapping/LoadController.java, Mapper.java (scanning & URL→method resolution)
- servlet/ModelAndView.java, CustomSession.java
- exception/… validation exceptions
- utils/ValidationUtils, Utilitaire

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client and Container
    Client["Client (Browser/API)"]:::external
    ServletContainer["Servlet Container"]:::external

    %% Core Framework Components
    subgraph "Core Framework" 
        direction TB
        FrontController["FrontController Servlet"]:::core
        subgraph "Annotation Scanner & Mapper"
            direction TB
            LoadController["LoadController"]:::core
            Mapper["Mapper"]:::core
            VerbMethod["VerbMethod"]:::core
        end
    end

    %% Modules and Layers
    subgraph "Framework Modules"
        direction TB
        ValidationModule["Validation Module"]:::util
        ControllerLayer["Controller Layer"]:::extension
        SessionManager["CustomSession"]:::core
        ViewResolver["ModelAndView"]:::core
        JSONSerializer["Gson JSON Serializer"]:::external
        UtilityHelpers["Utilitaire"]:::util
    end

    %% External Libraries
    subgraph "External Libraries"
        direction TB
        ServletAPI["Servlet API"]:::external
        GsonLib["Gson"]:::external
        ParanamerLib["Paranamer"]:::external
    end

    %% Connections
    Client -->|"HTTP Request"| ServletContainer
    ServletContainer -->|"invoke service()"| FrontController
    FrontController -->|"Reflective Scan"| LoadController
    LoadController -->|"Find method by URL/Verb"| Mapper
    Mapper -->|"map to VerbMethod"| VerbMethod
    Mapper -->|"Validate Inputs"| ValidationModule
    ValidationModule -->|"throws Exception on fail"| ControllerLayer
    Mapper -->|"Invoke Controller Method"| ControllerLayer
    Mapper -->|"Inject Session"| SessionManager
    ControllerLayer -->|"returns ModelAndView"| ViewResolver
    ControllerLayer -->|"returns @RestAPI object"| JSONSerializer
    FrontController -->|"Render View/JSON"| ServletContainer
    ServletContainer -->|"HTTP Response"| Client

    %% Click Events
    click FrontController "https://github.com/miarantsoo/springlike/blob/main/src/itu/etu2779/controller/FrontController.java"
    click LoadController "https://github.com/miarantsoo/springlike/blob/main/src/itu/etu2779/mapping/LoadController.java"
    click Mapper "https://github.com/miarantsoo/springlike/blob/main/src/itu/etu2779/mapping/Mapper.java"
    click VerbMethod "https://github.com/miarantsoo/springlike/blob/main/src/itu/etu2779/mapping/VerbMethod.java"
    click ValidationModule "https://github.com/miarantsoo/springlike/tree/main/src/itu/etu2779/annotation/validation"
    click ValidationModule "https://github.com/miarantsoo/springlike/blob/main/src/itu/etu2779/utils/ValidationUtils.java"
    click SessionManager "https://github.com/miarantsoo/springlike/blob/main/src/itu/etu2779/servlet/CustomSession.java"
    click ViewResolver "https://github.com/miarantsoo/springlike/blob/main/src/itu/etu2779/servlet/ModelAndView.java"
    click UtilityHelpers "https://github.com/miarantsoo/springlike/blob/main/src/itu/etu2779/utils/Utilitaire.java"
    click ServletAPI "https://github.com/miarantsoo/springlike/blob/main/lib/servlet-api.jar"
    click GsonLib "https://github.com/miarantsoo/springlike/blob/main/lib/gson-2.8.8.jar"
    click ParanamerLib "https://github.com/miarantsoo/springlike/blob/main/lib/paranamer-2.8.jar"

    %% Styles
    classDef core fill:#D0E8FF,stroke:#3399FF,stroke-width:2px
    classDef extension fill:#E0FFE0,stroke:#33CC33,stroke-width:2px
    classDef util fill:#FFF0D0,stroke:#FF9933,stroke-width:2px
    classDef external fill:#F0F0F0,stroke:#888888,stroke-width:1px,stroke-dasharray: 2 2
```
