Skip to content
yashpatil322Public

About

๐Ÿ” RepoScan โ€“ An AI-powered codebase intelligence platform that transforms GitHub repositories into interactive knowledge bases. ๐Ÿค– Ask questions, explore source code, and get context-aware answers with file-level citations using RAG, Gemini AI, Tree-sitter, and ChromaDB.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ” RepoScan

Understand Any Codebase. Just Ask.

An AI-powered codebase intelligence platform that transforms GitHub repositories into searchable, interactive knowledge bases using Retrieval-Augmented Generation (RAG), semantic search, and intelligent source code analysis.

Stop searching through files. Start asking questions.

Python FastAPI React Google Gemini ChromaDB Tree-sitter RAG Vite Vercel Render

GitHub Stars GitHub Forks GitHub Last Commit GitHub Repo Size


๐Ÿ“– About the Project

RepoScan is a full-stack AI-powered developer tool designed to simplify the process of understanding unfamiliar and complex codebases.

Instead of manually navigating hundreds of source files, developers can provide a GitHub repository URL and ask questions in natural language.

RepoScan analyzes the repository, extracts meaningful code structures, generates vector embeddings, and retrieves relevant source code to generate context-aware answers with file paths and line number citations.

The platform combines Retrieval-Augmented Generation (RAG), AST-aware code parsing, vector similarity search, and Google Gemini AI to deliver an intelligent code exploration experience.


๐Ÿšจ Problem Statement

Understanding an unfamiliar codebase can be challenging and time-consuming.

Developers frequently encounter problems such as:

  • Navigating large and complex repositories.
  • Understanding undocumented source code.
  • Finding specific functions and implementations.
  • Identifying authentication and business logic.
  • Understanding unfamiliar programming languages.
  • Onboarding into existing software projects.
  • Receiving inaccurate answers from generic AI tools without repository-specific context.

RepoScan addresses these challenges by making source code searchable through natural language.


โœจ Key Features

๐Ÿ”— GitHub Repository Ingestion

Provide a GitHub repository URL to clone, analyze, and index its source code automatically.

๐Ÿค– AI-Powered Codebase Q&A

Ask natural language questions about indexed repositories and receive context-aware answers powered by Google Gemini AI.

๐Ÿง  Retrieval-Augmented Generation (RAG)

Retrieve relevant code chunks before generating answers, grounding AI responses in actual repository content.

๐ŸŒณ AST-Aware Code Parsing

Uses Tree-sitter to analyze source code syntax and extract meaningful functions, classes, methods, and other code structures.

Unlike arbitrary text splitting, syntax-aware chunking preserves meaningful code boundaries.

๐Ÿ”Ž Semantic Code Search

Find relevant source code based on meaning rather than exact keyword matches.

๐Ÿ“Œ Source Code Citations

AI-generated answers include references to source files and relevant line ranges, allowing developers to verify the information.

โšก Streaming AI Responses

Supports Server-Sent Events (SSE) to stream AI-generated answers progressively.

๐Ÿ—ƒ๏ธ Multi-Repository Management

Index, browse, query, and manage multiple GitHub repositories through a unified backend.

๐Ÿ“Š Repository Analytics

Explore indexed repository statistics, including processed files, code chunks, and detected programming languages.

๐Ÿ”„ Background Processing

Repository ingestion runs as a background task with progress tracking.

๐Ÿงฉ Related Code Discovery

Discover semantically similar code chunks using vector similarity search.

๐ŸŽจ Modern Web Interface

A React-based frontend using modern styling, animation, and visualization libraries.


๐Ÿ—๏ธ System Architecture

Repository Ingestion Pipeline

flowchart TD
    A[GitHub Repository URL] --> B[Repository Cloning]
    B --> C[Source File Discovery]
    C --> D[Tree-sitter Parser]
    D --> E[AST-Aware Code Chunking]
    E --> F[FastEmbed Embedding Model]
    F --> G[(ChromaDB Vector Database)]
Loading

AI Question Answering Pipeline

flowchart TD
    A[User Question] --> B[FastAPI Backend]
    B --> C[Question Embedding]
    C --> D[Semantic Similarity Search]
    E[(ChromaDB)] --> D
    D --> F[Top-K Relevant Code Chunks]
    F --> G[Context and Prompt Construction]
    G --> H[Google Gemini AI]
    H --> I[Answer with Source Citations]
    I --> J[React Frontend]
Loading

๐Ÿง  How RAG Works in RepoScan

Retrieval-Augmented Generation allows an AI model to generate answers using relevant external information rather than relying only on its pretrained knowledge.

