How adithya-s-k/gitvizz works
Purpose and Entry Points
GitVizz is a repository-understanding platform: it ingests GitHub/source repositories, derives AST-based dependency graphs, presents interactive code exploration, and adds LLM chat/documentation. Runtime entry points are the FastAPI app at backend/server.py, optional Modal deployment entry at backend/modal_server.py, and Next.js App Router at frontend/app/layout.tsx and frontend/app/page.tsx. Docker orchestration is defined in docker-compose.yaml.
Frontend Application
The Next.js/TypeScript client drives repository submission, results navigation, graph exploration, code viewing, chat, API-key management, and authentication. Repository/result pages are parameterized by owner, repo, branch, or uploaded archive:
• frontend/app/[owner]/[repo]/page.tsx
• frontend/app/results/[owner]/[repo]/[branch]/page.tsx
• frontend/app/results/zip/[zipname]/page.tsx
It calls the backend through a generated API layer in frontend/api-client/sdk.gen.ts; authenticated request handling and result state are centralized in frontend/hooks/useApiWithAuth.ts and frontend/context/ResultDataContext.tsx.
Graph Analysis Core
The standalone, Apache-licensed gitvizz Python package is the structural-analysis boundary. It accepts repository file data, parses supported languages with Tree-sitter-oriented AST logic, and emits dependency/relationship graph data. Its primary engine and query capabilities are:
• gitvizz/gitvizz/graph_generator.py
• gitvizz/gitvizz/custom_ast_parser.py
• gitvizz/gitvizz/graph_search_tool.py
The backend adapts this output for API/UI consumption through backend/utils/gitvizz_tools.py and backend/utils/graph_utils.py. This separation allows core graph generation to be used independently of the web product.
Backend API and Repository Lifecycle
FastAPI routes delegate to controllers for repository ingestion/indexing, graphs, chat, identity, credentials, and GitHub access. Core HTTP boundaries include:
• backend/server.py
• backend/routes/repo_routes.py
• backend/routes/indexed_repos_routes.py
Repository operations are handled in backend/controllers/repo_controller.py and indexed-repository operations in backend/controllers/indexed_repos_controller.py. GitHub-specific acquisition/authentication is isolated in backend/controllers/github_controller.py, supporting public/private access via personal tokens, OAuth, or GitHub App credentials.
AI Documentation and Chat
Documentation generation is a distinct pipeline that analyzes repository content, structures prompts/data, selects an AI client, and can embed material for retrieval-like use:
• backend/documentation_generator/core.py
• backend/documentation_generator/analyzers.py
• backend/documentation_generator/ai_client.py
Chat endpoints/controller feed repository and graph context into LLM services, including LangChain- and LangGraph-based implementations:
• backend/controllers/chat_controller.py
• backend/utils/langchain_llm_service.py
• backend/utils/langgraph_chat_service.py
Configured providers include OpenAI, Anthropic, Gemini, and Groq; users can manage provider keys through backend/controllers/api_key_controller.py.
Visualization and User Interaction
Graph data is rendered client-side using alternate graph visualization components, with search and hierarchy filtering layered over the same repository result model:
• frontend/components/ReagraphVisualization.tsx
• frontend/components/SigmaGraphVisualization.tsx
• frontend/hooks/useGraphSearch.ts
Code and AI outputs are integrated into the exploration UI through frontend/components/CodeViewer.tsx, frontend/components/floating-chat-button.tsx, and frontend/components/documentation.tsx.
Persistence, Security, and Operations
MongoDB persists users, repositories, chats, and task-like records via backend/utils/db.py and models such as backend/models/repository.py. JWT auth and request protection are implemented at backend/utils/jwt_utils.py and backend/middleware/auth_middleware.py; sensitive user API keys are a separate concern. File storage is locally configurable. Deployment supports Docker and a Modal workflow (.github/workflows/modal_backend_deploy.yaml). Phoenix is an optional external LLM tracing/observability service, integrated through backend/utils/observability.py.
Main entry points: server.py FastAPI server · repo_controller.py Repository lifecycle · graph_generator.py GitVizz graph engine · chat_controller.py Chat controller
Components 21
Frontend
- Next.js application · Repository submission and exploration UI.
frontend/app/page.tsx - Repository result pages · Supports GitHub repositories and uploaded archives.
frontend/app/results/[owner]/[repo]/[branch]/page.tsx - Generated API client
frontend/api-client/sdk.gen.ts - Result data state
frontend/context/ResultDataContext.tsx - Graph exploration · Alternate renderers share graph search and result data.
frontend/components/ReagraphVisualization.tsx
Backend API
- FastAPI server
backend/server.py - Repository routes
backend/routes/repo_routes.py - Repository lifecycle · Ingests and indexes submitted repositories.
backend/controllers/repo_controller.py - GitHub acquisition · Handles public/private repository access and GitHub credentials.
backend/controllers/github_controller.py - Indexed repository API
backend/routes/indexed_repos_routes.py - Graph API adapter · Converts core graph output for API and UI use.
backend/utils/gitvizz_tools.py
Graph Analysis
- GitVizz graph engine · Independent structural-analysis boundary.
gitvizz/gitvizz/graph_generator.py - AST parser · Parses supported repository languages.
gitvizz/gitvizz/custom_ast_parser.py - Graph search
gitvizz/gitvizz/graph_search_tool.py
AI Services
- Chat controller · Supplies repository and graph context to chat.
backend/controllers/chat_controller.py - LLM chat service · Connects chat to configured LLM providers.
backend/utils/langchain_llm_service.py - Documentation pipeline · Analyzes repository content and generates structured documentation.
backend/documentation_generator/core.py - Provider key management
backend/controllers/api_key_controller.py
Data & Operations
- MongoDB persistence · Persists users, repositories, chats, and task records.
backend/utils/db.py - JWT authentication · Protects authenticated backend requests.
backend/middleware/auth_middleware.py - Docker orchestration
docker-compose.yaml
Connections 23
- Next.js application → Repository result pages: navigates to
- Repository result pages → Result data state: uses
- Result data state → Graph exploration: supplies graph data
- Next.js application → Generated API client: calls through
- Generated API client → FastAPI server: HTTP API
- FastAPI server → JWT authentication: protects requests with
- FastAPI server → Repository routes: mounts
- FastAPI server → Indexed repository API: mounts
- FastAPI server → Chat controller: routes chat to
- Repository routes → Repository lifecycle: delegates
- Repository lifecycle → GitHub acquisition: acquires repositories via
- Repository lifecycle → GitVizz graph engine: analyzes files with
- Indexed repository API → Graph API adapter: serves graphs through
- Graph API adapter → GitVizz graph engine: adapts output from
- GitVizz graph engine → AST parser: parses with
- GitVizz graph engine → Graph search: exposes queries to
- Repository lifecycle → MongoDB persistence: persists indexed repositories
- Chat controller → LLM chat service: delegates to
- Chat controller → Graph API adapter: uses graph context
- Documentation pipeline → LLM chat service: uses AI clients
- Provider key management → MongoDB persistence: stores user key records
- Docker orchestration → FastAPI server: orchestrates
- Docker orchestration → Next.js application: orchestrates