How anjali-2310176/ai-codebase-explainer works
AI Codebase Explainer lets a user submit a public Python repository, follow its analysis job, then search indexed code and view retrieved sources. Ingestion clones the repository, parses Python entities and relations, and stores searchable chunks and graph data; the app also exposes repository summaries and diagrams. Retrieval and answer generation are documented as offline-capable, with Gemini optional. The graph follows sampled route, pipeline, parser, embedding, and application code; links for unsampled agent and presentation features follow README documentation.
Main entry points: routes.py REST routes · pipeline.py Ingestion pipeline · session.py Database sessions · App.tsx React application
Components 20
User interface
- React application
frontend/src/App.tsx - API client
frontend/src/api.ts
API and jobs
- REST routes
backend/app/api/routes.py - Job queue
backend/app/services/jobs/queue.py
Repository analysis
- Ingestion pipeline
backend/app/services/pipeline.py - Repository clone
backend/app/services/clone.py - Python parser
backend/app/services/parser/python_parser.py - Safe file reading
backend/app/security/file_safety.py - Code entities
backend/app/services/entities.py - Code graph
backend/app/services/graph.py - Chunk indexing
backend/app/services/embeddings.py
Search and explain
- Retrieval answers
backend/app/services/agent.py - LLM provider
backend/app/services/llm_provider.py - README and diagrams
backend/app/api/routes.py
Persistent state
- Repository records
backend/app/db/models.py - Database sessions
backend/app/db/session.py - SQLite database
Other components
- Repository explorer
- GitHub repository
- Gemini API
Connections 27
- Repository explorer → React application: submits and views
- React application → API client: invokes
- API client → REST routes: HTTP requests
- REST routes → Job queue: enqueues jobs
- REST routes → Ingestion pipeline: starts ingestion
- Job queue → Ingestion pipeline: runs job
- Ingestion pipeline → Repository clone: clones and scans
- Repository clone → GitHub repository: fetches repository
- Ingestion pipeline → Python parser: parses files
- Python parser → Safe file reading: reads safely
- Python parser → Code entities: creates entities
- Ingestion pipeline → Code graph: upserts relations
- Ingestion pipeline → Chunk indexing: stores chunks
- Ingestion pipeline → Database sessions: updates job and repository
- Code graph → Database sessions: persists graph
- Chunk indexing → Database sessions: reads and writes chunks
- Database sessions → Repository records: uses models
- Database sessions → SQLite database: queries
- REST routes → Database sessions: reads job and repository
- React application → Retrieval answers: asks code question
- Retrieval answers → Chunk indexing: retrieves chunks
- Retrieval answers → LLM provider: formats answer
- LLM provider → Gemini API: generates optionally
- REST routes → README and diagrams: generates README and diagrams
- React application → README and diagrams: requests summaries and diagrams
- REST routes → Code graph: serves graph view
- React application → REST routes: polls job and repository