AI-powered GitHub repository analyzer and technical documentation generator.
DocGen-AI analyzes a GitHub repository, reverse-engineers its structure, and generates detailed technical documentation using static analysis, structured repository knowledge, and LLM-based reasoning.
Instead of simply sending raw repository files to an LLM, DocGen-AI first analyzes the codebase to extract meaningful information about its structure, modules, dependencies, frameworks, classes, functions, and execution flow.
The extracted knowledge is then provided to an AI documentation agent that generates repository-specific technical documentation.
DocGen-AI accepts a GitHub repository URL and analyzes the codebase automatically.
The architecture documentation includes an automatically generated Mermaid diagram representing the major components and relationships identified in the repository.
Understanding an unfamiliar codebase can be time-consuming, especially when documentation is incomplete, outdated, or missing entirely.
DocGen-AI automates this process by analyzing the repository before using an LLM to generate technical documentation.
The system performs repository-level analysis to extract information such as:
- Source files and modules
- Imports
- Classes
- Functions
- API endpoints
- Dependencies
- Frameworks
- Entry points
- Configuration files
- Package managers
- Repository structure
- Repository statistics
This information is converted into a structured repository knowledge representation and provided to the documentation agent.
The agent then generates four documentation artifacts:
README.mdARCHITECTURE.mdSUMMARY.mdINSTALLATION.md
- π Analyze public GitHub repositories
- π³ Repository structure discovery
- π§© AST-based source-code parsing
- π¦ Dependency detection
- π Framework detection
- πͺ Entry-point discovery
- βοΈ Configuration-file discovery
- π Package-manager detection
- π§ Structured repository knowledge extraction
- π€ LLM-powered documentation generation
- π README generation
- ποΈ Architecture documentation
- π Mermaid architecture diagrams
- π Project summaries
- βοΈ Installation documentation
- π¬ AI-powered repository chat
- π Repository statistics
- π Markdown document viewer
- π₯ Copy generated Markdown
- π Open analyzed repository on GitHub
- π¦ Download generated documentation as ZIP
DocGen-AI uses a staged repository-analysis pipeline.
GitHub Repository β βΌ ββββββββββββββββββββ β Clone Repository β ββββββββββ¬ββββββββββ βΌ ββββββββββββββββββββ β Repository Scan β ββββββββββ¬ββββββββββ βΌ ββββββββββββββββββββ β AST Parsing β ββββββββββ¬ββββββββββ βΌ ββββββββββββββββββββββββββββ β Repository Discovery β β β β Dependencies β β Frameworks β β Entry Points β β Configuration β β Package Manager β ββββββββββ¬ββββββββββββββββββ βΌ ββββββββββββββββββββββββββββ β Knowledge Builder β β β β Modules β β Classes β β Functions β β Imports β β Endpoints β β Repository Tree β β Statistics β ββββββββββ¬ββββββββββββββββββ βΌ ββββββββββββββββββββββββββββ β Documentation Agent β β β β Structured Context + LLM β ββββββββββ¬ββββββββββββββββββ βΌ ββββββββββββββββββββββββββββ β Generated Documentation β β β β README β β Architecture β β Summary β β Installation β ββββββββββββββββββββββββββββ
DocGen-AI is organized around a backend pipeline responsible for repository analysis and an interactive frontend responsible for presenting the generated documentation.
RepositoryPipeline
β
ββββββββββββββββββββΌβββββββββββββββββββ
β β β
βΌ βΌ βΌ
CloneStage ScanStage ParseStage β βΌ IndexStage β βΌ DocumentationStage β βΌ DocumentationAgent β βΌ LLM β βΌ Generated Documents
DocGen-AI automatically generates a Mermaid architecture diagram as part of the architecture documentation.
The diagram is generated from the repository information available during analysis rather than being manually defined for a specific project.
Example:
flowchart TD USER["User"] UI["Web Interface"] API["FastAPI API"] PIPELINE["Repository Pipeline"] PARSER["Source Parser"] DISCOVERY["Repository Discovery"] KNOWLEDGE["Knowledge Builder"] AGENT["Documentation Agent"] LLM["LLM"] OUTPUT["Generated Documentation"]
USER --> UI
UI --> API
API --> PIPELINE
PIPELINE --> PARSER
PIPELINE --> DISCOVERY
PARSER --> KNOWLEDGE
DISCOVERY --> KNOWLEDGE
KNOWLEDGE --> AGENT
AGENT --> LLM
LLM --> OUTPUT
For every analyzed repository, DocGen-AI generates four documentation artifacts.
Provides a developer-friendly overview of the repository including:
- Project purpose
- Key features
- Architecture
- Project structure
- Technology stack
- Important modules
- Installation
- Configuration
- Usage
- Execution workflow
Provides a deeper technical analysis including:
- Architecture overview
- High-level design
- Project structure
- Execution flow
- Data flow
- Module relationships
- AI/ML components
- Storage and data layer
- External services
- Technologies used
- Mermaid architecture diagram
Provides a concise technical overview containing:
- Project purpose
- Main functionality
- Core components
- Technologies
- Important modules
- High-level workflow
- Inputs and outputs
Provides practical repository-specific setup instructions based on the information discovered during repository analysis.
This can include:
- Prerequisites
- Dependencies
- Installation commands
- Environment variables
- Configuration
- Running the application
- Development setup
- Python β Core backend and analysis logic
- FastAPI β REST API
- Pydantic β Data validation and structured models
- Tree-sitter β Source-code parsing
- uv β Python dependency and environment management
- pytest β Automated testing
- Groq API β LLM inference
- LLM-based agents β Documentation and repository question answering
- React β User interface
- TypeScript β Type-safe frontend development
- Vite β Frontend development and build tooling
- TanStack Router β Routing
- Tailwind CSS β Styling
- shadcn/ui β UI components
- React Markdown β Markdown rendering
- Mermaid β Architecture diagram rendering
docgen-ai/ β βββ backend/ β βββ app/ β β βββ agents/ β β β βββ base.py β β β βββ documentation.py β β β βββ chat.py β β β β β βββ analyzer/ β β βββ api/ β β βββ discovery/ β β βββ knowledge/ β β βββ mapper/ β β βββ parser/ β β βββ pipeline/ β β βββ prompts/ β β βββ services/ β β βββ utils/ β β β βββ tests/ β βββ frontend/ βββ repo-explainer-ai/ βββ src/ βββ components/ β βββ docgen/ β βββ ui/ β βββ hooks/ βββ lib/ βββ routes/
The repository pipeline coordinates the different stages involved in analyzing a GitHub repository.
The stages progressively transform a repository URL into structured repository knowledge and generated documentation.
The parser extracts source-code structures such as:
- Imports
- Classes
- Functions
- API endpoints
For Python repositories, the parser uses Tree-sitter and visitor-based components to extract these symbols.
The discovery system identifies repository-level information including:
- Dependencies
- Frameworks
- Entry points
- Configuration files
- Package managers
The Knowledge Builder combines parser and discovery results into a
RepositoryKnowledge model.
The resulting knowledge contains information about:
- Languages
- Frameworks
- Dependencies
- Entry points
- Configuration
- Repository tree
- Statistics
- Modules
- Classes
- Functions
- Imports
The Documentation Agent converts the structured repository knowledge into a prompt and sends it to the LLM.
The response is validated and converted into the four generated documentation artifacts.
Mermaid syntax is also sanitized before the architecture document is returned to the frontend.
The chat functionality allows users to ask questions about the analyzed repository using the repository context available to the backend.
Make sure the following tools are installed:
- Python 3.12
- Node.js
- Git
- uv
- npm
You will also need an API key for the configured LLM provider.
cd backend
uv sync

