An AI-powered codebase companion that lets you understand a GitHub repository through natural-language questions.
Streamlit App: Live App
GitHub: prachishr/codebase-qa-assistant
Codebase QA Assistant turns a public GitHub repository into a searchable knowledge base and lets users ask questions about its implementation, documentation, architecture, and available Git information.
Instead of sending an entire repository to an LLM, the application ingests the repository, creates meaningful code/document chunks, generates embeddings, retrieves relevant context, and then uses an LLM to generate a grounded answer with source files.
The application also includes Supabase Authentication and PostgreSQL-backed private conversation history, so each authenticated user has their own chat history.
- ๐ Authentication โ Email/password signup and login with Supabase Auth
- ๐ GitHub Analysis โ Clone and process public repositories
- ๐งฉ AST-aware Code Chunking โ Preserve meaningful functions, methods, and classes
- ๐ Documentation Ingestion โ Process Markdown and text documentation
- ๐ณ Git Information โ Extract available commit metadata
- ๐ค Local Embeddings โ
sentence-transformers/all-MiniLM-L6-v2 - โก FAISS Retrieval โ Fast local vector similarity search
- ๐ Hybrid Retrieval Logic โ Project overview, keywords, exact code symbols, and semantic search
- ๐ค RAG with Groq โ Generate repository-grounded answers
- ๐ Source References โ Show the files used for an answer
- ๐ฌ Persistent Chats โ Save and reopen previous conversations
- ๐ค User-specific History โ Conversations are isolated by authenticated user ID
- โ๏ธ Streamlit Deployment โ Designed for Streamlit Community Cloud
flowchart TD
A[User] --> B[Supabase Auth]
B --> C[Authenticated User ID]
C --> D[Streamlit Application]
D --> E[GitHub Repository URL]
E --> F[Repository Ingestion]
F --> G[Source Code]
F --> H[Documentation]
F --> I[Git Information]
G --> J[Tree-sitter AST Chunking]
H --> K[Text Splitting]
I --> K
J --> L[Repository Chunks]
K --> L
L --> M[Hugging Face Embeddings]
M --> N[FAISS Vector Index]
D --> O[User Question]
O --> P[Retrieval Layer]
N --> P
P --> Q[Relevant Repository Context]
Q --> R[Groq LLM]
R --> S[Grounded Answer + Sources]
D --> T[database.py]
T --> U[PostgreSQL]
U --> V[Conversations]
U --> W[Messages]
GitHub URL
โ
Repository Ingestion
โ
Code / Docs / Git Information
โ
AST-aware + Text Chunking
โ
Hugging Face Embeddings
โ
FAISS Vector Index
โ
User Question
โ
Retrieval
โ
Relevant Repository Context
โ
Groq LLM
โ
Grounded Answer + Sources
Conversation persistence runs alongside the application:
Supabase Auth
โ
User ID
โ
database.py
โ
PostgreSQL
โ
Private Conversations + Messages
The application follows a Retrieval-Augmented Generation (RAG) approach.
The repository is cloned locally using GitPython. Relevant source-code files, documentation, and available Git commit information are extracted.
Code and documentation are processed differently.
Code: Tree-sitter parses supported languages and extracts meaningful AST structures such as functions, methods, classes, and related definitions.
Documentation: Markdown and text files are split using a recursive text splitter.
The root README.md receives higher source priority because it commonly contains project-level information.
Each chunk is converted into a vector using:
sentence-transformers/all-MiniLM-L6-v2
The model runs locally, so embedding generation does not require a Hugging Face API key.
For each question, the retrieval layer can use:
- Project overview retrieval
- Keyword matching
- Exact code-symbol/function matching
- FAISS semantic similarity search
- Duplicate reduction
- Source prioritization
The retrieved chunks are combined into a context and sent to the Groq LLM.
Current model:
openai/gpt-oss-20b
The model is instructed to answer using the supplied repository context and avoid inventing unsupported information.
Supabase is used for authentication, while PostgreSQL is used for persistent application data.
User
โ
Supabase Auth
โ
Unique User ID
โ
Streamlit Session
โ
database.py
โ
PostgreSQL
Each conversation is associated with the authenticated user's ID.
The database contains two main tables:
conversations
โโโ id
โโโ user_id
โโโ title
โโโ repository_url
โโโ created_at
messages
โโโ id
โโโ conversation_id
โโโ role
โโโ content
โโโ source_files
โโโ created_at
A conversation can contain multiple messages:
User
โโโ Conversation
โโโ User Message
โโโ Assistant Message
โโโ User Message
โโโ Assistant Message
Database queries filter by user_id, so one authenticated user cannot retrieve another user's conversation history through the application's database operations.
Supabase is the backend platform hosting the project's PostgreSQL database.
The project uses two connections:
- Supabase Python client โ Authentication and user identity
- psycopg2 โ Direct PostgreSQL connection for conversations/messages
So:
Supabase Auth
โ
User ID
โ
PostgreSQL
โ
Chat History
| Technology | Role |
|---|---|
| Python | Core application |
| Streamlit | Web UI and deployment |
| GitPython | Repository cloning and Git operations |
| Tree-sitter | AST-based code parsing |
| Tree-sitter Language Pack | Multi-language parser support |
| LangChain | Document/vector-store integration |
| Sentence Transformers | Local embedding generation |
| Hugging Face | Embedding model ecosystem |
| FAISS | Vector similarity search |
| Groq | LLM inference |
| Supabase Auth | User authentication |
| PostgreSQL | Persistent conversation storage |
| psycopg2 | PostgreSQL connectivity |
| python-dotenv | Local environment configuration |
Embedding model
sentence-transformers/all-MiniLM-L6-v2
LLM
openai/gpt-oss-20b
Codebase-QA-Assistant/
โ
โโโ app.py # Streamlit UI, authentication and app flow
โโโ ingestion.py # Repository ingestion
โโโ chunking.py # AST-aware and text-based chunking
โโโ vector_store.py # Embeddings + FAISS index
โโโ retrieval.py # Repository retrieval logic
โโโ RAG.py # Context building + LLM generation
โโโ database.py # PostgreSQL operations
โ
โโโ requirements.txt # Python dependencies
โโโ README.md # Project documentation
โโโ .gitignore # Ignored files and secrets
โ
โโโ .env # Local secrets (not committed)
repo/
faiss_index/
repo_state.json
These generated resources are intentionally excluded from Git.
git clone https://github.com/prachishr/codebase-qa-assistant.git
cd codebase-qa-assistantpython -m venv .venvWindows:
.venv\Scripts\activatepip install -r requirements.txtCreate .env:
GROQ_API_KEY=your_groq_api_key
SUPABASE_URL=your_supabase_project_url
SUPABASE_KEY=your_supabase_key
DB_PASSWORD=your_database_passwordNever commit
.env, API keys, or database passwords.
streamlit run app.pyOpen:
http://localhost:8501
For authentication, create a Supabase project and enable email/password authentication.
Configure the authentication Site URL / Redirect URLs for your local and deployed Streamlit application.
For local development:
http://localhost:8501
For production, use the deployed Streamlit application URL.
The application's Supabase credentials should be provided through environment variables locally and Streamlit Secrets when deployed.
The application is designed to run on Streamlit Community Cloud.
Typical deployment flow:
GitHub
โ
Streamlit Community Cloud
โ
Install requirements.txt
โ
Configure Secrets
โ
Run app.py
Example Streamlit secrets:
GROQ_API_KEY = "your_groq_api_key"
SUPABASE_URL = "your_supabase_project_url"
SUPABASE_KEY = "your_supabase_key"
DB_PASSWORD = "your_database_password"After analyzing a repository, users can ask:
What is this project about?
Explain the project architecture.
How does the loadRules function work?
How does contextMessages work?
Which file handles authentication?
What are the installation instructions?
Which technologies are used in this repository?
Where is the database connection created?
| Choice | Why |
|---|---|
| RAG | Grounds LLM answers in the actual repository |
| Tree-sitter / AST | Preserves meaningful code structures during chunking |
| MiniLM embeddings | Lightweight local semantic representation |
| FAISS | Fast, local vector similarity search |
| Groq | Fast LLM inference |
| PostgreSQL | Reliable persistent relational storage |
| Supabase Auth | Managed authentication and stable user identities |
| Streamlit | Simple Python-based application and deployment |
ChromaDB was initially explored for vector storage, but the Windows environment encountered a cygrpc DLL loading issue caused by an Application Control policy.
FAISS provided a simpler local vector-search implementation without the problematic gRPC dependency, so the project was moved to FAISS.
- Authentication is handled by Supabase Auth.
- Conversation queries use the authenticated user's ID.
- API keys and database credentials are stored outside source code.
.envand Streamlit secrets are excluded from Git.- Generated repository/vector files are excluded from Git.
- Database operations verify conversation ownership where required.
The application currently analyzes public GitHub repositories. Private repository access through GitHub OAuth/token integration is not yet implemented.
- Public GitHub repositories are currently supported.
- Repository cloning uses
depth=1for faster ingestion and deployment reliability. - Full Git history is therefore not currently available.
- Very large repositories may require additional processing time.
- The repository and FAISS workspace currently use local application paths.
- Concurrent multi-user repository analysis would benefit from per-user workspace isolation.
- GitHub OAuth and private repository support
- Full Git history analysis
- Per-user repository and FAISS workspace isolation
- Hybrid keyword + vector retrieval with reranking
- Repository dependency visualization
- More programming language support
- Streaming LLM responses
- Background repository indexing
- Persistent vector indexes
- Improved code/source highlighting
This project demonstrates practical implementation of:
Generative AI โข RAG โข LLMs โข Semantic Search โข Embeddings โข Vector Search โข AST Parsing โข Code Intelligence โข GitHub Analysis โข PostgreSQL โข Authentication โข Multi-user Data Isolation โข Streamlit Deployment
Prachi Sharma
GitHub:
https://github.com/prachishr/codebase-qa-assistant
If you found this project useful, consider giving the repository a โญ on GitHub.