A tool that visualizes GitHub repository file structures in clean ASCII tree format and generates architecture diagrams.
- Overview
- Features
- Architecture
- Installation
- Usage
- Development Setup
- API Documentation
- Browser Extension
- Future Enhancements
The GitHub Repository Tree Viewer allows developers to quickly visualize repository structures without downloading or cloning them. It provides a clean, ASCII-formatted tree output and AI-generated architecture diagrams to help understand project organization at a glance.
Value for:
- Developers: Quickly understand repository structure without downloading or cloning
- Code Reviewers: Easily assess code organization during pull request reviews
- New Contributors: Get a high-level overview of project organization
- Clean ASCII Tree Visualization: Convert repository structure into formatted tree output
- Real-time Streaming: Display tree results as they're generated
- Copy-to-Clipboard: Quick sharing of repository structure
- Dark/Light Mode Toggle: Customizable interface for user preference
- Architectural Diagrams: AI-generated Mermaid diagrams via Claude API
- Browser Extension: Direct integration with GitHub's interface
- Responsive Design: Works on desktop and mobile devices
The application consists of several components working together:
-
Go Backend Server:
- Interfaces with GitHub API to fetch repository file structures
- Converts repository data into formatted ASCII tree output
- Integrates with Claude API to generate Mermaid diagrams
- Handles API rate limiting and error cases
-
Web Client:
- Responsive single-page application
- Dark/light mode toggle for user preference
- Copy-to-clipboard functionality
- Live streaming of tree generation results
- Interactive Mermaid.js diagram visualization with zoom and pan
-
Browser Extension:
- Adds "π² Tree View" button to GitHub repository pages
- Seamlessly integrates with the GitHub UI
- Provides quick access to tree visualization of current repository
-
Docker Deployment:
- Containerized setup for easy deployment
- Separate containers for backend and frontend
- Docker Compose configuration for orchestration
- Backend: Go (with GitHub API integration)
- Frontend: HTML, CSS, JavaScript (with Mermaid.js for diagrams)
- Extension: JavaScript (Browser Extension API)
- Deployment: Docker, Docker Compose
- Go (for native development)
- Docker and Docker Compose (for containerized deployment)
- GitHub personal access token (for API authentication)
-
Clone the repository:
git clone https://github.com/yourusername/repo-tree.git cd repo-tree -
Create a
.envfile in the server directory with your GitHub and Claude API tokens:GITHUB_TOKEN=your_github_token CLAUDE_API_KEY=your_claude_api_key -
Start the containers:
docker-compose up -d
-
Access the web application at
http://localhost:8081
-
Navigate to the server directory:
cd server -
Install dependencies:
go mod download
-
Create a
.envfile with your GitHub and Claude API tokens:GITHUB_TOKEN=your_github_token CLAUDE_API_KEY=your_claude_api_key -
Run the server:
go run main.go
-
Navigate to the client directory:
cd client -
Serve the files using any static file server:
# Example with Python python -m http.server 8081
- Open the web application at
http://localhost:8081 - Enter a GitHub repository URL (e.g.,
https://github.com/username/repository) - Click "Generate" to view the tree structure
- The tree will be displayed in real-time as it's generated
- Use the copy button to copy the tree to your clipboard
- Toggle between dark and light mode using the switch in the header
- View the AI-generated architecture diagram below the tree
- Use zoom controls to zoom in/out of the diagram
- Install the extension from the browser extension store or load it unpacked
- Navigate to any GitHub repository
- Click the "π² Tree View" button that appears on the repository page
- The web application will open in a new tab with the repository structure
repo-tree/
βββ client/ # Web client
β βββ Dockerfile
β βββ index.html # Main HTML page
β βββ index.js # Client-side JavaScript
β βββ styles.css # CSS styles
βββ server/ # Go backend
β βββ Dockerfile
β βββ go.mod # Go module definition
β βββ go.sum # Go dependencies
β βββ main.go # Server implementation
βββ web_extension/ # Browser extension
β βββ content.js # Extension JavaScript
β βββ manifest.json # Extension manifest
βββ docker-compose.yml # Docker Compose configuration
βββ README.md # Project documentation
The backend is implemented in Go and provides two main endpoints:
/tree- Fetches the repository structure and returns an ASCII tree/ai- Generates a Mermaid diagram of the repository architecture
To run the backend in development mode:
cd server
go run main.goThe frontend is a simple HTML/CSS/JavaScript application that communicates with the backend API. To modify the frontend, edit the files in the client directory and refresh the browser.
The browser extension injects a button into GitHub repository pages that opens the web application with the current repository URL.
To load the extension in development mode:
Chrome:
- Open
chrome://extensions/ - Enable Developer mode
- Click "Load unpacked" and select the
web_extensiondirectory
Firefox:
- Open
about:debugging#/runtime/this-firefox - Click "Load Temporary Add-on..."
- Select the
manifest.jsonfile in theweb_extensiondirectory
GET /tree?repo={repository_url}
Parameters:
repo: The GitHub repository URL (e.g.,https://github.com/username/repository)
Response:
- Content-Type:
text/plain - Body: ASCII tree representation of the repository structure
GET /ai?repo={repository_url}
Parameters:
repo: The GitHub repository URL (e.g.,https://github.com/username/repository)
Response:
- Content-Type:
application/json - Body: JSON object with a
diagramfield containing Mermaid diagram code
The browser extension adds a "π² Tree View" button to GitHub repository pages that opens the web application with the current repository URL.
- Download the extension files
- Load the extension in your browser (see Development Setup section)
- Chrome: version 80 or later
- Firefox: version 75 or later
- Support for other Git platforms (GitLab, Bitbucket)
- Advanced filtering options for large repositories
- Repository comparison views
- Directory size visualization
- Integration with GitHub authentication for private repositories
Β© 2025 GitHub Tree Viewer | Created by Huy Ong

