AI-powered GitHub Repository Chat using Retrieval-Augmented Generation (RAG)
Understand any codebase by asking questions in natural language.
RepoChat is an AI-powered Retrieval-Augmented Generation (RAG) application that enables developers to interact with GitHub repositories using natural language. Instead of manually exploring hundreds of source files, users can ask questions about a repository and receive context-aware answers generated directly from the repository's code.
The application clones a GitHub repository, parses and chunks its source code, generates vector embeddings, stores them in MongoDB Atlas Vector Search, and retrieves the most relevant code snippets to generate grounded responses using Gemini 2.5 Flash.
Understanding an unfamiliar codebase is often one of the biggest challenges for developers. Large repositories require navigating multiple folders, reading documentation, and searching through numerous files before understanding how a feature is implemented.
RepoChat simplifies this process by combining semantic search with Retrieval-Augmented Generation (RAG). Instead of relying solely on an LLM's knowledge, it retrieves relevant code from the repository and uses that context to generate accurate, repository-specific answers.
| Category | Technology | Purpose |
|---|---|---|
| Frontend | Streamlit | Interactive web application |
| Backend | FastAPI | REST API development |
| Database | MongoDB Atlas | Store users, repositories, conversations and code chunks |
| Vector Search | MongoDB Atlas Vector Search | Semantic retrieval |
| LLM | Gemini 2.5 Flash | Repository-aware answer generation |
| Embedding Model | BAAI/bge-small-en-v1.5 | Generate vector embeddings |
| Repository Processing | GitIngest | Clone and preprocess GitHub repositories |
| Code Parsing | Tree-sitter | Parse source code into meaningful chunks |
| Authentication | JWT | Secure user authentication |
| Password Security | bcrypt | Password hashing |
| AI SDK | google-generativeai | Gemini integration |
| Embeddings | google gemini embeddings | Embedding generation |
| Validation | Pydantic | Request and response validation |
| Database Driver | PyMongo | MongoDB operations |
| Server | Uvicorn | FastAPI ASGI server |
- AI-powered repository chat using Retrieval-Augmented Generation (RAG)
- Index any public GitHub repository
- Automatic repository cloning and preprocessing
- Language-aware code parsing using Tree-sitter
- Semantic code chunking for efficient retrieval
- Vector embedding generation using Google Gemini Embeddings( gemini-embedding-001)
- Fast semantic search with MongoDB Atlas Vector Search
- Repository-grounded answers generated using Gemini 2.5 Flash
- Secure user authentication using JWT
- Multiple project management
- Persistent conversation history
- Source-aware responses based only on retrieved repository context
GitHub Repository
│
▼
Clone Repository (GitIngest)
│
▼
Parse Source Code (Tree-sitter)
│
▼
Semantic Code Chunking
│
▼
Embedding Generation
│
▼
Store Chunks + Metadata + Embeddings
│
▼
MongoDB Atlas Vector Search
The repository is cloned, parsed into semantic code chunks, embedded using the BAAI embedding model, and stored in MongoDB Atlas Vector Search for efficient semantic retrieval.
User Question
│
▼
Generate Question Embedding
│
▼
Vector Similarity Search
│
▼
Retrieve Relevant Code Chunks
│
▼
Build Prompt
│
▼
Gemini 2.5 Flash
│
▼
Repository-Aware Answer
│
▼
Store Conversation History
For each question, RepoChat generates an embedding for the query, retrieves the most relevant code chunks through vector search, constructs a context-rich prompt, and generates an answer grounded in the repository.
AI-powered GitHub Repository RAG Assistant built using FastAPI, Streamlit, MongoDB Atlas, Tree-sitter, gitingest, and Gemini.
