# membrane/spring-boot-vertical-slice-architecture architecture

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

- Interactive diagram: https://gitdiagram.com/membrane/spring-boot-vertical-slice-architecture
- Repository: https://github.com/membrane/spring-boot-vertical-slice-architecture

## Overview

##### Project Type and Purpose
- This is a Spring Boot full-stack application that leverages the Vertical Slice Architecture.
- The README explicitly mentions “vertical-slice-architecture,” so the design should emphasize feature-based modularization over traditional layered separation.
- It is self-contained with an embedded HSQL database, and it includes multiple vertical slices which handle different order operations (like AddOrder, CancelOrder, GetOrder, and GetOrders).

##### Analyzing the File Structure
- Top-level directories and key files:
- The root contains Maven wrapper scripts (mvnw, mvnw.cmd), pom.xml (for dependency management), and configuration files like .gitignore, HELP.md, and LICENSE.
- Under src/main/java/de/predic8:
▪ The App.java file acts as the entry point.
▪ The “config” folder contains configuration components like DataLoader (likely populates initial data) and ExceptionHandling.
▪ The “exceptions” folder holds custom exception classes (e.g., TooMuchException, WrongStateException) that the vertical slices might use.
▪ The “features” folder contains separate packages for each business operation (AddOrder, CancelOrder, GetOrder, GetOrders) – these are the vertical slices that encapsulate the functionality end-to-end.
▪ The “model” folder holds domain models (Order, Item) and repository interfaces for data access, connecting the various slices to the database.
- The resources directory provides application.properties for runtime configuration of the application (including database settings).

##### Final Advice for the Principal Software Engineer
- Be as detailed as possible by breaking down the components into every logical feature slice.
- The goal is to capture the self-contained, feature-focused nature of the vertical slices while showing how the application as a whole is bootstrapped, configured, and how it persists data.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Application Bootstrapping"
        A["App (Entry Point)"]:::entry
    end

    subgraph "Configuration"
        DL["DataLoader"]:::config
        EH["ExceptionHandling"]:::config
        CE["Custom Exceptions"]:::config
    end

    subgraph "Vertical Slices"
        AO["AddOrder"]:::vertical
        CO["CancelOrder"]:::vertical
        GO["GetOrder"]:::vertical
        GOS["GetOrders"]:::vertical
    end

    subgraph "Domain & Data Access"
        OR["OrderRepository"]:::domain
        O["Order"]:::domain
        I["Item"]:::domain
    end

    subgraph "Persistence"
        DB["Embedded HSQL DB"]:::persistence
    end

    EX["API Testing (requests.http)"]:::external

    %% App initializing configuration and features
    A -->|"initConfig"| DL
    A -->|"initConfig"| EH
    A -->|"initSlices"| AO
    A -->|"initSlices"| CO
    A -->|"initSlices"| GO
    A -->|"initSlices"| GOS

    %% DataLoader populates domain data
    DL -->|"populates"| OR

    %% ExceptionHandling applies to vertical slices
    EH -->|"handles"| AO
    EH -->|"handles"| CO
    EH -->|"handles"| GO
    EH -->|"handles"| GOS

    %% Vertical slices interact with domain layer
    AO -->|"calls"| OR
    CO -->|"calls"| OR
    GO -->|"calls"| OR
    GOS -->|"calls"| OR

    %% Domain repository persists data to database
    OR -->|"persists"| DB

    %% External API testing tool invokes vertical slice endpoints
    EX -->|"tests"| AO
    EX -->|"tests"| CO
    EX -->|"tests"| GO
    EX -->|"tests"| GOS

    %% Click Events
    click A "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/src/main/java/de/predic8/App.java"
    click DL "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/src/main/java/de/predic8/config/DataLoader.java"
    click EH "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/src/main/java/de/predic8/config/ExceptionHandling.java"
    click CE "https://github.com/membrane/spring-boot-vertical-slice-architecture/tree/main/src/main/java/de/predic8/exceptions"
    click AO "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/src/main/java/de/predic8/features/AddOrder.java"
    click CO "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/src/main/java/de/predic8/features/CancelOrder.java"
    click GO "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/src/main/java/de/predic8/features/GetOrder.java"
    click GOS "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/src/main/java/de/predic8/features/GetOrders.java"
    click O "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/src/main/java/de/predic8/model/Order.java"
    click I "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/src/main/java/de/predic8/model/Item.java"
    click OR "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/src/main/java/de/predic8/model/OrderRepository.java"
    click DB "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/src/main/resources/application.properties"
    click EX "https://github.com/membrane/spring-boot-vertical-slice-architecture/blob/main/requests.http"

    %% Styling
    classDef entry fill:#f9f,stroke:#333,stroke-width:2px;
    classDef config fill:#bbf,stroke:#333,stroke-width:2px;
    classDef vertical fill:#bfb,stroke:#333,stroke-width:2px;
    classDef domain fill:#ff9,stroke:#333,stroke-width:2px;
    classDef persistence fill:#fdd,stroke:#333,stroke-width:2px;
    classDef external fill:#dfd,stroke:#333,stroke-width:2px;
```
