An intelligent tool that automatically generates comprehensive documentation for GitHub repositories using AI. This application analyzes your codebase, understands its architecture, and generates both README files and developer guides with detailed technical insights.
- Automatic Repository Analysis: Clones and deeply analyzes GitHub repositories
- AI-Powered Documentation Generation: Uses OpenRouter API to generate intelligent, context-aware documentation
- Dual Document Generation: Creates both README and Developer Guide documents
- PDF Export: Download generated documentation as PDF files
- Job Queue System: Efficient background processing with BullMQ and Redis
- Real-time Progress Tracking: Monitor documentation generation progress in real-time
- Dark/Light Mode UI: Modern, responsive frontend with theme support
- Tech Stack Detection: Automatically identifies frameworks, languages, and technologies used
- Framework: Express.js
- Runtime: Node.js
- Database: MySQL
- Queue System: BullMQ with Redis
- API Integration: OpenRouter (AI API)
- Repository Handling: simple-git
- PDF Generation: PDFKit
- Framework: React 19
- Build Tool: Vite
- Styling: Tailwind CSS
- Markdown Rendering: react-markdown with GFM support
- Icons: Lucide React
project/
βββ backend/
β βββ src/
β β βββ app.js # Express app configuration
β β βββ server.js # Server entry point
β β βββ config/
β β β βββ db.js # MySQL pool configuration
β β β βββ redis.js # Redis connection
β β β βββ env.js # Environment configuration
β β βββ constants/
β β β βββ jobStatus.js # Job status constants
β β βββ controllers/
β β β βββ job.controller.js # Job API endpoints
β β βββ routes/
β β β βββ job.routes.js # Job routes
β β βββ services/
β β β βββ job.service.js # Job business logic
β β βββ queues/
β β β βββ doc.queue.js # BullMQ queue setup
β β βββ workers/
β β β βββ doc.worker.js # Background job processor
β β βββ utils/
β β βββ fileUtils.js # File system utilities
β β βββ openRouterAPI.js # AI documentation generation
β β βββ pdfGenerator.js # PDF export functionality
β β βββ repoAnalysis.js # Repository analysis logic
β β βββ splitDocuments.js # Document splitting utilities
β βββ package.json
β
βββ frontend/
βββ src/
β βββ App.jsx # Main application component
β βββ api/
β β βββ jobApi.js # Job API client
β βββ components/
β β βββ MarkdownRenderer.jsx # Markdown rendering component
β βββ utils/
β β βββ downloadMarkdown.js # File download utilities
β βββ App.css # Global styles
β βββ index.css # Reset styles
β βββ main.jsx # React entry point
βββ public/ # Static assets
βββ index.html # HTML entry point
βββ vite.config.js # Vite configuration
βββ tailwind.config.js # Tailwind CSS configuration
βββ postcss.config.js # PostCSS configuration
βββ package.json
- Node.js (v18 or higher)
- MySQL (v8 or higher) - for job and document storage
- Redis (v6 or higher) - for queue management
- Git - for repository cloning
- OpenRouter API Key - for AI documentation generation
git clone <your-repo-url>
cd projectNavigate to the backend directory:
cd backendInstall dependencies:
npm installCreate a .env file in the backend directory with the following variables:
# MySQL Configuration
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=doc_generator
# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379
# OpenRouter API
OPENROUTER_API_KEY=your_openrouter_api_key
# Server Port
PORT=5000Navigate to the frontend directory:
cd ../frontendInstall dependencies:
npm installCreate a .env.local file (optional, for custom API endpoint):
VITE_API_URL=http://localhost:5000Create the MySQL database and tables:
CREATE DATABASE IF NOT EXISTS doc_generator;
USE doc_generator;
CREATE TABLE IF NOT EXISTS jobs (
id VARCHAR(36) PRIMARY KEY,
repo_url VARCHAR(255) NOT NULL,
status VARCHAR(20) DEFAULT 'pending',
progress INT DEFAULT 0,
documents JSON,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);Terminal 1 - Backend Server:
cd backend
npm run devThe backend server will run on http://localhost:5000
Terminal 2 - Background Worker:
cd backend
npm run workerTerminal 3 - Frontend:
cd frontend
npm run devThe frontend will run on http://localhost:5173
Backend:
cd backend
npm startFrontend:
cd frontend
npm run build
npm run previewEndpoint: POST /api/jobs
Request Body:
{
"repoUrl": "https://github.com/username/repository"
}Response:
{
"jobId": "uuid-string",
"status": "pending"
}Endpoint: GET /api/jobs/:jobId
Response:
{
"id": "uuid-string",
"status": "completed",
"progress": 100,
"documents": {
"readme": "# Project README...",
"developerGuide": "# Developer Guide..."
}
}Endpoint: GET /api/jobs/:jobId/developer-guide.pdf
Response: Binary PDF file
- Job Creation: User submits a GitHub repository URL
- Queue Processing: Job is added to BullMQ queue with Redis backend
- Repository Cloning: Background worker clones the repository
- Analysis Phase:
- Detects repository type and tech stack
- Identifies entry points and routing
- Analyzes database schemas
- Extracts environment variables
- Generates folder structure tree
- AI Documentation: OpenRouter API generates comprehensive documentation
- Document Storage: Generated documents are stored in MySQL
- Frontend Display: User views and can download the generated documentation
npm start- Start production servernpm run dev- Start development server with auto-reloadnpm run worker- Start background job worker
npm run dev- Start development servernpm run build- Build for productionnpm run lint- Run ESLintnpm run preview- Preview production build
- Secure your
.envfile - never commit credentials to version control - Use strong MySQL passwords
- Keep your OpenRouter API key confidential
- Validate all incoming repository URLs
- Implement rate limiting for API endpoints in production
- Use HTTPS in production environment
- Ensure MySQL is running
- Verify credentials in
.envfile - Check database exists and tables are created
- Ensure Redis is running on the specified host/port
- Check Redis configuration in
config/redis.js
- Verify API key is valid and has available credits
- Check API rate limits haven't been exceeded
- Ensure repository is accessible and public
- Check CORS settings in
backend/src/app.js - Verify backend is running on correct port
- Check frontend environment variables
DB_HOST- MySQL host (default: localhost)DB_USER- MySQL usernameDB_PASSWORD- MySQL passwordDB_NAME- Database nameREDIS_HOST- Redis host (default: localhost)REDIS_PORT- Redis port (default: 6379)OPENROUTER_API_KEY- Your OpenRouter API keyPORT- Server port (default: 5000)
The system performs deep analysis including:
- Technology stack detection (frameworks, libraries, languages)
- Entry point identification
- API route discovery
- Database schema analysis
- Authentication mechanism detection
- Environment variable extraction
- Project folder structure mapping
Generated documentation includes:
- README: Quick start guide, features, installation, usage
- Developer Guide: Architecture overview, code structure, module descriptions, API documentation
Users can monitor job progress with percentage completion and current processing step:
- Initializing job
- Cloning repository
- Analyzing codebase
- Understanding architecture
- Generating documentation
- Finalizing output
ISC
Contributions are welcome! Please feel free to submit a Pull Request.
For issues and questions, please open an issue on GitHub.
Built with β€οΈ for developers who love documentation