# akshat-rathor/codelens-ai architecture

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

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

## Overview

CodeLens AI lets a user submit a GitHub repository for indexing, then ask questions answered from retrieved code with source references. The backend’s pipeline coordinates repository ingestion and question answering; retrieval combines lexical and vector search before reranking and LLM generation. The frontend and API calls are visible in excerpts. Some backend modules are represented only by the source index, so their internal behavior and external-service wiring are not expanded.

Main entry points: [`backend/app/pipeline.py`](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/pipeline.py) (Workflow pipeline), [`backend/app/retrieval/hybrid.py`](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/retrieval/hybrid.py) (Hybrid search), [`frontend/src/App.tsx`](https://github.com/akshat-rathor/codelens-ai/blob/main/frontend/src/App.tsx) (CodeLens workspace), [`backend/app/main.py`](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/main.py) (HTTP API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_frontend["CodeLens workspace<br/>[App.tsx]"]
end

subgraph group_api["API orchestration"]
  node_api["HTTP API<br/>[main.py]"]
  node_pipeline["Workflow pipeline<br/>[pipeline.py]"]
end

subgraph group_ingestion["Code ingestion"]
  node_github["Repository clone<br/>[github.py]"]
  node_filter["Source file filter<br/>[file_filter.py]"]
  node_parser["Python parser<br/>[parser.py]"]
  node_chunker["Code chunker<br/>[chunker.py]"]
end

subgraph group_retrieval["Retrieval and storage"]
  node_embeddings["Embedding generation<br/>[embeddings.py]"]
  node_vectorstore[("Qdrant vector store<br/>[vector_store.py]")]
  node_bm25["BM25 index<br/>[bm25.py]"]
  node_hybrid["Hybrid search<br/>[hybrid.py]"]
  node_reranker["Result reranker<br/>[reranker.py]"]
end

subgraph group_answering["Answer generation"]
  node_generator["Answer generator<br/>[generator.py]"]
end

node_user(("Repository user"))
node_groq["Groq LLM service"]

node_user -->|"submits repository and questions"| node_frontend
node_frontend -->|"posts analyze and ask requests"| node_api
node_api -->|"dispatches workflows"| node_pipeline
node_pipeline -->|"clones repository"| node_github
node_pipeline -->|"selects source files"| node_filter
node_pipeline -->|"parses Python files"| node_parser
node_pipeline -->|"chunks parsed code"| node_chunker
node_pipeline -->|"embeds chunks and queries"| node_embeddings
node_pipeline -->|"creates collection and stores vectors"| node_vectorstore
node_pipeline -->|"builds repository index"| node_bm25
node_pipeline -->|"retrieves candidates"| node_hybrid
node_hybrid -->|"searches vectors"| node_vectorstore
node_hybrid -->|"searches lexical index"| node_bm25
node_pipeline -->|"reranks candidates"| node_reranker
node_pipeline -->|"generates grounded answer"| node_generator
node_generator -.->|"requests completion"| node_groq

click node_frontend "https://github.com/akshat-rathor/codelens-ai/blob/main/frontend/src/App.tsx"
click node_api "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/main.py"
click node_pipeline "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/pipeline.py"
click node_github "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/ingestion/github.py"
click node_filter "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/ingestion/file_filter.py"
click node_parser "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/code_intelligence/parser.py"
click node_chunker "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/ingestion/chunker.py"
click node_embeddings "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/retrieval/embeddings.py"
click node_vectorstore "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/retrieval/vector_store.py"
click node_bm25 "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/retrieval/bm25.py"
click node_hybrid "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/retrieval/hybrid.py"
click node_reranker "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/retrieval/reranker.py"
click node_generator "https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/llm/generator.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_frontend,node_user toneBlue
class node_api,node_pipeline toneAmber
class node_github,node_filter,node_parser,node_chunker toneMint
class node_embeddings,node_vectorstore,node_bm25,node_hybrid,node_reranker toneRose
class node_generator,node_groq toneIndigo
```

## Components

### User interface

- [CodeLens workspace](https://github.com/akshat-rathor/codelens-ai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`

### API orchestration

- [HTTP API](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/main.py): `backend/app/main.py`
- [Workflow pipeline](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/pipeline.py): `backend/app/pipeline.py`

### Code ingestion

- [Repository clone](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/ingestion/github.py): `backend/app/ingestion/github.py`
- [Source file filter](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/ingestion/file_filter.py): `backend/app/ingestion/file_filter.py`
- [Python parser](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/code_intelligence/parser.py): `backend/app/code_intelligence/parser.py`
- [Code chunker](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/ingestion/chunker.py): `backend/app/ingestion/chunker.py`

### Retrieval and storage

- [Embedding generation](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/retrieval/embeddings.py): `backend/app/retrieval/embeddings.py`
- [Qdrant vector store](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/retrieval/vector_store.py): `backend/app/retrieval/vector_store.py`
- [BM25 index](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/retrieval/bm25.py): `backend/app/retrieval/bm25.py`
- [Hybrid search](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/retrieval/hybrid.py): `backend/app/retrieval/hybrid.py`
- [Result reranker](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/retrieval/reranker.py): `backend/app/retrieval/reranker.py`

### Answer generation

- [Answer generator](https://github.com/akshat-rathor/codelens-ai/blob/main/backend/app/llm/generator.py): `backend/app/llm/generator.py`

### Other components

- **Repository user**
- **Groq LLM service**

## Connections

- Repository user → CodeLens workspace: submits repository and questions (evidence: `frontend/src/App.tsx`)
- CodeLens workspace → HTTP API: posts analyze and ask requests (evidence: `frontend/src/App.tsx`)
- HTTP API → Workflow pipeline: dispatches workflows (evidence: `backend/app/main.py`)
- Workflow pipeline → Repository clone: clones repository (evidence: `backend/app/pipeline.py`)
- Workflow pipeline → Source file filter: selects source files (evidence: `backend/app/pipeline.py`)
- Workflow pipeline → Python parser: parses Python files (evidence: `backend/app/pipeline.py`)
- Workflow pipeline → Code chunker: chunks parsed code (evidence: `backend/app/pipeline.py`)
- Workflow pipeline → Embedding generation: embeds chunks and queries (evidence: `backend/app/pipeline.py`)
- Workflow pipeline → Qdrant vector store: creates collection and stores vectors (evidence: `backend/app/pipeline.py`)
- Workflow pipeline → BM25 index: builds repository index (evidence: `backend/app/pipeline.py`)
- Workflow pipeline → Hybrid search: retrieves candidates (evidence: `backend/app/pipeline.py`)
- Hybrid search → Qdrant vector store: searches vectors (evidence: `backend/app/retrieval/hybrid.py`)
- Hybrid search → BM25 index: searches lexical index (evidence: `backend/app/retrieval/hybrid.py`)
- Workflow pipeline → Result reranker: reranks candidates (evidence: `backend/app/pipeline.py`)
- Workflow pipeline → Answer generator: generates grounded answer (evidence: `backend/app/pipeline.py`)
- Answer generator → Groq LLM service: requests completion
