# hitesh-kumar-s/repomind-ai architecture

> Architecture diagram of the GitHub repository hitesh-kumar-s/repomind-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hitesh-kumar-s/repomind-ai
- Repository: https://github.com/hitesh-kumar-s/repomind-ai

## Overview

#### Purpose and Entry Points
RepoMind AI is a Spring Boot application that fetches public repository documentation and selected files, then uses an LLM to produce structured, interview-oriented analysis and answer follow-up questions. The backend starts at `src/main/java/com/projectanalyzer/project_analyzer/ProjectAnalyzerApplication.java`; the browser UI is served from `src/main/resources/static/index.html`.

#### HTTP/API Boundary
REST controllers separate client interactions into repository analysis and contextual chat flows:
- `src/main/java/com/projectanalyzer/project_analyzer/controller/AnalyzerController.java`
- `src/main/java/com/projectanalyzer/project_analyzer/controller/ChatController.java`

The frontend submits a repository URL for analysis, renders markdown-oriented output, and sends subsequent questions through the chat endpoint.

#### Repository Acquisition and Platform Abstraction
`RepositoryService` is the platform-neutral boundary for obtaining repository context. Platform-specific adapters handle URL/platform differences and remote API calls:
- `src/main/java/com/projectanalyzer/project_analyzer/service/RepositoryService.java`
- `src/main/java/com/projectanalyzer/project_analyzer/service/GitHubService.java`
- `src/main/java/com/projectanalyzer/project_analyzer/service/GitLabService.java`
- `src/main/java/com/projectanalyzer/project_analyzer/service/BitbucketService.java`

The primary acquisition flow is URL detection → provider service → README/key-file extraction. Public repositories are the intended scope, with branch fallback behavior described for common branch names.

#### Context Lifecycle
Fetched README and repository-structure information is represented as reusable context, allowing analysis and later chat requests to use the same project grounding:
- `src/main/java/com/projectanalyzer/project_analyzer/model/ContextData.java`
- `src/main/java/com/projectanalyzer/project_analyzer/service/ChatService.java`
- `src/main/java/com/projectanalyzer/project_analyzer/dto/ChatRequest.java`

This is the central anti-hallucination boundary: prompts should be constrained to acquired repository context and documentation quality.

#### LLM Provider Layer
`LLMService` abstracts generation from concrete hosted providers:
- `src/main/java/com/projectanalyzer/project_analyzer/service/LLMService.java`
- `src/main/java/com/projectanalyzer/project_analyzer/service/GroqLLMService.java`
- `src/main/java/com/projectanalyzer/project_analyzer/service/OpenRouterLLMService.java`

Analysis requests generate structured sections such as overview, features, stack, architecture, interview explanation, quality assessment, and suggestions. Chat requests reuse prior context and may support differing response modes.

#### Runtime, Configuration, and External Services
The application runs on Java 17+ with Spring Boot and Maven (`pom.xml`), normally exposing HTTP on port 8080. Runtime credentials/configuration are held in:
- `src/main/resources/application.properties`

External dependencies are GitHub, GitLab, and Bitbucket APIs for repository content, plus Groq/OpenRouter LLM APIs. GitHub token support addresses API rate limits. The container entrypoint is defined by `Dockerfile`; deployment is suitable for Docker/EC2 with API keys injected as environment variables.

#### Primary Control Flow
1. Client loads the static UI and submits a repository URL.
2. `AnalyzerController` delegates to repository services to retrieve documentation/context.
3. The selected LLM implementation receives grounded context and returns structured analysis.
4. Context is retained or passed forward for `ChatController`/`ChatService`.
5. Chat requests combine the user question with repository context and return a constrained AI response.