RepoScan implements RAG in three major stages.

Stage 1 โ€” Repository Indexing

  1. Clone the GitHub repository.
  2. Identify supported source code files.
  3. Parse files using Tree-sitter.
  4. Extract meaningful code chunks.
  5. Generate vector embeddings using FastEmbed.
  6. Store embeddings and metadata in ChromaDB.

Stage 2 โ€” Semantic Retrieval

  1. Receive a natural language question.
  2. Convert the question into an embedding.
  3. Perform vector similarity search.
  4. Retrieve the most relevant code chunks.
  5. Collect source file paths and line ranges.

Stage 3 โ€” AI Answer Generation

  1. Construct a context-aware prompt.
  2. Provide retrieved code chunks to Gemini AI.
  3. Generate a repository-specific answer.
  4. Include source code references.
  5. Return or stream the response to the user.

๐Ÿ’ก What Makes RepoScan Different?

Traditional Code Search RepoScan
Keyword-based searching Semantic vector search
Manual file exploration Natural language queries
Arbitrary text chunking AST-aware code chunking
Generic AI responses Repository-grounded responses
Manual source verification File and line citations
Limited contextual understanding Retrieved code context
Individual file exploration Repository-wide indexing

RepoScan focuses on understanding the structure and meaning of source code, rather than simply matching text.


๐Ÿ› ๏ธ Technology Stack

Frontend

Technology Purpose
React Component-based user interface
Vite Development and build tooling
JavaScript Frontend application logic
Tailwind CSS Interface styling
Framer Motion Animations and transitions
Three.js 3D visualization capabilities
React Three Fiber React-based 3D rendering
React Router Application navigation
Axios API communication
Lucide React Interface icons

Backend

Technology Purpose
Python Backend programming language
FastAPI REST API development
Uvicorn ASGI application server
Pydantic Data validation and schemas
GitPython Repository cloning
Tree-sitter Syntax-aware code parsing
FastEmbed Vector embedding generation
ChromaDB Vector storage and retrieval
Google Gemini AI AI answer generation
SSE-Starlette Streaming responses

Deployment

Platform Purpose
Vercel Frontend deployment
Render Backend deployment configuration
GitHub Source code and version control

๐Ÿ“‚ Project Structure

RepoScan/
โ”‚
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”‚   โ””โ”€โ”€ models.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ingest/
โ”‚   โ”‚   โ”œโ”€โ”€ clone.py
โ”‚   โ”‚   โ”œโ”€โ”€ languages.py
โ”‚   โ”‚   โ”œโ”€โ”€ parse.py
โ”‚   โ”‚   โ””โ”€โ”€ embed.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ query/
โ”‚   โ”‚   โ”œโ”€โ”€ retrieve.py
โ”‚   โ”‚   โ””โ”€โ”€ answer.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ .env.example
โ”‚   โ””โ”€โ”€ requirements.txt
โ”‚
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ codebase-qa-bot-guide.md
โ”œโ”€โ”€ walkthrough.md
โ”œโ”€โ”€ render.yaml
โ””โ”€โ”€ README.md

๐Ÿš€ Getting Started

Prerequisites

  • Python
  • Node.js
  • npm
  • Git
  • Google Gemini API key

1. Clone the Repository

git clone https://github.com/yashpatil322/RepoScan.git
cd RepoScan

2. Configure the Backend

cd backend
python -m venv venv

Activate the virtual environment.

Windows:

venv\Scripts\activate

Linux / macOS:

source venv/bin/activate

Install the required dependencies.

pip install -r requirements.txt

3. Configure Environment Variables

Create a .env file inside the backend directory using .env.example as a reference.

GEMINI_API_KEY=your_gemini_api_key_here

Configure the remaining embedding and database settings according to the provided environment template.

Get a Gemini API key from:

https://aistudio.google.com/apikey

Never commit your private API keys to GitHub.

4. Start the Backend Server

uvicorn api.main:app --reload --port 8000

Backend API:

http://localhost:8000

Interactive Swagger documentation:

http://localhost:8000/docs

5. Configure the Frontend

Open a separate terminal from the project root.

cd frontend
npm install
npm run dev

Configure the frontend API base URL to point to your running backend, if required.

Open the local URL displayed in your terminal.


๐Ÿ”Œ API Reference

RepoScan provides 12 documented REST API endpoints across five functional modules.

Repository Ingestion

Method Endpoint Description
POST /ingest Clone and index repository
GET /ingest/status Track ingestion progress

