Skip to content

yogyam/docflow

Repository files navigation

DocFlow Lite πŸ“š

AI-Powered Role-Specific Documentation Generator

DocFlow Lite automatically analyzes your GitHub repositories using Gemini AI and generates personalized, role-specific documentation that makes onboarding faster and easier for developers. It creates comprehensive guides tailored for backend, frontend, DevOps, or any other development role and automatically submits them as pull requests to your repository.

✨ Features

  • πŸ€– AI-Powered Analysis: Uses Google's Gemini AI to intelligently analyze your codebase
  • 🎯 Role-Specific Documentation: Generates targeted guides for different developer roles (backend, frontend, DevOps, etc.)
  • πŸ“‹ Automatic Pull Requests: Creates and submits documentation directly to your GitHub repository
  • πŸ” Smart Code Understanding: Analyzes functions, dependencies, architecture, and workflows
  • 🌐 Web Interface: Easy-to-use frontend for repository connection and documentation generation
  • ⚑ Fast Processing: Efficient analysis of repositories up to 10 files for quick results

πŸš€ Quick Start

Prerequisites

Before you begin, ensure you have:

  • Node.js (v18 or higher)
  • npm or yarn
  • GitHub Personal Access Token with repository permissions
  • Google Gemini API Key

1. Clone the Repository

git clone <your-repo-url>
cd docflow-lite

2. Install Dependencies

# Install root dependencies
npm install

# Install backend dependencies
cd backend && npm install && cd ..

# Install frontend dependencies
cd frontend && npm install && cd ..

3. Environment Setup

Create a .env file in the /backend directory:

# backend/.env
GITHUB_TOKEN=your_github_personal_access_token_here
GEMINI_API_KEY=your_google_gemini_api_key_here
NODE_ENV=development
PORT=3001
FRONTEND_URL=http://localhost:3000

Getting Your API Keys:

GitHub Token:

  1. Go to GitHub Settings β†’ Developer settings β†’ Personal access tokens β†’ Tokens (classic)
  2. Generate new token with these permissions:
    • repo (Full control of private repositories)
    • public_repo (Access public repositories)
    • read:org (Read org and team membership)

Gemini API Key:

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

4. Run the Application

# Start both frontend and backend servers
npm run dev

This will start:

πŸ› οΈ Usage

Web Interface (Recommended)

  1. Open your browser to http://localhost:3000
  2. Enter a GitHub repository URL (e.g., https://github.com/yourusername/your-repo)
  3. Select your target role (backend, frontend, devops, etc.)
  4. Click "Generate Documentation"
  5. Wait for the AI analysis to complete
  6. Check your GitHub repository for the new pull request with generated documentation

API Usage

You can also use the API directly:

curl -X POST http://localhost:3001/api/generate/generate-docs \
  -H "Content-Type: application/json" \
  -d '{
    "repoUrl": "https://github.com/yourusername/your-repo",
    "role": "backend"
  }'

πŸ“ Project Structure

docflow-lite/
β”œβ”€β”€ README.md                          # This file
β”œβ”€β”€ package.json                       # Root package configuration
β”œβ”€β”€ backend/                           # Node.js/Express backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”‚   β”œβ”€β”€ github.js             # GitHub integration routes
β”‚   β”‚   β”‚   β”œβ”€β”€ simpleDocGeneration.js # Main documentation generation
β”‚   β”‚   β”‚   β”œβ”€β”€ docs.js               # Legacy documentation routes
β”‚   β”‚   β”‚   └── chat.js               # AI chat functionality
β”‚   β”‚   β”œβ”€β”€ services/                 # Business logic services
β”‚   β”‚   └── index.js                  # Server entry point
β”‚   β”œβ”€β”€ package.json                  # Backend dependencies
β”‚   └── .env                          # Environment variables
└── frontend/                         # Next.js frontend
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ pages/                    # Next.js pages
    β”‚   β”œβ”€β”€ components/               # React components
    β”‚   └── services/                 # API service layer
    β”œβ”€β”€ package.json                  # Frontend dependencies
    └── next.config.js                # Next.js configuration

πŸ”§ Configuration

Supported Roles

The system currently supports these developer roles:

  • backend - Backend/API developers
  • frontend - Frontend/UI developers
  • devops - DevOps/Infrastructure engineers
  • fullstack - Full-stack developers
  • mobile - Mobile app developers
  • data - Data scientists/engineers

Customization

You can customize the documentation generation by modifying:

  • Templates: Edit the prompts in /backend/src/routes/simpleDocGeneration.js
  • Analysis Logic: Modify the Gemini analysis prompts
  • UI Components: Customize React components in /frontend/src/components/

πŸ§ͺ Testing

Test the Backend API

# Health check
curl http://localhost:3001/health

# Test documentation generation
curl -X POST http://localhost:3001/api/generate/generate-docs \
  -H "Content-Type: application/json" \
  -d '{"repoUrl": "https://github.com/yourusername/test-repo", "role": "backend"}'

Test Repository Analysis

# Test Gemini analysis only
curl -X POST http://localhost:3001/api/github/test-gemini-analysis \
  -H "Content-Type: application/json" \
  -d '{"repoUrl": "https://github.com/yourusername/test-repo"}'

πŸ“ Generated Documentation

DocFlow creates comprehensive documentation including:

For Each Role:

  • 🎯 Project Overview - Role-specific project understanding
  • πŸš€ Quick Start Guide - Setup instructions for that role
  • πŸ—οΈ Architecture Overview - System design from role perspective
  • πŸ”§ Key Components - Important parts for that role
  • πŸ“¦ Dependencies & Tools - Relevant technologies
  • πŸ› οΈ Development Workflow - Role-specific processes
  • πŸ§ͺ Testing & Debugging - Testing approaches
  • πŸ“š Additional Resources - Role-relevant links and docs

File Structure Created:

docs/
β”œβ”€β”€ README.md                    # Documentation index
└── {role}-guide.md             # Role-specific guide

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

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

οΏ½ Troubleshooting

Common Issues

Server won't start:

  • Check that your .env file is in the /backend directory
  • Verify your API keys are correctly set
  • Ensure ports 3000 and 3001 are available

Documentation generation fails:

  • Verify your GitHub token has correct permissions
  • Check that the repository URL is publicly accessible
  • Ensure your Gemini API key is valid and has quota

Frontend can't connect to backend:

  • Confirm backend is running on port 3001
  • Check browser console for CORS errors
  • Verify FRONTEND_URL in backend .env matches your frontend URL

Debug Mode

Enable detailed logging by setting:

NODE_ENV=development

Support

For issues and support:

  1. Check the Issues page
  2. Create a new issue with detailed error information
  3. Include your environment details and steps to reproduce

Made with ❀️ using Gemini AI and modern web technologies

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages