# maashu231/codelens-ai architecture

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

- Interactive diagram: https://gitdiagram.com/maashu231/codelens-ai
- Repository: https://github.com/maashu231/codelens-ai

## Overview

CodeLens AI indexes GitHub repositories, then supports grounded questions, bug investigation, browsing, architecture exploration, file history, and impact analysis. The principal workflow runs from repository selection through ingestion, parsing/chunking, embeddings, vector storage, retrieval/reranking, context construction, and streamed LLM answers with citations. The graph includes documented features whose source was not sampled, but leaves their internal wiring unspecified. Edges reflect sampled calls, SOURCE INDEX references, or README-described relationships; unsampled implementation details are not inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/maashu231/codelens-ai/blob/main/frontend/src/App.jsx) (Application shell), [`backend/main.py`](https://github.com/maashu231/codelens-ai/blob/main/backend/main.py) (FastAPI endpoints), [`backend/retrieval_service.py`](https://github.com/maashu231/codelens-ai/blob/main/backend/retrieval_service.py) (Retrieval and reranking), [`frontend/src/services/api.js`](https://github.com/maashu231/codelens-ai/blob/main/frontend/src/services/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_app["Application shell<br/>[App.jsx]"]
  node_index_hook["Indexing controls"]
  node_query_hook["Question controls"]
  node_bug_hook["Bug controls"]
  node_explorer["Repository explorer"]
  node_architecture_view["Architecture view"]
  node_code_viewer["Code and history viewer"]
  node_answer_panel["Answer and citations<br/>[AnswerPanel.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API orchestration"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_jobs["Indexing jobs<br/>[indexing_jobs.py]"]
end

subgraph group_indexing["Repository indexing"]
  node_repo_access["Repository access"]
  node_ingestion["File ingestion"]
  node_filter["File filtering<br/>[file_filter.py]"]
  node_parser["Code parsing<br/>[code_parser.py]"]
  node_chunker["Smart chunking<br/>[chunker.py]"]
end

subgraph group_intelligence["Code intelligence"]
  node_embedding["Embedding provider"]
  node_vector_store[("Vector store<br/>[vector_store.py]")]
  node_retrieval["Retrieval and reranking"]
  node_reranker["Reranker<br/>[reranker.py]"]
  node_answer["Answer generation<br/>[answer_service.py]"]
  node_streaming["Streaming answers"]
  node_context["Evidence context<br/>[context_builder.py]"]
  node_bug["Bug investigation"]
  node_impact["Change impact analysis<br/>[impact_service.py]"]
  node_architecture["Repository overview"]
end

subgraph group_integrations["External services"]
  node_github["GitHub integration<br/>[github_service.py]"]
  node_llm["Groq LLM client<br/>[llm_service.py]"]
end

node_developer(("Developer"))
node_groq{{"Groq API"}}
node_github_actor{{"GitHub"}}

node_developer -->|"uses"| node_app
node_app -->|"controls indexing"| node_index_hook
node_app -->|"submits questions"| node_query_hook
node_app -->|"starts investigations"| node_bug_hook
node_app -->|"renders"| node_explorer
node_app -->|"renders"| node_architecture_view
node_app -->|"renders"| node_code_viewer
node_app -->|"renders"| node_answer_panel
node_index_hook -->|"starts and polls"| node_api_client
node_query_hook -->|"streams questions"| node_api_client
node_bug_hook -->|"requests investigation"| node_api_client
node_explorer -->|"loads files"| node_api_client
node_architecture_view -->|"loads overview"| node_api_client
node_code_viewer -->|"loads file history"| node_api_client
node_api_client -->|"sends requests"| node_api
node_api -->|"schedules indexing"| node_jobs
node_jobs -.->|"indexes repository"| node_retrieval
node_api -->|"serves repository data"| node_repo_access
node_api -->|"routes questions"| node_answer
node_api -->|"routes streams"| node_streaming
node_api -->|"routes investigations"| node_bug
node_api -->|"routes impact analysis"| node_impact
node_api -->|"builds overview"| node_architecture
node_repo_access -->|"fetches repository"| node_github
node_github -->|"reads repository data"| node_github_actor
node_ingestion -->|"loads file contents"| node_repo_access
node_repo_access -->|"filters paths"| node_filter
node_ingestion -->|"parses code"| node_parser
node_ingestion -->|"creates chunks"| node_chunker
node_retrieval -->|"ingests repository"| node_ingestion
node_retrieval -->|"embeds query and chunks"| node_embedding
node_retrieval -->|"searches and updates"| node_vector_store
node_retrieval -->|"reranks candidates"| node_reranker
node_answer -->|"retrieves evidence"| node_retrieval
node_answer -->|"builds context"| node_context
node_answer -->|"generates answer"| node_llm
node_streaming -->|"retrieves evidence"| node_retrieval
node_streaming -->|"builds context"| node_context
node_streaming -.->|"streams answer"| node_llm
node_llm -->|"calls model"| node_groq
node_bug -->|"reuses retrieval"| node_answer
node_bug -->|"builds evidence"| node_context
node_bug -->|"requests reasoning"| node_llm
node_impact -->|"analyzes repository"| node_repo_access
node_impact -->|"uses dependency parsing"| node_parser
node_architecture -->|"reads repository"| node_repo_access
node_architecture -->|"reads indexed data"| node_vector_store

click node_app "https://github.com/maashu231/codelens-ai/blob/main/frontend/src/App.jsx"
click node_index_hook "https://github.com/maashu231/codelens-ai/blob/main/frontend/src/hooks/useRepositoryIndexing.js"
click node_query_hook "https://github.com/maashu231/codelens-ai/blob/main/frontend/src/hooks/useCodeLensQuery.js"
click node_bug_hook "https://github.com/maashu231/codelens-ai/blob/main/frontend/src/hooks/useBugInvestigation.js"
click node_explorer "https://github.com/maashu231/codelens-ai/blob/main/frontend/src/components/RepositoryExplorer.jsx"
click node_architecture_view "https://github.com/maashu231/codelens-ai/blob/main/frontend/src/components/ArchitectureOverview.jsx"
click node_code_viewer "https://github.com/maashu231/codelens-ai/blob/main/frontend/src/components/CodeViewerModal.jsx"
click node_answer_panel "https://github.com/maashu231/codelens-ai/blob/main/frontend/src/components/AnswerPanel.jsx"
click node_api_client "https://github.com/maashu231/codelens-ai/blob/main/frontend/src/services/api.js"
click node_api "https://github.com/maashu231/codelens-ai/blob/main/backend/main.py"
click node_jobs "https://github.com/maashu231/codelens-ai/blob/main/backend/indexing_jobs.py"
click node_repo_access "https://github.com/maashu231/codelens-ai/blob/main/backend/repository_service.py"
click node_github "https://github.com/maashu231/codelens-ai/blob/main/backend/github_service.py"
click node_ingestion "https://github.com/maashu231/codelens-ai/blob/main/backend/ingestion_service.py"
click node_filter "https://github.com/maashu231/codelens-ai/blob/main/backend/file_filter.py"
click node_parser "https://github.com/maashu231/codelens-ai/blob/main/backend/code_parser.py"
click node_chunker "https://github.com/maashu231/codelens-ai/blob/main/backend/chunker.py"
click node_embedding "https://github.com/maashu231/codelens-ai/blob/main/backend/embedding_provider.py"
click node_vector_store "https://github.com/maashu231/codelens-ai/blob/main/backend/vector_store.py"
click node_retrieval "https://github.com/maashu231/codelens-ai/blob/main/backend/retrieval_service.py"
click node_reranker "https://github.com/maashu231/codelens-ai/blob/main/backend/reranker.py"
click node_answer "https://github.com/maashu231/codelens-ai/blob/main/backend/answer_service.py"
click node_streaming "https://github.com/maashu231/codelens-ai/blob/main/backend/streaming_answer_service.py"
click node_context "https://github.com/maashu231/codelens-ai/blob/main/backend/context_builder.py"
click node_llm "https://github.com/maashu231/codelens-ai/blob/main/backend/llm_service.py"
click node_bug "https://github.com/maashu231/codelens-ai/blob/main/backend/bug_investigation_service.py"
click node_impact "https://github.com/maashu231/codelens-ai/blob/main/backend/impact_service.py"
click node_architecture "https://github.com/maashu231/codelens-ai/blob/main/backend/architecture_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_index_hook,node_query_hook,node_bug_hook,node_explorer,node_architecture_view,node_code_viewer,node_answer_panel,node_api_client toneBlue
class node_api,node_jobs toneAmber
class node_repo_access,node_ingestion,node_filter,node_parser,node_chunker,node_groq toneMint
class node_embedding,node_vector_store,node_retrieval,node_reranker,node_answer,node_streaming,node_context,node_bug,node_impact,node_architecture toneRose
class node_github,node_llm,node_developer,node_github_actor toneIndigo
```

## Components

### Web interface

- [Application shell](https://github.com/maashu231/codelens-ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Indexing controls](https://github.com/maashu231/codelens-ai/blob/main/frontend/src/hooks/useRepositoryIndexing.js): `frontend/src/hooks/useRepositoryIndexing.js`
- [Question controls](https://github.com/maashu231/codelens-ai/blob/main/frontend/src/hooks/useCodeLensQuery.js): `frontend/src/hooks/useCodeLensQuery.js`
- [Bug controls](https://github.com/maashu231/codelens-ai/blob/main/frontend/src/hooks/useBugInvestigation.js): `frontend/src/hooks/useBugInvestigation.js`
- [Repository explorer](https://github.com/maashu231/codelens-ai/blob/main/frontend/src/components/RepositoryExplorer.jsx): `frontend/src/components/RepositoryExplorer.jsx`
- [Architecture view](https://github.com/maashu231/codelens-ai/blob/main/frontend/src/components/ArchitectureOverview.jsx): `frontend/src/components/ArchitectureOverview.jsx`
- [Code and history viewer](https://github.com/maashu231/codelens-ai/blob/main/frontend/src/components/CodeViewerModal.jsx): `frontend/src/components/CodeViewerModal.jsx`
- [Answer and citations](https://github.com/maashu231/codelens-ai/blob/main/frontend/src/components/AnswerPanel.jsx): `frontend/src/components/AnswerPanel.jsx`
- [API client](https://github.com/maashu231/codelens-ai/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API orchestration

- [FastAPI endpoints](https://github.com/maashu231/codelens-ai/blob/main/backend/main.py): `backend/main.py`
- [Indexing jobs](https://github.com/maashu231/codelens-ai/blob/main/backend/indexing_jobs.py): `backend/indexing_jobs.py`

### Repository indexing

- [Repository access](https://github.com/maashu231/codelens-ai/blob/main/backend/repository_service.py): `backend/repository_service.py`
- [File ingestion](https://github.com/maashu231/codelens-ai/blob/main/backend/ingestion_service.py): `backend/ingestion_service.py`
- [File filtering](https://github.com/maashu231/codelens-ai/blob/main/backend/file_filter.py): `backend/file_filter.py`
- [Code parsing](https://github.com/maashu231/codelens-ai/blob/main/backend/code_parser.py): `backend/code_parser.py`
- [Smart chunking](https://github.com/maashu231/codelens-ai/blob/main/backend/chunker.py): `backend/chunker.py`

### Code intelligence

- [Embedding provider](https://github.com/maashu231/codelens-ai/blob/main/backend/embedding_provider.py): `backend/embedding_provider.py`
- [Vector store](https://github.com/maashu231/codelens-ai/blob/main/backend/vector_store.py): `backend/vector_store.py`
- [Retrieval and reranking](https://github.com/maashu231/codelens-ai/blob/main/backend/retrieval_service.py): `backend/retrieval_service.py`
- [Reranker](https://github.com/maashu231/codelens-ai/blob/main/backend/reranker.py): `backend/reranker.py`
- [Answer generation](https://github.com/maashu231/codelens-ai/blob/main/backend/answer_service.py): `backend/answer_service.py`
- [Streaming answers](https://github.com/maashu231/codelens-ai/blob/main/backend/streaming_answer_service.py): `backend/streaming_answer_service.py`
- [Evidence context](https://github.com/maashu231/codelens-ai/blob/main/backend/context_builder.py): `backend/context_builder.py`
- [Bug investigation](https://github.com/maashu231/codelens-ai/blob/main/backend/bug_investigation_service.py): `backend/bug_investigation_service.py`
- [Change impact analysis](https://github.com/maashu231/codelens-ai/blob/main/backend/impact_service.py): `backend/impact_service.py`
- [Repository overview](https://github.com/maashu231/codelens-ai/blob/main/backend/architecture_service.py): `backend/architecture_service.py`

### External services

- [GitHub integration](https://github.com/maashu231/codelens-ai/blob/main/backend/github_service.py): `backend/github_service.py`
- [Groq LLM client](https://github.com/maashu231/codelens-ai/blob/main/backend/llm_service.py): `backend/llm_service.py`

### Other components

- **Developer**
- **Groq API**
- **GitHub**

## Connections

- Developer → Application shell: uses (evidence: `README.md`)
- Application shell → Indexing controls: controls indexing (evidence: `frontend/src/App.jsx`)
- Application shell → Question controls: submits questions (evidence: `frontend/src/App.jsx`)
- Application shell → Bug controls: starts investigations (evidence: `frontend/src/App.jsx`)
- Application shell → Repository explorer: renders (evidence: `frontend/src/App.jsx`)
- Application shell → Architecture view: renders (evidence: `frontend/src/App.jsx`)
- Application shell → Code and history viewer: renders (evidence: `frontend/src/App.jsx`)
- Application shell → Answer and citations: renders (evidence: `frontend/src/App.jsx`)
- Indexing controls → API client: starts and polls (evidence: `frontend/src/hooks/useRepositoryIndexing.js`)
- Question controls → API client: streams questions (evidence: `frontend/src/hooks/useCodeLensQuery.js`)
- Bug controls → API client: requests investigation (evidence: `frontend/src/hooks/useBugInvestigation.js`)
- Repository explorer → API client: loads files (evidence: `frontend/src/components/RepositoryExplorer.jsx`)
- Architecture view → API client: loads overview (evidence: `frontend/src/components/ArchitectureOverview.jsx`)
- Code and history viewer → API client: loads file history (evidence: `frontend/src/components/CodeViewerModal.jsx`)
- API client → FastAPI endpoints: sends requests (evidence: `README.md`)
- FastAPI endpoints → Indexing jobs: schedules indexing (evidence: `backend/main.py`)
- Indexing jobs → Retrieval and reranking: indexes repository
- FastAPI endpoints → Repository access: serves repository data (evidence: `backend/main.py`)
- FastAPI endpoints → Answer generation: routes questions (evidence: `backend/main.py`)
- FastAPI endpoints → Streaming answers: routes streams (evidence: `backend/main.py`)
- FastAPI endpoints → Bug investigation: routes investigations (evidence: `backend/main.py`)
- FastAPI endpoints → Change impact analysis: routes impact analysis (evidence: `backend/main.py`)
- FastAPI endpoints → Repository overview: builds overview (evidence: `backend/main.py`)
- Repository access → GitHub integration: fetches repository (evidence: `backend/repository_service.py`)
- GitHub integration → GitHub: reads repository data (evidence: `backend/github_service.py`)
- File ingestion → Repository access: loads file contents (evidence: `backend/ingestion_service.py`)
- Repository access → File filtering: filters paths (evidence: `backend/repository_service.py`)
- File ingestion → Code parsing: parses code (evidence: `backend/ingestion_service.py`)
- File ingestion → Smart chunking: creates chunks (evidence: `backend/ingestion_service.py`)
- Retrieval and reranking → File ingestion: ingests repository (evidence: `backend/retrieval_service.py`)
- Retrieval and reranking → Embedding provider: embeds query and chunks (evidence: `backend/retrieval_service.py`)
- Retrieval and reranking → Vector store: searches and updates (evidence: `backend/retrieval_service.py`)
- Retrieval and reranking → Reranker: reranks candidates (evidence: `backend/retrieval_service.py`)
- Answer generation → Retrieval and reranking: retrieves evidence (evidence: `backend/answer_service.py`)
- Answer generation → Evidence context: builds context (evidence: `backend/answer_service.py`)
- Answer generation → Groq LLM client: generates answer (evidence: `backend/answer_service.py`)
- Streaming answers → Retrieval and reranking: retrieves evidence (evidence: `backend/streaming_answer_service.py`)
- Streaming answers → Evidence context: builds context (evidence: `backend/streaming_answer_service.py`)
- Streaming answers → Groq LLM client: streams answer
- Groq LLM client → Groq API: calls model (evidence: `backend/llm_service.py`)
- Bug investigation → Answer generation: reuses retrieval (evidence: `backend/bug_investigation_service.py`)
- Bug investigation → Evidence context: builds evidence (evidence: `backend/bug_investigation_service.py`)
- Bug investigation → Groq LLM client: requests reasoning (evidence: `backend/bug_investigation_service.py`)
- Change impact analysis → Repository access: analyzes repository (evidence: `backend/impact_service.py`)
- Change impact analysis → Code parsing: uses dependency parsing (evidence: `backend/impact_service.py`)
- Repository overview → Repository access: reads repository (evidence: `backend/architecture_service.py`)
- Repository overview → Vector store: reads indexed data (evidence: `backend/architecture_service.py`)