AI Question Answering

Method Endpoint Description
POST /query Generate AI answer
POST /query/stream Stream AI answer using SSE

Repository Management

Method Endpoint Description
GET /repos List indexed repositories
DELETE /repos/{repo_id} Delete indexed repository
GET /repos/{repo_id}/chunks Browse indexed code

Semantic Search

Method Endpoint Description
POST /search Search relevant code chunks
GET /search/similar/{chunk_id} Find related code

System Utilities

Method Endpoint Description
GET /health System health check
GET /languages Supported languages
GET /stats Repository and indexing statistics

For detailed API documentation, refer to:

๐Ÿ“˜ Backend API Walkthrough


๐Ÿงช Example Usage

Index a GitHub Repository

curl -X POST http://localhost:8000/ingest \
  -H "Content-Type: application/json" \
  -d '{"repo_url":"https://github.com/tiangolo/fastapi"}'

Wait for the repository ingestion task to complete.

Ask a Question

curl -X POST http://localhost:8000/query \
  -H "Content-Type: application/json" \
  -d '{
    "question": "How does dependency injection work?",
    "repo_id": "tiangolo-fastapi",
    "top_k": 5
  }'

The response includes the generated answer, retrieved sources, file paths, line ranges, and other retrieval metadata.


๐Ÿ’ฌ Example Questions

Once a repository is indexed, you can ask:

  • Where is user authentication implemented?
  • How does the application connect to the database?
  • Explain the architecture of this project.
  • Where are the API routes defined?
  • How does the payment processing module work?
  • Which functions handle error validation?
  • How does the application manage user sessions?
  • Where is the middleware implemented?
  • Explain the role of this particular class.
  • How are background tasks scheduled?

Answer quality depends on the retrieved code and the completeness of repository indexing.


๐Ÿ’ป Supported Programming Languages

The parser is designed to support multiple programming languages, including:

  • ๐Ÿ Python
  • ๐ŸŸจ JavaScript
  • ๐Ÿ”ท TypeScript
  • โ˜• Java
  • ๐Ÿน Go
  • ๐Ÿฆ€ Rust
  • โš™๏ธ C
  • ๐Ÿ’Ž Ruby

Use the /languages endpoint to view the complete list available in the running backend.


๐ŸŽฏ Use Cases

Developer Onboarding

Understand unfamiliar repositories without manually reading every source file.

Open-Source Exploration

Explore the architecture and implementation of open-source software projects.

Code Documentation Assistance

Generate explanations of functions, classes, and application components.

Software Maintenance

Locate relevant implementations before modifying existing software.

Technical Learning

Learn how real-world software systems implement different programming concepts.

Code Discovery

Find related implementations across indexed source files using semantic search.


๐Ÿ”ฎ Future Roadmap

  • Private GitHub repository integration
  • GitHub OAuth authentication
  • Conversational memory
  • Cross-encoder retrieval re-ranking
  • Automatic repository synchronization
  • GitHub pull request analysis
  • AI-assisted code review
  • Repository dependency graph visualization
  • VS Code extension
  • Local LLM integration
  • Multi-model AI support
  • Automated documentation generation
  • Docker-based deployment
  • Team workspaces

๐Ÿ”’ Security & Privacy

  • API keys should be stored in environment variables.
  • Sensitive configuration must not be committed.
  • Only index repositories you are authorized to access.
  • Retrieved code may be sent to the configured AI provider for answer generation.
  • AI-generated answers should be verified against the original source code.
  • Repository content should be treated as untrusted input before production deployment.

๐Ÿ“š Documentation


๐Ÿ‘จโ€๐Ÿ’ป Developer

Yash Patil

Computer Engineering | Artificial Intelligence | Full-Stack Development | Software Engineering


๐Ÿค Contributing

Contributions, suggestions, and improvements are welcome.

  1. Fork the repository.
  2. Create a feature branch.
  3. Commit your changes.
  4. Push to your branch.
  5. Open a pull request.

โญ Support

If you find RepoScan useful or interesting, consider giving the repository a star.

๐Ÿ” RepoScan

From Repositories to Intelligence.

Read Less. Understand More. Build Better.

Built with โค๏ธ, Python, React, and Artificial Intelligence.

About

๐Ÿ” RepoScan โ€“ An AI-powered codebase intelligence platform that transforms GitHub repositories into interactive knowledge bases. ๐Ÿค– Ask questions, explore source code, and get context-aware answers with file-level citations using RAG, Gemini AI, Tree-sitter, and ChromaDB.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages