Docgen AI is an intelligent platform designed to automate the generation of technical documentation for software projects. It analyzes your codebase, understands its structure and logic, and leverages an AI agent to produce comprehensive, accurate, and up-to-date documentation in Markdown format.
- AI-Powered Documentation Generation: Automatically generates detailed Markdown documentation from source code.
- Code Analysis: Deeply analyzes repository structure, functions, classes, and dependencies.
- Multi-language Support: Designed to be extensible for various programming languages (currently Python).
- Authentication System: Secure user registration and login with token-based authentication (HTTP-only cookies).
- Interactive Web Interface: A user-friendly React frontend to interact with the documentation generation process.
- Scalable Architecture: Built with FastAPI for a robust and performant backend.
- Local Development: Supports SQLite for local database operations.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Before you begin, ensure you have the following installed:
- Python 3.12+: For the backend services.
- uv: A fast Python package installer and dependency resolver.
- Node.js & npm (or yarn): For the frontend development.
Create a .env file in the root of the project with the following variable:
APP_ENCRYPTION_KEY="your_url_safe_base64_32_byte_key"
This key is essential for encrypting sensitive data, such as user-provided API keys, before they are stored in the database.
Generating APP_ENCRYPTION_KEY:
You can generate a URL-safe base64-encoded 32-byte key using a Python script:
import os
import base64
key = base64.urlsafe_b64encode(os.urandom(32)).decode()
print(key)Run this script and copy the output into your .env file for APP_ENCRYPTION_KEY.
git clone https://github.com/hubaibmahmood/docs-generator.git
cd docs-generator# Create and activate a Python virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install backend dependencies using uv
uv pip install .
# Apply database migrations
alembic upgrade headcd docgen-ai
npm install # or yarn install
cd ..From the project root directory:
source .venv/bin/activate # if not already active
uvicorn src.api.main:app --host 0.0.0.0 --port 8087 --reloadThe backend API will be available at http://localhost:8087.
From the project root directory:
cd docgen-ai
npm run dev # or yarn devThe frontend application will typically open in your browser at http://localhost:3000 (or another port if 3000 is in use).
Navigate to the frontend application URL (e.g., http://localhost:3000) in your web browser. You can:
- Register/Login: Create an account or log in to access the documentation generation features.
- Submit Repository URL: Provide a GitHub repository URL for analysis and documentation generation.
- View Generated Docs: Monitor the status and view the generated Markdown documentation directly in the browser.
The backend provides a RESTful API for interacting with the documentation generation engine.
POST /auth/register: Register a new user.POST /auth/token: Authenticate user and get an access token.POST /process: Submit a GitHub repository URL for processing.GET /status/{task_id}: Check the status of a documentation generation job.GET /result/{task_id}: Retrieve the result (summary and file paths) of a completed job.GET /docs/raw/{file_path:path}: Retrieve raw content of a generated documentation file.
For detailed API documentation, refer to the OpenAPI docs at /docs or /redoc when the backend is running.
- URL Validation: Robust URL validation and sanitization are implemented to prevent SSRF and path traversal attacks.
We welcome contributions! Please see our CONTRIBUTING.md (to be created) for details on how to contribute, report bugs, and suggest features.
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or issues, please open an issue on the GitHub repository.