# sannidhisriram-06/ai-test-generator architecture

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

- Interactive diagram: https://gitdiagram.com/sannidhisriram-06/ai-test-generator
- Repository: https://github.com/sannidhisriram-06/ai-test-generator

## Overview

This repository combines a FastAPI service that turns submitted Python code into pytest tests with a delivery workflow that tests, builds, and deploys the service. The main flow is developer push through Jenkins to ECR and a GitOps values update, followed by Argo CD reconciliation to Kubernetes. The application path is request validation and rate limiting, prompt construction, and Groq inference. Delivery details come from the README; only the application implementation was sampled, so deployment wiring is documented rather than source-verified.

Main entry points: [`app/main.py`](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py) (FastAPI endpoints), [`Jenkinsfile`](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/Jenkinsfile) (Jenkins pipeline), [`Terraform/main.tf`](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/Terraform/main.tf) (ECR provisioning), [`Dockerfile`](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/Dockerfile) (Container image)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_delivery["Delivery workflow"]
  node_jenkins["Jenkins pipeline"]
  node_container["Container image"]
end

subgraph group_infrastructure["Infrastructure"]
  node_terraform["ECR provisioning<br/>[main.tf]"]
end

subgraph group_service["Test generator"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_validation["Input validation<br/>[main.py]"]
  node_limiter["Request limiting<br/>[main.py]"]
  node_prompt["Prompt construction<br/>[main.py]"]
  node_response["Generated tests<br/>[main.py]"]
  node_health["Health endpoint<br/>[main.py]"]
  node_metrics["Metrics endpoint<br/>[main.py]"]
end

subgraph group_integrations["External systems"]
  node_ecr[("AWS ECR")]
  node_gitops["GitOps Helm chart"]
  node_argocd["Argo CD"]
  node_kubernetes["Kubernetes cluster"]
  node_groq["Groq LLM"]
end

node_developer(("Developer"))
node_client(("API client"))

node_developer -->|"pushes code"| node_jenkins
node_jenkins -->|"builds image"| node_container
node_jenkins -->|"pushes image"| node_ecr
node_terraform -->|"provisions"| node_ecr
node_jenkins -->|"updates image tag"| node_gitops
node_gitops -->|"provides desired state"| node_argocd
node_argocd -->|"syncs manifests"| node_kubernetes
node_kubernetes -->|"pulls image"| node_ecr
node_client -->|"sends request"| node_api
node_api -->|"validates payload"| node_validation
node_api -->|"applies limit"| node_limiter
node_api -->|"dispatches health"| node_health
node_api -->|"dispatches metrics"| node_metrics
node_api -->|"builds prompt"| node_prompt
node_prompt -->|"requests completion"| node_groq
node_api -->|"returns tests"| node_response
node_groq -->|"returns completion"| node_api

click node_jenkins "https://github.com/sannidhisriram-06/ai-test-generator/blob/main/Jenkinsfile"
click node_container "https://github.com/sannidhisriram-06/ai-test-generator/blob/main/Dockerfile"
click node_terraform "https://github.com/sannidhisriram-06/ai-test-generator/blob/main/Terraform/main.tf"
click node_api "https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py"
click node_validation "https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py"
click node_limiter "https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py"
click node_prompt "https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py"
click node_response "https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py"
click node_health "https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py"
click node_metrics "https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py"

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_jenkins,node_container,node_client toneBlue
class node_terraform toneAmber
class node_api,node_validation,node_limiter,node_prompt,node_response,node_health,node_metrics toneMint
class node_ecr,node_gitops,node_argocd,node_kubernetes,node_groq toneRose
class node_developer toneIndigo
```

## Components

### Delivery workflow

- [Jenkins pipeline](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/Jenkinsfile): `Jenkinsfile`
- [Container image](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/Dockerfile): `Dockerfile`

### Infrastructure

- [ECR provisioning](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/Terraform/main.tf): `Terraform/main.tf`

### Test generator

- [FastAPI endpoints](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py): `app/main.py`
- [Input validation](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py): `app/main.py`
- [Request limiting](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py): `app/main.py`
- [Prompt construction](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py): `app/main.py`
- [Generated tests](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py): `app/main.py`
- [Health endpoint](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py): `app/main.py`
- [Metrics endpoint](https://github.com/sannidhisriram-06/ai-test-generator/blob/main/app/main.py): `app/main.py`

### External systems

- **AWS ECR**
- **GitOps Helm chart**
- **Argo CD**
- **Kubernetes cluster**
- **Groq LLM**

### Other components

- **Developer**
- **API client**

## Connections

- Developer → Jenkins pipeline: pushes code
- Jenkins pipeline → Container image: builds image
- Jenkins pipeline → AWS ECR: pushes image
- ECR provisioning → AWS ECR: provisions
- Jenkins pipeline → GitOps Helm chart: updates image tag
- GitOps Helm chart → Argo CD: provides desired state
- Argo CD → Kubernetes cluster: syncs manifests
- Kubernetes cluster → AWS ECR: pulls image
- API client → FastAPI endpoints: sends request
- FastAPI endpoints → Input validation: validates payload
- FastAPI endpoints → Request limiting: applies limit
- FastAPI endpoints → Health endpoint: dispatches health
- FastAPI endpoints → Metrics endpoint: dispatches metrics
- FastAPI endpoints → Prompt construction: builds prompt
- Prompt construction → Groq LLM: requests completion
- FastAPI endpoints → Generated tests: returns tests
- Groq LLM → FastAPI endpoints: returns completion
