Skip to content

Latest commit

 

History

History
417 lines (325 loc) · 10.5 KB

File metadata and controls

417 lines (325 loc) · 10.5 KB

🚀 Documentation.AI

Automated Repository Documentation Generator powered by AI

Transform your GitHub repositories into professionally documented projects with the power of AI, advanced NLP, and RAG (Retrieval-Augmented Generation) pipelines.

Documentation.AI Banner

✨ Features

  • 🤖 AI-Powered Analysis - Advanced AI models analyze your repository structure, dependencies, and architecture
  • 📚 Comprehensive Documentation - Generate README files, API docs, setup guides, and more
  • Lightning Fast - Process repositories in seconds with optimized RAG pipeline
  • 🔒 Secure & Private - Your code is analyzed securely without permanent storage
  • 🧠 Smart Insights - Get architectural insights, complexity analysis, and improvement suggestions
  • 🌍 Multi-Language Support - Python, JavaScript, Java, Go, Rust, and many more
  • 🎨 Beautiful UI - Modern, responsive interface with smooth animations
  • 📊 Analytics Dashboard - Track your documentation generation history

🛠️ Technology Stack

Backend

  • Python Flask - Web framework for API endpoints
  • Google Gemini AI - Advanced language model for code analysis
  • RAG Pipeline - Retrieval-Augmented Generation with sentence transformers
  • FAISS - Vector similarity search for semantic analysis
  • SQLAlchemy - Database ORM for job tracking
  • GitPython - Git repository manipulation

Frontend

  • React 18 - Modern UI framework with hooks
  • TypeScript - Type-safe JavaScript development
  • TailwindCSS - Utility-first CSS framework
  • Framer Motion - Smooth animations and transitions
  • Lucide React - Beautiful icon set
  • Axios - HTTP client for API communication

AI & ML

  • Sentence Transformers - Text embeddings for semantic search
  • Transformers - Hugging Face model integration
  • NumPy & Pandas - Data processing and analysis
  • LangChain - LLM application framework

📋 Prerequisites

  • Python 3.8+ with pip
  • Node.js 14.x+ with npm/yarn
  • Git for repository cloning
  • API Keys (see Configuration section)

📁 Project Structure

Documentation.AI/
├── 📂 ai_models/          # AI and ML components
├── 📂 database/           # Database models and configuration
├── 📂 frontend/           # React frontend application
├── 📂 scripts/            # Setup and utility scripts
├── 📂 tests/              # Test suite and testing utilities
├── 📂 utils/              # Utility functions and helpers
├── 📄 app.py              # Main Flask application
├── 📄 start.sh            # Quick start script (Linux/macOS)
├── 📄 stop.sh             # Stop script (Linux/macOS)
├── 📄 requirements.txt    # Python dependencies
├── 📄 .env.example        # Environment configuration template
└── 📄 README.md           # Project documentation

🚀 Quick Start

Simple Setup & Start

Linux/macOS (Recommended)

# Clone the repository
git clone https://github.com/Drago-03/Documentation.AI.git
cd Documentation.AI

# Start the application (handles setup automatically)
./start.sh

Windows

# Clone the repository
git clone https://github.com/Drago-03/Documentation.AI.git
cd Documentation.AI

# Run setup script (one-time)
./scripts/setup.ps1

# Start the application
python app.py

To Stop

# Linux/macOS
./stop.sh

# Windows - Press Ctrl+C in the terminal

Manual Setup (Advanced Users)

1. Backend Setup

# Create and activate virtual environment
python3 -m venv .venv

# Linux/macOS
source .venv/bin/activate

# Windows
.venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

2. Frontend Setup

cd frontend
npm install
npm run build
cd ..

3. Configuration

# Copy environment template
cp .env.example .env

# Edit .env with your API keys (see Configuration section)

4. Start Servers

# Start backend
python app.py

# In another terminal, start frontend (optional - for development)
cd frontend
npm start

⚙️ Configuration

Create a .env file with the following configuration:

# AI Model API Keys
GEMINI_API_KEY=your_gemini_api_key_here
NVIDIA_API_KEY=your_nvidia_api_key_here
HUGGINGFACE_TOKEN=your_huggingface_token_here

