# anthonyrichir/quickperf-sample-test architecture

> Architecture diagram of the GitHub repository anthonyrichir/quickperf-sample-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anthonyrichir/quickperf-sample-test
- Repository: https://github.com/anthonyrichir/quickperf-sample-test

## Overview

##### Project type and purpose
- This is a JHipster-generated Java/Spring Boot microservice (bookApi) intended to be part of a larger microservice ecosystem.
- Its primary responsibility is to expose REST endpoints for CRUD operations on Book, Author, Editor, and Owner entities.
- It relies on Service Discovery (JHipster Registry), Centralized Configuration (Spring Cloud Config), a MySQL datastore, Liquibase for schema management, and includes monitoring (Prometheus + Grafana) and CI/CD support (Jenkins, Sonar).

##### File structure
- Top-level artifacts:
- pom.xml, mvnw scripts, package.json (front-end stub), JHipster registry & Docker Compose yml under src/main/docker.
- src/main/java/com/book: typical Spring-Boot layers: config, domain, repository, service, web/rest, security, aop, client.
- src/main/resources/config: multiple profiles (dev, prod, tls), Liquibase changelogs & data.
- src/test: unit & integration tests for each layer.
- Docker compose definitions for: MySQL, JHipster-Registry, Config Server, Hazelcast Management Center, Prometheus, Grafana, Sonar, Jenkins.
- CI: Jenkinsfile and .travis.yml for pipelines; sonar-project.properties for code quality.

##### Key insights from README
- Service refuses to start without a running JHipster-Registry at localhost:8761.
- Docker-Compose can bring up all dependencies (mysql, registry, config, monitoring, Sonar).
- Built-in QuickPerf tests annotated in integration and unit tests, but that is peripheral and not part of the runtime architecture.

##### Main components and their interactions
a. External/Infrastructure services (deployed via Docker Compose or external):
- JHipster Registry (Eureka) – Service Discovery.
- Spring Cloud Config Server – Centralized configuration store.
- MySQL – Relational database.
- Prometheus & Grafana – Metrics collection and dashboards (actuator → Prometheus → Grafana).
- Jenkins & SonarQube – CI/CD and code quality.
b. Application microservice (bookApi):
- Spring Boot application (BookApiApp).
- Configuration layer: reads from Config Server.
- Service Discovery client: registers with JHipster Registry.
- Web/API layer: com.book.web.rest.* controllers.
- Business layer: com.book.service.* (if any) and repository layer: com.book.repository.*.
- Domain layer: com.book.domain.* JPA entities managed via Liquibase migrations.
- Security: JWT filter, Token Provider, Spring Security config.
- Feign client interceptor for outgoing calls to other microservices.
- AOP logging and async execution.
c. CI pipeline: Jenkins builds and runs Sonar, Maven, Docker image via Jib, then deploys.

##### Architectural patterns and principles
- Microservice architecture with externalized configuration and service registration (Spring Cloud Config & Eureka).
- Layered (onion/hexagonal) architecture within the application: REST → Service → Repository → Database.
- Infrastructure-as-code: Docker Compose for dependencies, Jib for containerizing the app.
- Automated CI/CD and quality gates (Sonar, Jenkins).
- Use of Liquibase for versioned DB migrations.
- Monitoring via Spring Boot Actuator → Prometheus → Grafana.

## Diagram (Mermaid)

```mermaid
graph LR
  subgraph "Infra Services"
    direction TB
    Registry["JHipster Registry (Eureka)"]:::infra
    Config["Spring Cloud Config Server"]:::infra
    MySQL["MySQL Database"]:::db
    Hazelcast["Hazelcast Management Center"]:::infra
    Prometheus["Prometheus"]:::infra
    Grafana["Grafana"]:::infra
  end

  subgraph "Book API Service"
    direction TB
    App["BookApiApp"]:::app
    configClient["Configuration Client"]:::app
    discovery["Eureka Discovery Client"]:::app
    rest["REST Controllers"]:::app
    service["Service Layer"]:::app
    repo["Repository Layer"]:::app
    domain["Domain Entities"]:::app
    security["Security Config & JWT"]:::app
    feign["Feign Client Interceptor"]:::app
    aop["AOP Logging Aspect"]:::app
    async["Async Configuration"]:::app
    liquibase["Liquibase Migrations"]:::app
    actuator["Actuator Metrics"]:::app
  end

  subgraph "CI/CD Pipeline"
    direction TB
    Jenkins["Jenkins"]:::ci
    Git["Git Repository"]:::ci
    Maven["Maven Build"]:::ci
    Jib["Jib Containerization"]:::ci
    Sonar["SonarQube"]:::ci
    DockerReg["Docker Registry"]:::ci
  end

  %% Infra interactions
  App -->|"Eureka Registration"| Registry
  App -->|"Config Fetch (HTTP)"| Config
  rest -->|"calls"| service
  service -->|"uses"| repo
  repo -->|"JDBC"| MySQL
  liquibase -->|"DB Migrations"| MySQL
  actuator -->|"scrape"| Prometheus
  Prometheus -->|"data"| Grafana

  %% CI/CD flow
  Jenkins -->|"clone"| Git
  Jenkins -->|"run"| Maven
  Maven -->|"build image"| Jib
  Jenkins -->|"analyze"| Sonar
  Jib -->|"push"| DockerReg

  %% Click Events
  click Registry "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/docker/jhipster-registry.yml"
  click Config "https://github.com/anthonyrichir/quickperf-sample-test/tree/master/src/main/docker/central-server-config"
  click MySQL "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/docker/mysql.yml"
  click Prometheus "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/docker/prometheus/prometheus.yml"
  click Grafana "https://github.com/anthonyrichir/quickperf-sample-test/tree/master/src/main/docker/grafana"
  click Hazelcast "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/docker/hazelcast-management-center.yml"
  click Jenkins "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/docker/jenkins.yml"
  click App "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/java/com/book/BookApiApp.java"
  click rest "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/java/com/book/web/rest/*.java"
  click service "https://github.com/anthonyrichir/quickperf-sample-test/tree/master/src/main/java/com/book/service"
  click repo "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/java/com/book/repository/*.java"
  click domain "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/java/com/book/domain/*.java"
  click security "https://github.com/anthonyrichir/quickperf-sample-test/tree/master/src/main/java/com/book/security"
  click feign "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/java/com/book/client/UserFeignClientInterceptor.java"
  click aop "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/java/com/book/aop/logging/LoggingAspect.java"
  click async "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/src/main/java/com/book/config/AsyncConfiguration.java"
  click liquibase "https://github.com/anthonyrichir/quickperf-sample-test/tree/master/src/main/resources/config/liquibase"
  click Git "https://github.com/anthonyrichir/quickperf-sample-test/tree/master/Jenkinsfile"
  click Maven "https://github.com/anthonyrichir/quickperf-sample-test/blob/master/pom.xml"

  classDef infra fill:#e0f7e9,stroke:#2e7d32,color:#2e7d32;
  classDef db fill:#e0f7e9,stroke:#2e7d32,color:#2e7d32;
  classDef app fill:#e3f2fd,stroke:#1565c0,color:#1565c0;
  classDef ci fill:#fff3e0,stroke:#ef6c00,color:#ef6c00;
```
