RepoLens helps developers explore and understand unfamiliar GitHub repositories through conversational AI.
Instead of treating source code as plain text, RepoLens parses supported programming languages using Tree-sitter, breaks the repository into meaningful code units such as functions and classes, converts them into vector embeddings, and retrieves the most relevant source code when a developer asks a question.
The result is a codebase-aware assistant that can answer questions such as:
- Where is authentication implemented?
- What does this service/function do?
- How is this repository structured?
- Which files are relevant to a particular feature?
- Where is a specific function or class defined?
- How does a particular part of the application work?
Responses are streamed to the interface and accompanied by references to the relevant source files and line ranges.
Understanding a new repository usually involves jumping between folders, searching for symbols, tracing functions, and reading large amounts of unrelated code.
RepoLens reduces that exploration process by combining:
AST-aware code understanding + semantic retrieval + symbol lookup + LLM reasoning
Rather than sending an entire repository to an LLM, RepoLens retrieves only the code that is most relevant to the developer's question.
This keeps the context focused while allowing the model to answer using the actual indexed source code.
RepoLens operates in two main stages.
GitHub Repository
β
βΌ
Repository Validation
β
βΌ
Shallow Git Clone
β
βΌ
Tree-sitter Parsing
β
βΌ
AST-aware Code Chunking
β
βΌ
Vector Embeddings
β
βΌ
Qdrant Vector Database
When a repository is submitted:
- Repository metadata is validated.
- The repository is shallow-cloned temporarily.
- Supported source files are parsed using Tree-sitter.
- Functions, classes, methods and other meaningful code structures are extracted as chunks.
- Embeddings are generated for those chunks.
- Embeddings and source metadata are stored in Qdrant.
- Repository metadata, indexing statistics and generated architecture information are stored in MongoDB.
- The temporary cloned repository is removed.
Developer Question
β
βΌ
Question Embedding
β
βββββββββββββββββ
βΌ βΌ
Semantic Search Symbol Lookup
β β
βββββββββ¬ββββββββ
βΌ
Relevant Code Chunks
β
βΌ
Context-Augmented Prompt
β
βΌ
LLM
β
βΌ
Streamed Answer + Sources
For each question, RepoLens performs semantic vector retrieval to locate relevant source-code chunks.
When the query contains a recognizable function, class or identifier, RepoLens also performs an exact symbol-name lookup and combines those results with semantic retrieval.
The selected code is then supplied to the language model as context.
This allows the model to generate an answer grounded in the indexed repository rather than relying only on its pretrained knowledge.
RepoLens uses Tree-sitter rather than splitting code at arbitrary line or character boundaries.
This helps preserve structures such as:
- Functions
- Classes
- Methods
- Interfaces
- Type aliases
- Exported declarations
Currently supported languages include:
- JavaScript
- JSX
- TypeScript
- TSX
- Python
Source-code chunks are converted into embeddings and stored inside Qdrant.
Questions are embedded using the same embedding model, allowing RepoLens to retrieve code based on semantic similarity rather than requiring exact text matches.
Semantic search is complemented by exact identifier lookup.
For example, a question containing:
parseGithubUrl
can directly retrieve a chunk associated with that symbol even when vector similarity alone does not rank it highly.
Developers can ask natural-language questions about the repository without manually navigating every file.
Conversation information is persisted through MongoDB chat sessions so previous interactions can be supplied to the language model during a conversation.
LLM responses are streamed using Server-Sent Events (SSE).
Instead of waiting for the complete generated response, the frontend displays tokens as they arrive.
Retrieved chunks retain metadata including:
- File path
- Symbol name
- Programming language
- Starting line
- Ending line
Relevant source references are displayed alongside generated responses, making it easier to verify the answer against the actual repository.
After indexing, RepoLens provides information about the repository such as:
- Number of processed files
- Number of generated code chunks
- Total indexed lines
- Language distribution
- AI-generated architecture summary
This gives developers an initial overview before they begin exploring individual components.
| Layer | Technology |
|---|---|
| Frontend | React, Vite, Tailwind CSS |
| Backend | Node.js, Express.js |
| Database | MongoDB |
| Vector Database | Qdrant |
| Code Parsing | Tree-sitter |
| GitHub Integration | Octokit, Simple Git |
| Embeddings | OpenAI / OpenAI-compatible embedding models |
| LLM | OpenAI / Ollama-compatible models |
| Streaming | Server-Sent Events |
| Deployment | Vercel + Render |
flowchart LR
USER[Developer] --> UI[React Frontend]
UI -->|Repository URL| API[Express API]
API --> GH[GitHub]
API --> PARSER[Tree-sitter Parser]
PARSER --> CHUNKS[AST Code Chunks]
CHUNKS --> EMB[Embedding Model]
EMB --> VECTOR[(Qdrant)]
API --> DB[(MongoDB)]
UI -->|Question| API
API --> QEMB[Query Embedding]
QEMB --> VECTOR
VECTOR -->|Relevant Code| API
API --> LLM[Language Model]
LLM -->|SSE Stream| API
API --> UI
The architecture separates repository ingestion from repository querying.
Indexing path
Clone β Parse β Chunk β Embed β Store
Query path
Question β Retrieve β Augment β Generate β Stream
Make sure you have:
- Node.js 20
- npm
- Git
- Docker, or hosted MongoDB and Qdrant instances
- OpenAI API access or an OpenAI-compatible local model provider
git clone <your-repository-url>
cd repolenscd server
npm installCreate the environment file:
cp .env.example .envConfigure the required environment variables inside .env.
cd ../client
npm installFrom the project root:
docker compose up -dcd server
npm run devOpen another terminal:
cd client
npm run devThen open the local Vite application and submit a small public GitHub repository for testing.
repolens/
β
βββ client/
β βββ src/
β βββ api/
β βββ components/
β βββ pages/
β βββ App.jsx
β βββ main.jsx
β
βββ server/
β βββ src/
β βββ config/
β βββ models/
β βββ routes/
β βββ services/
β β βββ github.js
β β βββ chunker.js
β β βββ embedder.js
β β βββ vectorStore.js
β β βββ llm.js
β β βββ indexer.js
β β
β βββ utils/
β βββ index.js
β
βββ docker-compose.yml
βββ README.md
RepoLens is designed to explore how Retrieval-Augmented Generation can be applied to structured source code rather than traditional documents.
The project combines compiler-style source parsing with semantic retrieval and generative AI to create a practical developer tool for:
codebase exploration, developer onboarding and repository intelligence.