# GitHub API (optional, for higher rate limits)
GITHUB_TOKEN=your_github_token_here

# Flask Configuration
FLASK_ENV=development
FLASK_DEBUG=True
SECRET_KEY=your_secret_key_here

# Database
DATABASE_URL=sqlite:///documentation_ai.db

# Server Configuration
HOST=0.0.0.0
PORT=5002

Getting API Keys

Google Gemini API Key

  1. Visit Google AI Studio
  2. Sign up or log in with your Google account
  3. Create a new API key
  4. Copy the key to your .env file

Hugging Face Token (Optional)

  1. Visit Hugging Face
  2. Sign up and go to Settings > Access Tokens
  3. Create a new token with read permissions
  4. Add to your .env file

GitHub Token (Optional)

  1. Go to GitHub Settings > Developer settings > Personal access tokens
  2. Generate new token with public_repo scope
  3. Add to your .env file for higher API rate limits

🎯 Usage

Starting the Application

Development Mode

# Terminal 1 - Backend
python app.py

# Terminal 2 - Frontend (for development)
cd frontend
npm start

Production Mode

# Build frontend
cd frontend
npm run build
cd ..

# Start backend (serves built frontend)
python app.py

Visit http://localhost:5002 to access the application.

Using the Web Interface

  1. Home Page - Overview and features
  2. Analyze Page - Enter GitHub repository URL
  3. Results Page - View generated documentation
  4. History Page - Track previous analyses

API Endpoints

Analyze Repository

POST /api/analyze
Content-Type: application/json

{
  "repo_url": "https://github.com/username/repository"
}

Get Job Status

GET /api/job/{job_id}

Get All Jobs

GET /api/jobs

Health Check

GET /api/health

🏗️ Project Structure

Documentation.AI/
├── app.py                      # Flask application entry point
├── requirements.txt            # Python dependencies
├── .env.example               # Environment template
├── setup.sh / setup.bat       # Setup scripts
├── README.md                  # This file
│
├── ai_models/                 # AI and ML components
│   ├── __init__.py
│   ├── github_analyzer.py     # Repository analysis
│   ├── documentation_generator.py # Doc generation
│   └── rag_pipeline.py        # RAG implementation
│
├── database/                  # Database models
│   ├── __init__.py
│   └── models.py              # SQLAlchemy models
│
├── utils/                     # Utility functions
│   ├── __init__.py
│   └── file_processor.py      # File processing utilities
│
└── frontend/                  # React frontend
    ├── package.json
    ├── tailwind.config.js
    ├── public/
    └── src/
        ├── components/        # Reusable components
        ├── pages/            # Page components
        ├── App.tsx           # Main app component
        ├── index.tsx         # Entry point
        └── index.css         # Global styles

🧪 Testing

Backend Tests

# Run Python tests
python -m pytest tests/

# Run with coverage
python -m pytest tests/ --cov=.

Frontend Tests

cd frontend

# Run React tests
npm test

# Run with coverage
npm run test:coverage

🐳 Docker Deployment

Using Docker Compose

# Build and start services
docker-compose up --build

# Run in background
docker-compose up -d

Manual Docker Build

# Build backend image
docker build -t documentation-ai-backend .

# Build frontend image
cd frontend
docker build -t documentation-ai-frontend .

# Run containers
docker run -p 5002:5002 documentation-ai-backend

🚀 Production Deployment

Environment Variables for Production

FLASK_ENV=production
FLASK_DEBUG=False
DATABASE_URL=postgresql://user:pass@host:port/dbname

Using Gunicorn

# Install gunicorn
pip install gunicorn

# Start with gunicorn
gunicorn -w 4 -b 0.0.0.0:5002 app:app

Nginx Configuration

server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass http://localhost:5002;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

Code Style

  • Python: Follow PEP 8, use Black formatter
  • JavaScript/TypeScript: Follow Airbnb style guide, use Prettier
  • Commit Messages: Use conventional commits format

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

🙏 Acknowledgments

📊 Stats

GitHub stars GitHub forks GitHub issues License


Built with ❤️ for developers by developers
Made possible by AI and the open-source community