# anushakommu123/github-code-rag architecture

> Architecture diagram of the GitHub repository anushakommu123/github-code-rag, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anushakommu123/github-code-rag
- Repository: https://github.com/anushakommu123/github-code-rag

## Overview

GitHub Code RAG lets a user select and index a GitHub repository, then ask questions grounded in its source code. The backend fetches and filters files, chunks and validates them, embeds them, and persists versioned repository data; question answering retrieves and reranks chunks, generates a grounded response with citations, and maintains conversation history. The frontend provides repository, summary, and chat views. The README is empty, so capabilities and connections here are limited to the tree and shown source/index evidence.

Main entry points: [`backend/app/services/qa_service.py`](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/qa_service.py) (Grounded QA), [`backend/app/services/pipeline_service.py`](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/pipeline_service.py) (File processing), [`backend/app/api/routes.py`](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/api/routes.py) (API routes), [`backend/app/services/indexing_service.py`](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/indexing_service.py) (Versioned indexing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["Routes and views<br/>[App.tsx]"]
  node_home["Repository selection<br/>[HomePage.tsx]"]
  node_summary["Repository summary"]
  node_chat["Repository chat<br/>[ChatPage.tsx]"]
  node_session["Repository session"]
end

subgraph group_api["API boundary"]
  node_client["HTTP client<br/>[client.ts]"]
  node_routes["API routes<br/>[routes.py]"]
end

subgraph group_indexing["Repository indexing"]
  node_github["GitHub repository access<br/>[github_service.py]"]
  node_indexer["Versioned indexing"]
  node_pipeline["File processing"]
  node_chunking["Chunk generation"]
  node_validation["Chunk validation"]
  node_embedding["Text embeddings"]
end

subgraph group_qa["Question answering"]
  node_search["Vector search<br/>[search_service.py]"]
  node_reranking["Chunk reranking"]
  node_qa_service["Grounded QA<br/>[qa_service.py]"]
  node_context["Context formatting<br/>[context_service.py]"]
  node_citations["Citation validation"]
  node_conversations["Conversation history"]
  node_llm["Gemini generation<br/>[llm_service.py]"]
end

subgraph group_storage["Persistence"]
  node_db[("Repository database")]
end

node_user(("Repository user"))
node_github_service{{"GitHub API"}}
node_gemini_service{{"Gemini API"}}

node_user -->|"selects repository"| node_home
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_summary
node_app -->|"routes to"| node_chat
node_home -->|"indexes repository"| node_client
node_chat -->|"asks questions"| node_client
node_home -->|"saves session"| node_session
node_chat -->|"reads session"| node_session
node_client -->|"sends HTTP requests"| node_routes
node_routes -->|"indexes repository"| node_indexer
node_routes -->|"answers question"| node_qa_service
node_routes -->|"fetches repository data"| node_github
node_github -->|"calls API"| node_github_service
node_indexer -->|"fetches files"| node_github
node_indexer -->|"processes files"| node_pipeline
node_indexer -->|"persists index"| node_db
node_pipeline -->|"fetches contents"| node_github
node_pipeline -->|"chunks files"| node_chunking
node_pipeline -->|"validates chunks"| node_validation
node_pipeline -->|"embeds chunks"| node_embedding
node_qa_service -->|"loads repository and chunks"| node_db
node_qa_service -->|"loads and saves history"| node_conversations
node_qa_service -->|"embeds question"| node_embedding
node_qa_service -->|"reranks candidates"| node_reranking
node_qa_service -->|"builds context"| node_context
node_qa_service -->|"generates answer"| node_llm
node_qa_service -->|"validates citations"| node_citations
node_search -->|"embeds query"| node_embedding
node_search -->|"retrieves candidates"| node_db
node_search -->|"reranks candidates"| node_reranking
node_llm -->|"requests generation"| node_gemini_service
node_conversations -->|"stores history"| node_db

click node_app "https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/App.tsx"
click node_home "https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/pages/HomePage.tsx"
click node_summary "https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/pages/RepositorySummaryPage.tsx"
click node_chat "https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/pages/ChatPage.tsx"
click node_session "https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/state/RepositoryContext.tsx"
click node_client "https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/api/client.ts"
click node_routes "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/api/routes.py"
click node_github "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/github_service.py"
click node_indexer "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/indexing_service.py"
click node_pipeline "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/pipeline_service.py"
click node_chunking "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/chunking_service.py"
click node_validation "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/chunk_validation_service.py"
click node_embedding "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/embedding_service.py"
click node_db "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/persistence_service.py"
click node_search "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/search_service.py"
click node_reranking "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/reranking_service.py"
click node_qa_service "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/qa_service.py"
click node_context "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/context_service.py"
click node_citations "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/citation_service.py"
click node_conversations "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/conversation_service.py"
click node_llm "https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/llm_service.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_app,node_home,node_summary,node_chat,node_session,node_user toneBlue
class node_client,node_routes toneAmber
class node_github,node_indexer,node_pipeline,node_chunking,node_validation,node_embedding,node_github_service,node_gemini_service toneMint
class node_search,node_reranking,node_qa_service,node_context,node_citations,node_conversations,node_llm toneRose
class node_db toneIndigo
```

## Components

### Web application

- [Routes and views](https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Repository selection](https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/pages/HomePage.tsx): `frontend/src/pages/HomePage.tsx`
- [Repository summary](https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/pages/RepositorySummaryPage.tsx): `frontend/src/pages/RepositorySummaryPage.tsx`
- [Repository chat](https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/pages/ChatPage.tsx): `frontend/src/pages/ChatPage.tsx`
- [Repository session](https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/state/RepositoryContext.tsx): `frontend/src/state/RepositoryContext.tsx`

### API boundary

- [HTTP client](https://github.com/anushakommu123/github-code-rag/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [API routes](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`

### Repository indexing

- [GitHub repository access](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/github_service.py): `backend/app/services/github_service.py`
- [Versioned indexing](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/indexing_service.py): `backend/app/services/indexing_service.py`
- [File processing](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/pipeline_service.py): `backend/app/services/pipeline_service.py`
- [Chunk generation](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/chunking_service.py): `backend/app/services/chunking_service.py`
- [Chunk validation](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/chunk_validation_service.py): `backend/app/services/chunk_validation_service.py`
- [Text embeddings](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/embedding_service.py): `backend/app/services/embedding_service.py`

### Question answering

- [Vector search](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/search_service.py): `backend/app/services/search_service.py`
- [Chunk reranking](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/reranking_service.py): `backend/app/services/reranking_service.py`
- [Grounded QA](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/qa_service.py): `backend/app/services/qa_service.py`
- [Context formatting](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/context_service.py): `backend/app/services/context_service.py`
- [Citation validation](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/citation_service.py): `backend/app/services/citation_service.py`
- [Conversation history](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/conversation_service.py): `backend/app/services/conversation_service.py`
- [Gemini generation](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/llm_service.py): `backend/app/services/llm_service.py`

### Persistence

- [Repository database](https://github.com/anushakommu123/github-code-rag/blob/main/backend/app/services/persistence_service.py): `backend/app/services/persistence_service.py`

### Other components

- **Repository user**
- **GitHub API**
- **Gemini API**

## Connections

- Repository user → Repository selection: selects repository
- Routes and views → Repository selection: routes to (evidence: `frontend/src/App.tsx`)
- Routes and views → Repository summary: routes to (evidence: `frontend/src/App.tsx`)
- Routes and views → Repository chat: routes to (evidence: `frontend/src/App.tsx`)
- Repository selection → HTTP client: indexes repository (evidence: `frontend/src/pages/HomePage.tsx`)
- Repository chat → HTTP client: asks questions (evidence: `frontend/src/pages/ChatPage.tsx`)
- Repository selection → Repository session: saves session (evidence: `frontend/src/pages/HomePage.tsx`)
- Repository chat → Repository session: reads session (evidence: `frontend/src/pages/ChatPage.tsx`)
- HTTP client → API routes: sends HTTP requests (evidence: `frontend/src/api/client.ts`)
- API routes → Versioned indexing: indexes repository (evidence: `backend/app/api/routes.py`)
- API routes → Grounded QA: answers question (evidence: `backend/app/api/routes.py`)
- API routes → GitHub repository access: fetches repository data (evidence: `backend/app/api/routes.py`)
- GitHub repository access → GitHub API: calls API (evidence: `backend/app/services/github_service.py`)
- Versioned indexing → GitHub repository access: fetches files (evidence: `backend/app/services/indexing_service.py`)
- Versioned indexing → File processing: processes files (evidence: `backend/app/services/indexing_service.py`)
- Versioned indexing → Repository database: persists index (evidence: `backend/app/services/indexing_service.py`)
- File processing → GitHub repository access: fetches contents (evidence: `backend/app/services/pipeline_service.py`)
- File processing → Chunk generation: chunks files (evidence: `backend/app/services/pipeline_service.py`)
- File processing → Chunk validation: validates chunks (evidence: `backend/app/services/pipeline_service.py`)
- File processing → Text embeddings: embeds chunks (evidence: `backend/app/services/pipeline_service.py`)
- Grounded QA → Repository database: loads repository and chunks (evidence: `backend/app/services/qa_service.py`)
- Grounded QA → Conversation history: loads and saves history (evidence: `backend/app/services/qa_service.py`)
- Grounded QA → Text embeddings: embeds question (evidence: `backend/app/services/qa_service.py`)
- Grounded QA → Chunk reranking: reranks candidates (evidence: `backend/app/services/qa_service.py`)
- Grounded QA → Context formatting: builds context (evidence: `backend/app/services/qa_service.py`)
- Grounded QA → Gemini generation: generates answer (evidence: `backend/app/services/qa_service.py`)
- Grounded QA → Citation validation: validates citations (evidence: `backend/app/services/qa_service.py`)
- Vector search → Text embeddings: embeds query (evidence: `backend/app/services/search_service.py`)
- Vector search → Repository database: retrieves candidates (evidence: `backend/app/services/search_service.py`)
- Vector search → Chunk reranking: reranks candidates (evidence: `backend/app/services/search_service.py`)
- Gemini generation → Gemini API: requests generation (evidence: `backend/app/services/llm_service.py`)
- Conversation history → Repository database: stores history (evidence: `backend/app/services/conversation_service.py`)