Main entry points: [`src/main/java/com/projectanalyzer/project_analyzer/service/RepositoryService.java`](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/RepositoryService.java) (Repository service), [`src/main/java/com/projectanalyzer/project_analyzer/service/LLMService.java`](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/LLMService.java) (LLM service), [`src/main/java/com/projectanalyzer/project_analyzer/controller/AnalyzerController.java`](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/controller/AnalyzerController.java) (Analyzer controller), [`src/main/java/com/projectanalyzer/project_analyzer/controller/ChatController.java`](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/controller/ChatController.java) (Chat controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser UI"]
  node_ui["Static UI<br/>browser client<br/>[index.html]"]
end

subgraph group_api["Spring Boot API"]
  node_app{{"Application entry<br/>Spring Boot"}}
  node_analyzer_controller["Analyzer controller<br/>REST controller"]
  node_chat_controller["Chat controller<br/>REST controller"]
  node_context_data["Repository context<br/>context model<br/>[ContextData.java]"]
  node_chat_request["Chat request<br/>request DTO<br/>[ChatRequest.java]"]
  node_chat_service["Chat service<br/>[ChatService.java]"]
  node_runtime_config["Runtime configuration<br/>properties"]
end

subgraph group_acquisition["Repository Acquisition"]
  node_repository_service["Repository service<br/>platform-neutral service"]
  node_github_service["GitHub adapter<br/>provider service<br/>[GitHubService.java]"]
  node_gitlab_service["GitLab adapter<br/>provider service<br/>[GitLabService.java]"]
  node_bitbucket_service["Bitbucket adapter<br/>provider service"]
end

subgraph group_llm["LLM Layer"]
  node_llm_service["LLM service<br/>generation abstraction<br/>[LLMService.java]"]
  node_groq_llm["Groq implementation<br/>LLM provider"]
  node_openrouter_llm["OpenRouter implementation<br/>LLM provider"]
end

subgraph group_external["External APIs"]
  node_repo_apis(("Repository APIs<br/>remote content APIs"))
  node_llm_apis(("LLM APIs<br/>hosted inference APIs"))
end

node_container["Container image<br/>Docker runtime"]

node_ui -->|"analyze repository"| node_analyzer_controller
node_ui -->|"ask follow-up"| node_chat_controller
node_app -->|"serves HTTP"| node_analyzer_controller
node_app -->|"serves HTTP"| node_chat_controller
node_analyzer_controller -->|"fetch context"| node_repository_service
node_repository_service -->|"detects GitHub URL"| node_github_service
node_repository_service -->|"detects GitLab URL"| node_gitlab_service
node_repository_service -->|"detects Bitbucket URL"| node_bitbucket_service
node_github_service -->|"read files"| node_repo_apis
node_gitlab_service -->|"read files"| node_repo_apis
node_bitbucket_service -->|"read files"| node_repo_apis
node_repository_service -->|"builds grounded context"| node_context_data
node_analyzer_controller -->|"request analysis"| node_llm_service
node_context_data -->|"grounds prompt"| node_llm_service
node_chat_request -->|"request payload"| node_chat_controller
node_chat_controller -->|"delegate chat"| node_chat_service
node_chat_service -->|"reuse context"| node_context_data
node_chat_service -->|"generate answer"| node_llm_service
node_llm_service -.->|"provider implementation"| node_groq_llm
node_llm_service -.->|"provider implementation"| node_openrouter_llm
node_groq_llm -->|"inference request"| node_llm_apis
node_openrouter_llm -->|"inference request"| node_llm_apis
node_runtime_config -.->|"provider credentials"| node_repository_service
node_runtime_config -.->|"provider settings"| node_llm_service
node_container -->|"runs application"| node_app

click node_app "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/ProjectAnalyzerApplication.java"
click node_ui "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/resources/static/index.html"
click node_analyzer_controller "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/controller/AnalyzerController.java"
click node_chat_controller "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/controller/ChatController.java"
click node_repository_service "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/RepositoryService.java"
click node_github_service "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/GitHubService.java"
click node_gitlab_service "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/GitLabService.java"
click node_bitbucket_service "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/BitbucketService.java"
click node_context_data "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/model/ContextData.java"
click node_chat_request "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/dto/ChatRequest.java"
click node_chat_service "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/ChatService.java"
click node_llm_service "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/LLMService.java"
click node_groq_llm "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/GroqLLMService.java"
click node_openrouter_llm "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/OpenRouterLLMService.java"
click node_runtime_config "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/resources/application.properties"
click node_container "https://github.com/hitesh-kumar-s/repomind-ai/blob/main/Dockerfile"

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_ui toneBlue
class node_app,node_analyzer_controller,node_chat_controller,node_context_data,node_chat_request,node_chat_service,node_runtime_config toneAmber
class node_repository_service,node_github_service,node_gitlab_service,node_bitbucket_service toneMint
class node_llm_service,node_groq_llm,node_openrouter_llm toneRose
class node_repo_apis,node_llm_apis toneIndigo
class node_container toneNeutral
```

## Components

### Browser UI

- [Static UI](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/resources/static/index.html): browser client · Submits repository URLs and follow-up questions. · `src/main/resources/static/index.html`

### Spring Boot API

- [Application entry](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/ProjectAnalyzerApplication.java): Spring Boot · `src/main/java/com/projectanalyzer/project_analyzer/ProjectAnalyzerApplication.java`
- [Analyzer controller](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/controller/AnalyzerController.java): REST controller · `src/main/java/com/projectanalyzer/project_analyzer/controller/AnalyzerController.java`
- [Chat controller](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/controller/ChatController.java): REST controller · `src/main/java/com/projectanalyzer/project_analyzer/controller/ChatController.java`
- [Repository context](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/model/ContextData.java): context model · Reusable README and selected repository structure grounding. · `src/main/java/com/projectanalyzer/project_analyzer/model/ContextData.java`
- [Chat request](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/dto/ChatRequest.java): request DTO · `src/main/java/com/projectanalyzer/project_analyzer/dto/ChatRequest.java`
- [Chat service](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/ChatService.java): grounded chat service · Combines question and acquired context. · `src/main/java/com/projectanalyzer/project_analyzer/service/ChatService.java`
- [Runtime configuration](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/resources/application.properties): properties · Credentials and provider settings are injected at runtime. · `src/main/resources/application.properties`

### Repository Acquisition

- [Repository service](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/RepositoryService.java): platform-neutral service · Detects provider and obtains repository context. · `src/main/java/com/projectanalyzer/project_analyzer/service/RepositoryService.java`
- [GitHub adapter](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/GitHubService.java): provider service · `src/main/java/com/projectanalyzer/project_analyzer/service/GitHubService.java`
- [GitLab adapter](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/GitLabService.java): provider service · `src/main/java/com/projectanalyzer/project_analyzer/service/GitLabService.java`
- [Bitbucket adapter](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/BitbucketService.java): provider service · `src/main/java/com/projectanalyzer/project_analyzer/service/BitbucketService.java`

### LLM Layer

- [LLM service](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/LLMService.java): generation abstraction · Produces structured analysis and constrained answers. · `src/main/java/com/projectanalyzer/project_analyzer/service/LLMService.java`
- [Groq implementation](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/GroqLLMService.java): LLM provider · `src/main/java/com/projectanalyzer/project_analyzer/service/GroqLLMService.java`
- [OpenRouter implementation](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/src/main/java/com/projectanalyzer/project_analyzer/service/OpenRouterLLMService.java): LLM provider · `src/main/java/com/projectanalyzer/project_analyzer/service/OpenRouterLLMService.java`

### External APIs

- **Repository APIs**: remote content APIs · GitHub, GitLab, and Bitbucket public repository APIs.
- **LLM APIs**: hosted inference APIs · Groq and OpenRouter.

### Other components

- [Container image](https://github.com/hitesh-kumar-s/repomind-ai/blob/main/Dockerfile): Docker runtime · `Dockerfile`

## Connections

- Static UI → Analyzer controller: analyze repository
- Static UI → Chat controller: ask follow-up
- Application entry → Analyzer controller: serves HTTP
- Application entry → Chat controller: serves HTTP
- Analyzer controller → Repository service: fetch context
- Repository service → GitHub adapter: detects GitHub URL
- Repository service → GitLab adapter: detects GitLab URL
- Repository service → Bitbucket adapter: detects Bitbucket URL
- GitHub adapter → Repository APIs: read files
- GitLab adapter → Repository APIs: read files
- Bitbucket adapter → Repository APIs: read files
- Repository service → Repository context: builds grounded context
- Analyzer controller → LLM service: request analysis
- Repository context → LLM service: grounds prompt
- Chat request → Chat controller: request payload
- Chat controller → Chat service: delegate chat
- Chat service → Repository context: reuse context
- Chat service → LLM service: generate answer
- LLM service → Groq implementation: provider implementation
- LLM service → OpenRouter implementation: provider implementation
- Groq implementation → LLM APIs: inference request
- OpenRouter implementation → LLM APIs: inference request
- Runtime configuration → Repository service: provider credentials
- Runtime configuration → LLM service: provider settings
- Container image → Application entry: runs application
