# tanchengbin/jenkins-ci-demo architecture

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

- Interactive diagram: https://gitdiagram.com/tanchengbin/jenkins-ci-demo
- Repository: https://github.com/tanchengbin/jenkins-ci-demo

## Overview

##### Project Type and Purpose
- This is a single‐service backend application built with Spring Boot. It exposes a simple RESTful API (`GET /api/info`) that returns system metadata (name, version, author). The project serves as the “Backend” half of a Jenkins CI/CD demonstration.

##### Core Architectural Components
a. Source Code Repository (GitHub)
b. CI/CD Server (Jenkins)
c. Build Tool (Maven)
d. Runtime Service (Spring Boot Application)
e. Configuration (application.yml)
f. API Consumers (e.g., Frontend demo app or any HTTP client)

##### Relationships and Interactions
- On code check-in to GitHub, Jenkins triggers a pipeline:
1. Checkout source
2. mvn clean compile → mvn test → mvn package
3. Deploy artifact (e.g., copy JAR to target server or run `spring-boot:run`)
- At runtime:
- HTTP Client → Spring Boot Controller (`InfoController`) → returns `SystemInfo` DTO.
- Configuration (`application.yml`) feeds into Spring Boot at startup.

##### Architectural Patterns and Principles
- Layered MVC (Controller layer maps HTTP → domain models).
- Externalized configuration (via Spring’s `application.yml`).
- CI/CD pipeline enforces Build → Test → Deploy.
- Single‐responsibility: one controller, one model class.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Source Repository
    subgraph "GitHub Repository"
        direction TB
        Repo["GitHub\n(Source Repo)"]:::external
        GI[".gitignore"]:::config
        RD["README.md"]:::config
        LI["LICENSE"]:::config
        POM["pom.xml"]:::config
    end

    %% CI/CD Server and Pipeline
    Repo -->|"git push"| JenkinsCI
    JenkinsCI["Jenkins CI Server\n(2.x)"]:::cicd
    subgraph "Build Pipeline"
        direction TB
        Checkout["Checkout\n(git clone)"]:::cicd
        Maven["Maven 3.6+\n(clean compile & test)"]:::cicd
        Package["Package & Test\n(mvn package)"]:::cicd
    end
    JenkinsCI --> Checkout
    Checkout --> Maven
    Maven --> Package

    %% Deployment to Runtime
    Package -->|"deploy/run"| App

    %% Runtime Service
    subgraph "Spring Boot Application\n(Runtime)"
        direction TB
        App["JenkinsCiDemoApplication.java\n(Spring Boot 2.7.18)"]:::runtime
        Controller["InfoController.java"]:::runtime
        Model["SystemInfo.java"]:::runtime
        ConfigFile["application.yml"]:::config
    end
    App --> Controller
    Controller -->|"uses"| Model
    ConfigFile -->|"loaded by"| App

    %% API Consumer
    Client["API Consumer\n(Frontend / curl / Postman)"]:::external
    Client -->|"HTTP GET /api/info"| Controller
    Controller -->|"returns JSON"| Client

    %% Click Events
    click GI "https://github.com/tanchengbin/jenkins-ci-demo/blob/main/.gitignore"
    click RD "https://github.com/tanchengbin/jenkins-ci-demo/blob/main/README.md"
    click LI "https://github.com/tanchengbin/jenkins-ci-demo/tree/main/LICENSE"
    click POM "https://github.com/tanchengbin/jenkins-ci-demo/blob/main/pom.xml"
    click App "https://github.com/tanchengbin/jenkins-ci-demo/blob/main/src/main/java/com/cpolar/jenkinscidemo/JenkinsCiDemoApplication.java"
    click Controller "https://github.com/tanchengbin/jenkins-ci-demo/blob/main/src/main/java/com/cpolar/jenkinscidemo/controller/InfoController.java"
    click Model "https://github.com/tanchengbin/jenkins-ci-demo/blob/main/src/main/java/com/cpolar/jenkinscidemo/model/SystemInfo.java"
    click ConfigFile "https://github.com/tanchengbin/jenkins-ci-demo/blob/main/src/main/resources/application.yml"

    %% Styles
    classDef cicd fill:#D6EAF8,stroke:#21618C,stroke-width:2px
    classDef runtime fill:#D4EFDF,stroke:#1D8348,stroke-width:2px
    classDef external fill:#FADBD8,stroke:#922B21,stroke-width:2px
    classDef config fill:#FCF3CF,stroke:#B7950B,stroke-width:2px
```
