# fhnw-int/spring-boot-controller-solution architecture

> Architecture diagram of the GitHub repository fhnw-int/spring-boot-controller-solution, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fhnw-int/spring-boot-controller-solution
- Repository: https://github.com/fhnw-int/spring-boot-controller-solution

## Overview

##### Project type and purpose
- From the file tree and README, this is a single-module Spring Boot application named “pizza.”
- It exposes HTTP endpoints via two controllers (PizzaController and WelcomeController) and comes with a basic Maven build, unit tests, and a devcontainer for development.

##### File structure
- Top-level:
- .devcontainer/ : VS Code dev‐container definitions
- pizza/ : Maven project root
- README.md, .gitignore
- Inside pizza/:
- pom.xml, mvnw: Maven wrapper and project configuration
- src/main/java/ch/fhnw/pizza:
– PizzaApplication.java: Spring Boot entry point
– PizzaController.java: REST API for pizza resources
– WelcomeController.java: simple welcome endpoint
– Pizza.java: domain model class
- src/main/resources/application.properties: externalized config
- src/test/java/ch/fhnw/pizza: JUnit tests for the application

##### README
- Minimal description: “Spring-Boot-Solution” for Internet Technology course
- No additional architecture notes—so we’ll infer from code structure

a. Main components
1. External client (Browser, Mobile app, CLI tool)
2. HTTP layer (Embedded Tomcat in Spring Boot)
3. Controllers:
– WelcomeController
– PizzaController
4. Domain Model (Pizza.java)
5. (Optional placeholder) Persistence layer or in-memory store
6. Build & Dev:
– Maven (pom.xml, mvnw)
– Devcontainer (.devcontainer/ files)
7. Testing (JUnit test suite)

b. Relationships and interactions
- Client → HTTP(S) request → Embedded Tomcat
- Tomcat → DispatcherServlet → matching Controller
- Controller → maps requests to domain objects (Pizza instances)
- Domain → returned as JSON (via Spring MVC’s MessageConverters)
- Controller → (future) calls to repository/service layer → Database
- Build: Developer code commit → Maven compile/test → Docker/devcontainer

c. Architectural patterns
- Layered MVC:
- Presentation (Controllers)
- Domain (Models)
- Infrastructure (web server, build tools)
- Convention-over-configuration via Spring Boot
- Single-module monolith with clear separation of concerns

d. Key technologies
- Java 17+ (inferred)
- Spring Boot (starter-web)
- Spring MVC / REST
- Maven / wrapper
- JUnit 5
- VS Code Devcontainer (Docker)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External actors
    Developer["Developer"]:::external
    Client["External Client"]:::external

    %% Development tools
    subgraph "Development Environment"
        Maven["Maven Build\n(pom.xml, mvnw*)"]:::tool
        DevContainer["Devcontainer\n(.devcontainer)"]:::tool
        TestSuite["JUnit Tests\n(PizzaApplicationTests)"]:::test
    end

    %% Application components
    subgraph "Spring Boot Application"
        Tomcat["Embedded Tomcat\n(PizzaApplication)"]:::application
        WelcomeController["WelcomeController"]:::controller
        PizzaController["PizzaController"]:::controller
        PizzaModel["Pizza.java"]:::domain
        Config["application.properties"]:::config
        DB["In-Memory Store\n(Placeholder)"]:::database
    end

    %% Flows
    Developer -->|build & test| Maven
    Maven -->|runs in| DevContainer
    Maven -->|executes tests| TestSuite

    Client -->|HTTP Request| Tomcat
    Tomcat -->|dispatches| WelcomeController
    Tomcat -->|dispatches| PizzaController
    WelcomeController -->|returns JSON| Client
    PizzaController -->|uses| PizzaModel
    PizzaController -->|returns JSON| Client
    PizzaController -->|reads/writes| DB

    %% Click Events
    click Tomcat "https://github.com/fhnw-int/spring-boot-controller-solution/blob/main/pizza/src/main/java/ch/fhnw/pizza/PizzaApplication.java"
    click WelcomeController "https://github.com/fhnw-int/spring-boot-controller-solution/blob/main/pizza/src/main/java/ch/fhnw/pizza/WelcomeController.java"
    click PizzaController "https://github.com/fhnw-int/spring-boot-controller-solution/blob/main/pizza/src/main/java/ch/fhnw/pizza/PizzaController.java"
    click PizzaModel "https://github.com/fhnw-int/spring-boot-controller-solution/blob/main/pizza/src/main/java/ch/fhnw/pizza/Pizza.java"
    click Config "https://github.com/fhnw-int/spring-boot-controller-solution/blob/main/pizza/src/main/resources/application.properties"
    click Maven "https://github.com/fhnw-int/spring-boot-controller-solution/blob/main/pizza/pom.xml"
    click DevContainer "https://github.com/fhnw-int/spring-boot-controller-solution/blob/main/.devcontainer/devcontainer.json"
    click TestSuite "https://github.com/fhnw-int/spring-boot-controller-solution/blob/main/pizza/src/test/java/ch/fhnw/pizza/PizzaApplicationTests.java"

    %% Styles
    classDef application fill:#cce5ff,stroke:#004085,color:#004085;
    classDef controller fill:#b3d7ff,stroke:#0056b3,color:#0056b3;
    classDef domain fill:#d0e9c6,stroke:#3c763d,color:#3c763d;
    classDef database fill:#dff0d8,stroke:#3c763d,color:#3c763d,shape:cylinder;
    classDef tool fill:#f0f0f0,stroke:#999999,color:#333333;
    classDef config fill:#fce5cd,stroke:#b45f06,color:#b45f06;
    classDef test fill:#f5c6cb,stroke:#721c24,color:#721c24;
    classDef external fill:#fff3cd,stroke:#856404,color:#856404;
```
