Skip to content

Latest commit

Β 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DocGen-AI

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.

Preview

Repository Analysis

DocGen-AI accepts a GitHub repository URL and analyzes the codebase automatically.

DocGen-AI Repository Analysis

Generated Architecture

The architecture documentation includes an automatically generated Mermaid diagram representing the major components and relationships identified in the repository.

DocGen-AI Architecture

Overview

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.md
  • ARCHITECTURE.md
  • SUMMARY.md
  • INSTALLATION.md

Features

  • πŸ” 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

How It Works

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 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


6. Architecture

Architecture

DocGen-AI is organized around a backend pipeline responsible for repository analysis and an interactive frontend responsible for presenting the generated documentation.

Backend Pipeline

                RepositoryPipeline
                       β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚                  β”‚                  β”‚
    β–Ό                  β–Ό                  β–Ό

CloneStage ScanStage ParseStage β”‚ β–Ό IndexStage β”‚ β–Ό DocumentationStage β”‚ β–Ό DocumentationAgent β”‚ β–Ό LLM β”‚ β–Ό Generated Documents


7. Mermaid Architecture

Generated Architecture Diagram

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

8. Generated Documentation

Generated Documentation

For every analyzed repository, DocGen-AI generates four documentation artifacts.

README.md

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

ARCHITECTURE.md

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

SUMMARY.md

Provides a concise technical overview containing:

  • Project purpose
  • Main functionality
  • Core components
  • Technologies
  • Important modules
  • High-level workflow
  • Inputs and outputs

INSTALLATION.md

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

Tech Stack

Backend

  • 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

AI

  • Groq API β€” LLM inference
  • LLM-based agents β€” Documentation and repository question answering

Frontend

  • 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

Project Structure

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/


11. Important Backend Components

Important Components

Repository Pipeline

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.

Parser

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.

Discovery

The discovery system identifies repository-level information including:

  • Dependencies
  • Frameworks
  • Entry points
  • Configuration files
  • Package managers

Knowledge Builder

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

Documentation Agent

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.

Chat Agent

The chat functionality allows users to ask questions about the analyzed repository using the repository context available to the backend.

Getting Started

Prerequisites

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.

Backend Setup

cd backend

uv sync

About

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.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages