AI-Powered Repository Analysis & Code Understanding Platform
Understand any GitHub repository using Retrieval-Augmented Generation (RAG), semantic search, and Google Gemini.
Features • Architecture • Getting Started • API • Roadmap
CodeDoctor AI is currently intended to be run locally.
- Python 3.11+
- Node.js 18+
- Git
- Google Gemini API Key
After completing the setup instructions in the Getting Started section:
- Frontend: http://localhost:3000
- Backend: http://localhost:8000
- Swagger Docs: http://localhost:8000/docs
Note
This project currently runs locally due to the computational requirements of repository indexing and embedding generation. Cloud deployment can be done as per requirements.
Reading an unfamiliar codebase can take hours. CodeDoctor AI helps developers understand repositories in minutes by letting them ask questions in natural language.
Rather than sending an entire repository to an LLM, CodeDoctor AI:
- 📂 Clones the repository
- 🔍 Scans the source code
- 🧠 Generates semantic embeddings
- ⚡ Retrieves only the most relevant code
- 🤖 Uses Google Gemini to generate repository-aware answers
This Retrieval-Augmented Generation (RAG) pipeline produces significantly more accurate and context-aware responses than querying an LLM directly.
Ask natural-language questions like:
|
Retrieves code by meaning, not keywords, using vector embeddings for higher-quality matches. Every answer includes the exact files and line numbers used to generate the response. Powered by Sentence Transformers + FAISS Vector Search. |
GitHub Repository
│
▼
Repository Cloner
│
▼
Source Code Scanner
│
▼
Code Chunking
│
▼
SentenceTransformer Embeddings
│
▼
FAISS Vector Index ◄──── User Question Embedding
│
▼
Semantic Similarity Search
│
▼
Relevant Repository Chunks
│
▼
Google Gemini API
│
▼
Context-Aware AI Response
│
▼
Next.js Frontend
| Layer | Technologies |
|---|---|
| Frontend | Next.js, React, TypeScript, Tailwind CSS, shadcn/ui |
| Backend | FastAPI, Python, GitPython, Uvicorn |
| AI / Retrieval | Google Gemini, SentenceTransformers, FAISS, RAG |
| Utilities | NumPy, python-dotenv, pathlib |
| Step | Description |
|---|---|
| 1 | User submits a public GitHub repository URL |
| 2 | Repository is cloned locally |
| 3 | Supported source files are scanned |
| 4 | Each file is split into overlapping chunks |
| 5 | Each chunk is converted into semantic embeddings using SentenceTransformers |
| 6 | A FAISS vector index is created |
| 7 | The user's question is embedded |
| 8 | The most relevant code snippets are retrieved |
| 9 | Only those snippets are sent to Google Gemini |
| 10 | Gemini generates a repository-aware response with source references |
CodeDoctor-AI/
├── backend/
│ ├── app/
│ │ ├── routers/
│ │ ├── services/
│ │ │ ├── clone_service.py
│ │ │ ├── scanner_service.py
│ │ │ ├── chunking_service.py
│ │ │ ├── embedding_service.py
│ │ │ ├── retrieval_service.py
│ │ │ ├── gemini_service.py
│ │ │ ├── rag_service.py
│ │ │ └── model_service.py
│ │ ├── storage/
│ │ └── main.py
│ ├── requirements.txt
│ └── .env
│
├── frontend/
│ ├── src/
│ │ ├── app/
│ │ ├── components/
│ │ ├── ui/
│ │ └── lib/
│ ├── public/
│ ├── package.json
│ └── next.config.ts
│
└── README.md
git clone https://github.com/manojkumar260706/CodeDoctor-Ai
cd CodeDoctor-AINavigate to the backend directory:
cd backendInstall dependencies:
pip install -r requirements.txtCreate a .env file:
GEMINI_API_KEY=YOUR_API_KEYRun the backend server:
uvicorn app.main:app --reloadBackend:
http://localhost:8000
Swagger Documentation:
http://localhost:8000/docs
Open a second terminal.
cd frontend
npm install
npm run devFrontend:
http://localhost:3000
- Start both the backend and frontend.
- Open http://localhost:3000.
- Paste the URL of any public GitHub repository.
- Wait while CodeDoctor AI clones, scans, chunks, embeds, and indexes the repository.
- Ask questions about the repository in natural language.
Analyze and index a repository.
{
"repo_url": "https://github.com/user/project"
}Ask a question about an indexed repository.
{
"repo_url": "https://github.com/user/project",
"question": "Where is authentication implemented?"
}Example Response
{
"answer": "Authentication is implemented in SecurityConfig.java using JWT filters.",
"sources": [
{
"file": "SecurityConfig.java",
"start_line": 24,
"end_line": 78
}
]
}- GitHub repository cloning
- Source code scanning
- Code chunking
- Sentence embeddings
- FAISS vector indexing
- Semantic retrieval
- Google Gemini integration
- FastAPI backend
- Next.js frontend
- Repository-aware AI chat
- Repository dashboard
- Repository structure visualization
- Language analytics
- AI-generated repository summary
- Suggested questions
- Architecture visualization
- Streaming responses
- Chat history
- Repository caching
- Docker support
- Authentication
- Cloud deployment
Contributions are welcome! Feel free to fork the repository, open issues, or submit pull requests.
If this project helped you, please consider giving it a ⭐ Star on GitHub. It helps others discover the project and motivates future development.

