# jhonatademuner/release-guard architecture

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

- Interactive diagram: https://gitdiagram.com/jhonatademuner/release-guard
- Repository: https://github.com/jhonatademuner/release-guard

## Overview

##### Project type and purpose
- This is a backend-only, Kotlin-based Spring Boot microservice (“Release Guard”) whose role is to validate Jira issues (and optionally GitHub PRs) for release readiness. It exposes REST endpoints for CI/CD pipelines, integrates with external Jira and GitHub APIs, applies block-schedule rules (from a JSON file), and returns simplified domain objects or block statuses.

##### File structure
- Top-level build & config: Dockerfile, Gradle scripts, application.properties, logback.xml.
- src/main/kotlin/com/releaseguard:
- controller/… → REST API entry points (GithubController, JiraController, MergeController, BlockScheduleController)
- service/…    → business logic (GithubService, JiraService, MergeService, BlockScheduleService)
- client/…     → outbound adapters (JiraClient, GitHubClient)
- domain/…     → strongly-typed models for Jira, GitHub, schedule
- utils/       → assemblers (map raw DTOs → domain), exception handlers, filters
- config/      → RestTemplateConfig, request logging filter
- data/block-schedule.json → rule definitions for schedule checking
- test/… mirrors main code for unit & integration tests

##### README for additional insights
- REST endpoints: /api/jira/issue/{key}, /api/jira/issue/{key}/block-status
- Key features: simplified issue info, block-status check, CI/CD integration, custom exception handling
- Tech stack: Kotlin, Spring Boot, Gradle, RestTemplate, Jackson, JUnit5, MockK

##### Detail without over-fragmenting
- Controller & corresponding service
- File block-schedule.json feeding into BlockScheduleService

## Diagram (Mermaid)

```mermaid
flowchart TD
    CI["CI/CD Pipeline"]:::external

    subgraph "API Layer"
        JC["JiraController (REST)"]:::api
        GHC["GithubController (REST)"]:::api
        MC["MergeController (REST)"]:::api
        BSC["BlockScheduleController (REST)"]:::api
    end

    subgraph "Service Layer"
        JS["JiraService (Business)"]:::service
        GHS["GithubService (Business)"]:::service
        MS["MergeService (Business)"]:::service
        BSS["BlockScheduleService (Business)"]:::service
    end

    subgraph "Adapter Layer"
        JCL["JiraClient (HTTP Adapter)"]:::adapter
        GHCL["GitHubClient (HTTP Adapter)"]:::adapter
    end

    subgraph "Domain & Assemblers"
        subgraph "Domain Models"
            JI["JiraIssue"]:::domain
            SJI["SimplifiedJiraIssue"]:::domain
            SJIS["SimplifiedJiraIssueStatus"]:::domain
            SJLI["SimplifiedJiraLinkedIssue"]:::domain
            JLID["JiraLinkedIssueDirection"]:::domain
            GPR["GithubPullRequest"]:::domain
            SGPR["SimplifiedGithubPullRequest"]:::domain
            BS["BlockSchedule"]:::domain
        end
        subgraph "Assemblers"
            JIA["JiraIssueAssembler"]:::utils
            GPA["GithubPullRequestAssembler"]:::utils
        end
    end

    subgraph "Config & Exception"
        RTC["RestTemplateConfig"]:::config
        LCF["LoggingContextFilter"]:::config
        GEH["GlobalExceptionHandler"]:::exception
        ER["ErrorResponse"]:::exception
        RNFE["ResourceNotFoundException"]:::exception
    end

    DS["block-schedule.json"]:::data

    JiraExt["Jira REST API"]:::external
    GitHubExt["GitHub REST API"]:::external

    CI -->|"HTTP Request"| JC
    CI -->|"HTTP Request"| GHC
    CI -->|"HTTP Request"| MC
    CI -->|"HTTP Request"| BSC

    JC -->|calls| JS
    GHC -->|calls| GHS
    MC -->|calls| MS
    BSC -->|calls| BSS

    JS -->|fetch schedule rules| DS
    BSS -->|reads rules| DS

    JS -->|calls| JCL
    GHS -->|calls| GHCL

    JCL -->|"HTTP Call"| JiraExt
    GHCL -->|"HTTP Call"| GitHubExt

    JCL -->|returns raw JSON| JIA
    GHCL -->|returns raw JSON| GPA

    JIA -->|maps to| SJI
    GPA -->|maps to| SGPR

    classDef api fill:#a2d2ff,stroke:#000
    classDef service fill:#b7e4c7,stroke:#000
    classDef adapter fill:#ffba08,stroke:#000
    classDef domain fill:#e0fbfc,stroke:#000
    classDef utils fill:#ffd6a5,stroke:#000
    classDef config fill:#caf0f8,stroke:#000
    classDef exception fill:#ffccd5,stroke:#000
    classDef external fill:#dee2e6,stroke:#000
    classDef data fill:#ffe066,stroke:#000

    click JC "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/controller/jira/JiraController.kt"
    click GHC "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/controller/github/GithubController.kt"
    click MC "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/controller/merge/MergeController.kt"
    click BSC "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/controller/schedule/BlockScheduleController.kt"

    click JS "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/service/jira/JiraService.kt"
    click GHS "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/service/github/GithubService.kt"
    click MS "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/service/merge/MergeService.kt"
    click BSS "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/service/schedule/BlockScheduleService.kt"

    click JCL "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/client/jira/JiraClient.kt"
    click GHCL "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/client/github/GitHubClient.kt"

    click JI "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/domain/jira/JiraIssue.kt"
    click SJI "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/domain/jira/SimplifiedJiraIssue.kt"
    click SJIS "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/domain/jira/SimplifiedJiraIssueStatus.kt"
    click SJLI "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/domain/jira/SimplifiedJiraLinkedIssue.kt"
    click JLID "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/domain/jira/JiraLinkedIssueDirection.kt"
    click GPR "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/domain/github/GithubPullRequest.kt"
    click SGPR "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/domain/github/SimplifiedGithubPullRequest.kt"
    click BS "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/domain/schedule/BlockSchedule.kt"

    click JIA "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/utils/assembler/JiraIssueAssembler.kt"
    click GPA "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/utils/assembler/GithubPullRequestAssembler.kt"

    click RTC "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/config/RestTemplateConfig.kt"
    click LCF "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/config/filter/LoggingContextFilter.kt"

    click GEH "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/utils/exception/GlobalExceptionHandler.kt"
    click ER "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/utils/exception/ErrorResponse.kt"
    click RNFE "https://github.com/jhonatademuner/release-guard/blob/main/src/main/kotlin/com/releaseguard/utils/exception/ResourceNotFoundException.kt"

    click DS "https://github.com/jhonatademuner/release-guard/blob/main/data/block-schedule.json"
```
