# sannidhisriram-06/java-self-healing-microservice architecture

> Architecture diagram of the GitHub repository sannidhisriram-06/java-self-healing-microservice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sannidhisriram-06/java-self-healing-microservice
- Repository: https://github.com/sannidhisriram-06/java-self-healing-microservice

## Overview

This is a Spring Boot service packaged as a Docker container and run on AWS behind an Application Load Balancer. The main request path is client → ALB → service controller → plaintext response. Its distinguishing capability is layered health-based recovery: the app exposes health status, Docker reports container health, the ALB isolates unhealthy targets, and the Auto Scaling Group replaces instances and scales on CPU. Terraform defines the AWS environment; a GitHub Actions workflow builds and scans images but does not deploy them. Infrastructure and pipeline links below follow README descriptions; their source was not sampled.

Main entry points: [`terraform/compute.tf`](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/compute.tf) (EC2 Auto Scaling), [`terraform/alb.tf`](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/alb.tf) (Target Group), [`src/main/java/com/sriram/selfhealing/HelloController.java`](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/src/main/java/com/sriram/selfhealing/HelloController.java) (Root Controller), [`terraform/vpc.tf`](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/vpc.tf) (VPC and Subnets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Application"]
  node_service["Spring Boot Service"]
  node_controller["Root Controller"]
end

subgraph group_resilience["Health and Recovery"]
  node_health["Actuator Health"]
  node_container["Docker Container"]
end

subgraph group_infrastructure["AWS Infrastructure"]
  node_alb["Load Balancer<br/>[alb.tf]"]
  node_targetgroup["Target Group<br/>[alb.tf]"]
  node_compute["EC2 Auto Scaling<br/>[compute.tf]"]
  node_network["VPC and Subnets<br/>[vpc.tf]"]
  node_security["Security Groups<br/>[security.tf]"]
end

subgraph group_delivery["Image Delivery"]
  node_pipeline["CI Workflow<br/>[ci.yml]"]
  node_registry[("Docker Hub")]
end

node_client(("HTTP Client"))
node_developer(("Developer"))

node_client -->|"sends requests"| node_alb
node_alb -->|"routes traffic"| node_targetgroup
node_targetgroup -->|"forwards requests"| node_controller
node_controller -->|"returns status"| node_client
node_controller -.->|"runs within"| node_service
node_targetgroup -->|"checks health"| node_health
node_container -->|"polls health"| node_health
node_targetgroup -->|"reports failures"| node_compute
node_compute -->|"replaces instances"| node_compute
node_compute -->|"scales on CPU"| node_compute
node_network -->|"hosts"| node_alb
node_network -->|"hosts"| node_compute
node_security -->|"allows ingress"| node_alb
node_security -->|"restricts ingress"| node_compute
node_developer -->|"pushes changes"| node_pipeline
node_pipeline -->|"builds and pushes"| node_registry
node_registry -->|"manually pulled by"| node_compute

click node_service "https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/src/main/java/com/sriram/selfhealing/SelfhealingApplication.java"
click node_controller "https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/src/main/java/com/sriram/selfhealing/HelloController.java"
click node_health "https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/src/main/resources/application.properties"
click node_container "https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/Dockerfile"
click node_alb "https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/alb.tf"
click node_targetgroup "https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/alb.tf"
click node_compute "https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/compute.tf"
click node_network "https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/vpc.tf"
click node_security "https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/security.tf"
click node_pipeline "https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/.github/workflows/ci.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_service,node_controller,node_client toneBlue
class node_health,node_container toneAmber
class node_alb,node_targetgroup,node_compute,node_network,node_security toneMint
class node_pipeline,node_registry toneRose
class node_developer toneIndigo
```

## Components

### Application

- [Spring Boot Service](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/src/main/java/com/sriram/selfhealing/SelfhealingApplication.java): `src/main/java/com/sriram/selfhealing/SelfhealingApplication.java`
- [Root Controller](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/src/main/java/com/sriram/selfhealing/HelloController.java): `src/main/java/com/sriram/selfhealing/HelloController.java`

### Health and Recovery

- [Actuator Health](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/src/main/resources/application.properties): `src/main/resources/application.properties`
- [Docker Container](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/Dockerfile): `Dockerfile`

### AWS Infrastructure

- [Load Balancer](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/alb.tf): `terraform/alb.tf`
- [Target Group](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/alb.tf): `terraform/alb.tf`
- [EC2 Auto Scaling](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/compute.tf): `terraform/compute.tf`
- [VPC and Subnets](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/vpc.tf): `terraform/vpc.tf`
- [Security Groups](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/terraform/security.tf): `terraform/security.tf`

### Image Delivery

- [CI Workflow](https://github.com/sannidhisriram-06/java-self-healing-microservice/blob/main/.github/workflows/ci.yml): `.github/workflows/ci.yml`
- **Docker Hub**

### Other components

- **HTTP Client**
- **Developer**

## Connections

- HTTP Client → Load Balancer: sends requests (evidence: `README.md`)
- Load Balancer → Target Group: routes traffic (evidence: `README.md`)
- Target Group → Root Controller: forwards requests (evidence: `README.md`)
- Root Controller → HTTP Client: returns status (evidence: `README.md`)
- Root Controller → Spring Boot Service: runs within
- Target Group → Actuator Health: checks health (evidence: `README.md`)
- Docker Container → Actuator Health: polls health (evidence: `README.md`)
- Target Group → EC2 Auto Scaling: reports failures (evidence: `README.md`)
- EC2 Auto Scaling → EC2 Auto Scaling: replaces instances (evidence: `README.md`)
- EC2 Auto Scaling → EC2 Auto Scaling: scales on CPU (evidence: `README.md`)
- VPC and Subnets → Load Balancer: hosts (evidence: `README.md`)
- VPC and Subnets → EC2 Auto Scaling: hosts (evidence: `README.md`)
- Security Groups → Load Balancer: allows ingress (evidence: `README.md`)
- Security Groups → EC2 Auto Scaling: restricts ingress (evidence: `README.md`)
- Developer → CI Workflow: pushes changes (evidence: `README.md`)
- CI Workflow → Docker Hub: builds and pushes (evidence: `README.md`)
- Docker Hub → EC2 Auto Scaling: manually pulled by (evidence: `README.md`)
