[!WARNING] Here be dragons! As we plan to ship a torrent of features in the following months, future updates will contain breaking changes. With SGNetworks evolving, we'll annotate changes and highlight migration paths as we encounter them.
The major refactoring version of Litho 1.0 is currently underway. It will be the most accurate, high-performance, and efficient Davin DeepWiki-like solution among open-source options. The new version introduces an excellent engineering architecture design, along with proper support for different technology stacks, languages, and frameworks. It offers better accuracy and performance. We still need some timeโplease support us, and stay tuned.
๐ Help me develop this software better by sponsoring on GitHub
๐ What's Litho
Litho (also known as deepwiki-rs) is a powerful Rust-based tool designed to automate the generation of software architecture documentation. Leveraging advanced AI capabilities, Litho intelligently analyzes project structures, identifies core components, parses dependency relationships, and generates professional documentation automatically.
Litho is completely free and open-source, making it an ideal solution for teams looking to maintain up-to-date architecture documentation without the manual effort. By using large language models (LLMs), Litho provides insightful analysis and clear documentation that helps developers understand complex codebases more easily.
โค๏ธ Like Litho? Star it ๐ or Sponsor Me! โค๏ธ
Thanks to the kind people
๐ Key Features
- Automated Documentation Generation: Automatically generates comprehensive documentation by analyzing project code, reducing manual documentation efforts.
- AI-Powered Analysis: Utilizes large language models (LLMs) with ReAct pattern for intelligent analysis, accurately identifying core components and architectural patterns in projects.
- C4 Architecture Documentation: Generates professional C4 architecture-style documentation including Overview, Architecture, and detailed CoreComponents documentation.
- Multi-Format Output: Supports generating documentation in multiple formats including Markdown and HTML to meet different needs and scenarios.
- Extensibility: Modular design with a plugin system supports extension and customization for different project types and requirements.
- Multi-Language Support: Capable of analyzing projects written in various programming languages including Rust, Python, JavaScript/TypeScript, Java, C/C++, and Go.
- Dependency Visualization: Extracts and visualizes file and function dependency relationships to help understand codebase structure.
- Component Identification: Automatically identifies and analyzes core components within a project, calculating importance scores based on various metrics.
- Architecture Detection: Recognizes common architectural patterns such as MVC, layered architecture, and microservices.
๐ง How it works
Litho follows a systematic approach to generate architecture documentation:
- Project Analysis: First, Litho scans the project structure, identifies files and directories, and performs initial analysis.
- Metadata Extraction: The tool extracts detailed metadata including component information, dependency relationships, and structural details.
- AI-Enhanced Analysis: Using large language models, Litho performs in-depth analysis of code components, their functionality, and relationships.
- Documentation Generation: Finally, Litho generates comprehensive architecture documentation in the requested format(s), including diagrams and detailed descriptions.
graph TD
subgraph Litho
A[Project Analysis] --> B[Metadata Extraction]
B --> C[AI-Enhanced Analysis]
C --> D[Documentation Generation]
end
๐๏ธ Architecture Overview
Litho is built with a modular architecture designed for extensibility and performance. The system consists of several key components working together:
flowchart TB
%% ๅฎไนไธป่ฆๆจกๅ
Main_Entry_Point((Main Entry Point))
Metadata_Extractor(Metadata Extractor)
LLM_Manager(LLM Manager)
Document_Generator(Document Generator)
React_Agent(React Agent)
%% ๅญๆจกๅ
Project_Structure(Project Structure)
Dependencies(Dependencies)
Core_Components(Core Components)
LLM_Service(LLM Service)
Markdown_Generator(Markdown Generator)
HTML_Generator(HTML Generator)
ReAct_Pattern(ReAct Pattern)
%% ๅค้จ็ณป็ป
External_LLM_API(External LLM API)
Markdown_Files(Markdown Files)
HTML_Files(HTML Files)
%% ่ฟๆฅๅ
ณ็ณป
Main_Entry_Point --> Metadata_Extractor
Main_Entry_Point --> LLM_Manager
Main_Entry_Point --> Document_Generator
Main_Entry_Point --> React_Agent
Metadata_Extractor --> Project_Structure
Metadata_Extractor --> Dependencies
Metadata_Extractor --> Core_Components
LLM_Manager --> LLM_Service
LLM_Service --> External_LLM_API
Document_Generator --> Markdown_Generator
Document_Generator --> HTML_Generator
Markdown_Generator --> Markdown_Files
HTML_Generator --> HTML_Files
React_Agent --> ReAct_Pattern
%% ๅค้จ็ณป็ป่ฏดๆ
classDef external fill:#666,stroke:#444,stroke-width:1px,color:#fff
class External_LLM_API,Markdown_Files,HTML_Files external
Core Components
- LLM Client: Handles communication with large language models for intelligent analysis.
- Metadata Extractor: Extracts project structure, dependencies, and component information.
- Document Generator: Transforms analyzed data into professional documentation in various formats.
- ReAct Agent: Implements the ReAct pattern for systematic exploration and analysis of codebases.
- Tools: Provides various utility tools for code analysis, architecture detection, and file exploration.
- Utils: Offers common utilities for file system operations, string processing, and more.
sequenceDiagram
participant MetadataExtractor
participant Structure
participant Dependencies
participant Components
participant LLMService
MetadataExtractor->>Structure: extract_structure()
Structure-->>MetadataExtractor: ProjectStructure
MetadataExtractor->>Dependencies: extract_dependencies()
Dependencies-->>MetadataExtractor: ProjectDependencies
MetadataExtractor->>Components: identify_core_components_with_llm()
Components->>LLMService: (Components-->>MetadataExtractor)
LLMService-->>Components: (Document Snippets)
Components-->>MetadataExtractor: CoreComponent list
MetadataExtractor->>MetadataExtractor: create ProjectMetadata
๐ฅ Getting Started
Prerequisites
Installation
- Clone the repository.
- Step into the cloned project folder.
- Build the project.
- The compiled binary will be available in the
target/release
directory.
๐ Usage
Litho provides a command-line interface for generating architecture documentation. Here are some basic usage examples:
Basic Command
# Generate C4 architecture documentation (default mode)
# Analyze specific project directory
# Specify output directory
# Specify project name
Documentation Modes
Litho supports two documentation generation modes:
C4 Architecture Mode (Default)
Generates professional C4 architecture-style documentation:
Overview.md
: Project overview, core functionality, and technology stackArchitecture.md
: Overall architecture, core processes, and module breakdownCoreComponents/
: Detailed documentation for each core component
# Use C4 architecture mode (default)
# Generate C4 documentation with custom output
Standard Mode
Generates traditional documentation format:
# Use standard documentation mode
Advanced Options
-
Specify documentation format (Markdown or HTML):
-
Enable verbose logging:
-
Configure LLM settings:
-
Customize component detection:
For more detailed usage information, run:
๐ Output Structure
C4 Architecture Mode (Default)
Litho generates a C4 architecture-style documentation structure:
project-docs/
โโโ Overview.md # Project overview, core functionality, technology stack
โโโ Architecture.md # Overall architecture, core processes, module breakdown
โโโ CoreComponents/ # Detailed component documentation
โ โโโ component1.md # Component functionality, workflow, internal architecture
โ โโโ component2.md
โ โโโ ...
โโโ litho_work_summary.md # Execution summary and process information
Document Contents
- Overview.md: Contains project overview, core functionality & purpose, and technology selection rationale
- Architecture.md: Contains overall architecture design, core processes & workflows, and detailed core module explanations
- CoreComponents/*.md: Each core module's detailed documentation including:
- Module functionality and purpose
- Workflow and processing steps
- Internal architecture and structure
Standard Mode
Traditional documentation structure:
project-docs/
โโโ README.md # Main project overview
โโโ architecture.md # Architecture documentation
โโโ components/ # Component documentation
โ โโโ component1.md
โ โโโ component2.md
โโโ api/ # API documentation
โ โโโ endpoints.md
โ โโโ schemas.md
โโโ assets/ # Generated diagrams and images
โโโ architecture.svg
โโโ dependencies.png
๐ค Contribute
Help improve Litho by reporting bugs or submitting feature requests through GitHub Issues.
Ways to Contribute
- Implement support for additional programming languages
- Enhance the component detection algorithms
- Add new documentation formats
- Improve the visualization of architecture diagrams
- Contribute to the internationalization of the project
โ๏ธ Developed with
๐ชช License
MIT. A copy of the license is provided in the LICENSE file.
๐จ About Me
๐ Help me develop this software better by sponsoring on GitHub
An experienced internet veteran, having navigated through the waves of PC internet, mobile internet, and AI applications. Starting from an individual mobile application developer to a professional in the corporate world, I possess rich experience in product design and research and development. Currently, I am employed at Kuaishou, focusing on the R&D of universal front-end systems and AI exploration.
WeChat: dokhell
Email: dokhell@hotmail.com