# hmcts/spring-boot-template architecture

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

- Interactive diagram: https://gitdiagram.com/hmcts/spring-boot-template
- Repository: https://github.com/hmcts/spring-boot-template

## Overview

##### Main Components
- Application Code: Represent the core Java application (the “src/main/java/uk/gov/hmcts/reform/demo” package) that provides the API functionalities.
- Build System: Highlight Gradle as the build tool (see build.gradle, gradlew scripts, and gradle wrapper). Also, show the integrated plugins, including HMCTS Java plugin, Checkstyle, OWASP Dependency Check, JaCoCo, and Spring Boot’s dependency management.
- Deployment Components:
- Docker: Include components for the Dockerfile, docker-compose.yml, and scripts under the “bin” directory. This encapsulates how the app is containerized and run.
- Helm & Kubernetes: Represent Helm charts under “charts/rpe-spring-boot-template” used for deploying the application in a Kubernetes-like environment.
- Configuration & External Dependencies:
- Configuration Files: Illustrate application configuration from src/main/resources/application.yaml and additional security configuration housed in the “config” directory.
- External Services: Show external integrations like publishing API documentation to “hmcts/cnp-api-docs” and integration with external container registries or API documentation services.

##### Relationships and Interactions
- Output from the build system feeding into Docker (using Dockerfile and docker-compose) to build container images.
- That the built container is deployed via Helm and managed by the infrastructure as code (Terraform in the “infrastructure” folder).
- CI/CD components such as the GitHub workflows and Jenkins pipelines to the build and deployment processes.
- How tests (unit, integration, functional, and smoke) are executed as part of the CI/CD pipeline to ensure quality at different stages.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Subgraph: Source Code & Configuration
    subgraph "Source Code & Configuration"
        A1["Spring Boot Application (Core API Code)"]:::code
        A2["Configuration Files"]:::config
    end

    %% Subgraph: CI/CD Pipeline & Testing
    subgraph "CI/CD Pipeline & Testing"
        P1["CI/CD Pipelines"]:::cicd
        subgraph "Testing Suites"
            T1["Unit Testing Suite"]:::test
            T2["Integration Testing Suite"]:::test
            T3["Functional Testing Suite"]:::test
            T4["Smoke Testing Suite"]:::test
        end
    end

    %% Subgraph: Build & Containerization
    subgraph "Build & Containerization"
        B1["Build System (Gradle & Plugins)"]:::build
        C1["Containerization (Docker)"]:::deploy
    end

    %% Subgraph: Deployment
    subgraph "Deployment"
        D1["Deployment via Helm/Kubernetes"]:::deploy
    end

    %% Connections between components
    P1 -->|"triggers"| B1
    P1 -->|"triggers"| T1
    P1 -->|"triggers"| T2
    P1 -->|"triggers"| T3
    P1 -->|"triggers"| T4
    A1 -->|"supplies"| B1
    A2 -->|"provides"| B1
    B1 -->|"buildsContainer"| C1
    C1 -->|"deployedVia"| D1

    %% Click Events for Component Mapping
    click A1 "https://github.com/hmcts/spring-boot-template/tree/master/src/main/java/uk/gov/hmcts/reform/demo"
    click A2 "https://github.com/hmcts/spring-boot-template/blob/master/src/main/resources/application.yaml"
    click A2 "https://github.com/hmcts/spring-boot-template/tree/master/config"
    click T1 "https://github.com/hmcts/spring-boot-template/tree/master/src/test"
    click T2 "https://github.com/hmcts/spring-boot-template/tree/master/src/integrationTest"
    click T3 "https://github.com/hmcts/spring-boot-template/tree/master/src/functionalTest"
    click T4 "https://github.com/hmcts/spring-boot-template/tree/master/src/smokeTest"
    click B1 "https://github.com/hmcts/spring-boot-template/blob/master/build.gradle"
    click B1 "https://github.com/hmcts/spring-boot-template/tree/master/gradlew"
    click B1 "https://github.com/hmcts/spring-boot-template/blob/master/gradlew.bat"
    click B1 "https://github.com/hmcts/spring-boot-template/tree/master/gradle/wrapper"
    click C1 "https://github.com/hmcts/spring-boot-template/tree/master/Dockerfile"
    click C1 "https://github.com/hmcts/spring-boot-template/blob/master/docker-compose.yml"
    click C1 "https://github.com/hmcts/spring-boot-template/tree/master/bin"
    click D1 "https://github.com/hmcts/spring-boot-template/tree/master/charts/rpe-spring-boot-template"
    click P1 "https://github.com/hmcts/spring-boot-template/tree/master/.github/workflows"
    click P1 "https://github.com/hmcts/spring-boot-template/tree/master/Jenkinsfile_nightly"
    click P1 "https://github.com/hmcts/spring-boot-template/tree/master/Jenkinsfile_template"
    click P1 "https://github.com/hmcts/spring-boot-template/tree/master/infrastructure"

    %% Styles
    classDef code fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef config fill:#d1c4e9,stroke:#000,stroke-width:2px;
    classDef test fill:#ffeb3b,stroke:#000,stroke-width:2px;
    classDef build fill:#c8e6c9,stroke:#000,stroke-width:2px;
    classDef deploy fill:#ffe0b2,stroke:#000,stroke-width:2px;
    classDef cicd fill:#f8bbd0,stroke:#000,stroke-width:2px;
```
