Skip to content

Repository files navigation

PyDocAI

AI-Powered Documentation Generator for Any Language

License: MIT GitHub stars GitHub forks Vercel Django React

Upload your code and let AI generate beautiful, comprehensive documentation in seconds.

🌐 Live Demo Β· πŸ› Report Bug Β· ✨ Feature Request


Features

  • πŸ€– AI-Powered Documentation β€” Parses your code and generates human-readable docs using Groq AI
  • 🌐 Universal Language Support β€” Works with Python, JavaScript, TypeScript, Java, Go, Rust, and more via AI-driven analysis
  • 🐍 Python AST Mode β€” Deep Python/Django code analysis with AST parsing for schema tables, endpoint mapping, and model relationships
  • πŸ“ Multiple Input Methods β€” Upload single .py files, .zip archives, paste raw code, or connect a GitHub repository
  • πŸ“Š Schema Generation β€” Auto-compiled tables detailing database models, field types, constraints, and relationships (Python mode)
  • πŸ”— Endpoint Mapping β€” Automated REST API documentation with HTTP methods, path parameters, and JSON responses (Python mode)
  • πŸ“ Markdown Export β€” Export documentation as clean Markdown, compatible with GitHub, GitLab, and VS Code
  • πŸ“’ Publish & Share β€” Publish documentation publicly with shareable links and community comments
  • πŸ” User Authentication β€” JWT-based auth with GitHub OAuth, email/password registration, password reset
  • πŸ“± Fully Responsive β€” Mobile-first dark UI with slide-in sidebar navigation, works on phones, tablets, and desktops

Tech Stack

Layer Technology
Frontend React 19, Vite, TypeScript, Tailwind CSS, React Router
Backend Django 5, Django REST Framework, Celery, Redis
Database PostgreSQL
AI Groq API (LLaMA)
Deployment Vercel (frontend), AWS EC2 + RDS + ElastiCache (backend)

Quick Start

With Docker

docker-compose up --build -d

Without Docker

Backend:

cd backend
uv venv
uv run python manage.py migrate
uv run python manage.py runserver

Frontend:

cd frondend
npm install
npm run dev

How It Works

Python Mode (AST-powered)

1. Upload Code ──▢ 2. AST Parsing ──▢ 3. AI Generation ──▢ 4. Beautiful Docs
     β”‚                    β”‚                   β”‚                    β”‚
  .py / .zip          Python AST          Groq LLM           Markdown + UI
  GitHub repo        extracts types      writes docs         preview + export

Universal Mode (AI-direct)

1. Upload Code ──▢ 2. AI Analysis ──▢ 3. Structured Docs
     β”‚                    β”‚                   β”‚
  any language         Groq LLM           Tabbed README /
  (.py/.js/.ts/...)   analyzes code      API / Architecture

Architecture

graph LR
    F["React Frontend<br/>:5173"]:::frontend
    N["Nginx<br/>:8080"]:::gateway
    D["Django Core<br/>:8000"]:::api
    R[("Redis")]:::data
    C["Celery<br/>Worker"]:::worker
    P["FastAPI<br/>Parser :8002"]:::fastapi
    A["FastAPI<br/>AI :8003"]:::fastapi
    PG[("PostgreSQL")]:::data
    G["Groq API"]:::ext
    GH["GitHub"]:::ext

    F -->|1. upload code| N
    N -->|/api/parser/| D
    D -->|2. create project| PG
    D -->|3. dispatch task| R
    R --> C
    C -->|4. AST parse| P
    C -->|5. generate docs| A
    P -->|parsed data| D
    A -->|docs| D
    A -.->|embeddings| PG
    D -->|6. store result| PG
    D -->|7. return docs| F
    F -->|8. publish| N
    N -->|publish| D
    D -->|update visibility| PG
    D -.->|OAuth| GH
    A -.->|AI| G

    classDef frontend fill:#0f172a,stroke:#38bdf8,color:#f8fafc;
    classDef gateway fill:#1e1b4b,stroke:#a78bfa,color:#eef2ff;
    classDef api fill:#064e3b,stroke:#34d399,color:#ecfdf5;
    classDef data fill:#7f1d1d,stroke:#f87171,color:#fef2f2;
    classDef worker fill:#1e3a5f,stroke:#60a5fa,color:#bfdbfe;
    classDef fastapi fill:#831843,stroke:#f472b6,color:#fdf2f8;
    classDef ext fill:#1c1917,stroke:#a8a29e,color:#fafaf9;
Loading

Project Structure

PyDocAi/
β”œβ”€β”€ deploy/
β”‚   └── nginx.conf              # Reverse proxy config
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ core/                   # Django monolith (API hub)
β”‚   β”‚   β”œβ”€β”€ apps/               # 13 Django apps
β”‚   β”‚   β”‚   β”œβ”€β”€ users/          # Auth (JWT, GitHub OAuth, password reset)
β”‚   β”‚   β”‚   β”œβ”€β”€ projects/       # Project CRUD, publish, sharing
β”‚   β”‚   β”‚   β”œβ”€β”€ parser/         # Python AST parsing orchestration
β”‚   β”‚   β”‚   β”œβ”€β”€ ai/             # AI doc generation orchestration
β”‚   β”‚   β”‚   β”œβ”€β”€ universal/      # Universal code analysis
β”‚   β”‚   β”‚   β”œβ”€β”€ github_integration/ # GitHub repo fetching
β”‚   β”‚   β”‚   β”œβ”€β”€ exports/        # Markdown export
β”‚   β”‚   β”‚   β”œβ”€β”€ comments/       # Public doc comments
β”‚   β”‚   β”‚   β”œβ”€β”€ feedback/       # User feedback & admin replies
β”‚   β”‚   β”‚   β”œβ”€β”€ admin_dashboard/ # Admin stats & management
β”‚   β”‚   β”‚   β”œβ”€β”€ notifications/  # Email notifications
β”‚   β”‚   β”‚   β”œβ”€β”€ common/         # Shared utilities, health check
β”‚   β”‚   β”‚   └── internal/       # Inter-service communication
β”‚   β”‚   β”œβ”€β”€ config/             # Django settings (base/dev/prod)
β”‚   β”‚   β”œβ”€β”€ docker/             # Dockerfile + entrypoint.sh
β”‚   β”‚   β”œβ”€β”€ env/                # .env + .env.example
β”‚   β”‚   β”œβ”€β”€ seed/               # seed_admin.py
β”‚   β”‚   β”œβ”€β”€ templates/emails/   # HTML email templates
β”‚   β”‚   β”œβ”€β”€ requirements/       # Pip requirements
β”‚   β”‚   └── manage.py
β”‚   β”œβ”€β”€ parser/                 # FastAPI microservice (AST parsing)
β”‚   β”‚   β”œβ”€β”€ api/routes/         # file, folder, status, health
β”‚   β”‚   β”œβ”€β”€ ast_parser.py       # Core AST logic
β”‚   β”‚   β”œβ”€β”€ framework_detector.py
β”‚   β”‚   β”œβ”€β”€ docker/Dockerfile
β”‚   β”‚   └── main.py
β”‚   └── ai/                     # FastAPI microservice (AI generation)
β”‚       β”œβ”€β”€ api/routes/         # generate, status, health
β”‚       β”œβ”€β”€ services/           # groq, docs_builder, markdown, prompts
β”‚       β”œβ”€β”€ rag.py              # RAG-based code embedding
β”‚       β”œβ”€β”€ docker/Dockerfile
β”‚       └── main.py
β”œβ”€β”€ frondend/                   # React 19 + Vite + Tailwind
β”‚   └── src/
β”‚       β”œβ”€β”€ pages/              # 19 route pages
β”‚       β”‚   β”œβ”€β”€ Home, Login, Register, ForgotPassword, ResetPassword
β”‚       β”‚   β”œβ”€β”€ Dashboard, Input, InputPython, InputUniversal
β”‚       β”‚   β”œβ”€β”€ Output, Profile, GitHubCallback
β”‚       β”‚   β”œβ”€β”€ Published, PublicDoc
β”‚       β”‚   β”œβ”€β”€ FeedbackPage, MyFeedback
β”‚       β”‚   β”œβ”€β”€ AdminUsers, AdminProjects, AdminFeedback
β”‚       β”œβ”€β”€ components/         # 14 reusable UI components
β”‚       β”œβ”€β”€ hooks/              # useAuth
β”‚       β”œβ”€β”€ context/            # AuthContext
β”‚       └── api/                # API client (index.js)
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ docker-compose.prod.yml
└── README.md

API Documentation

Full API reference with endpoint details, authentication, request/response examples, and error handling is available in API_DOCS.md.

Interactive Swagger UI (when running via Docker):

Service URL
Django Core API http://localhost:8080/api/docs/
Parser Service http://localhost:8080/parser/docs/
AI Service http://localhost:8080/ai/docs/

Environment Variables

Backend (backend/.env)

Variable Description
DJANGO_SECRET_KEY Django secret key
DB_NAME, DB_USER, DB_PASSWORD PostgreSQL credentials
DB_HOST, DB_PORT PostgreSQL host and port
CELERY_BROKER_URL Redis URL for Celery broker
GROQ_API_KEY Primary Groq AI API key
GROQ_API_KEY_2 Secondary Groq AI API key (fallback)
GITHUB_CLIENT_ID GitHub OAuth app client ID
GITHUB_CLIENT_SECRET GitHub OAuth app secret
GITHUB_API_TOKEN GitHub API token for repo fetching
EMAIL_HOST, EMAIL_PORT SMTP server settings
EMAIL_HOST_USER, EMAIL_HOST_PASSWORD SMTP credentials
FRONTEND_URL Frontend origin for CORS
CORS_ALLOWED_ORIGINS Allowed CORS origins
AWS_ACCESS_KEY_ID AWS S3 access key (production)
AWS_SECRET_ACCESS_KEY AWS S3 secret key (production)
AWS_STORAGE_BUCKET_NAME S3 bucket name (production)

Frontend (frondend/.env)

Variable Description
VITE_GITHUB_CLIENT_ID GitHub OAuth client ID for frontend login

Contributing

We welcome all contributions! See CONTRIBUTING.md for details.

Ways to help:

  • πŸ› Report bugs via GitHub Issues
  • πŸ’‘ Suggest features
  • πŸ”§ Submit pull requests
  • ⭐ Star the repo to show support

License

Distributed under the MIT License. See LICENSE for more information.


⭐ If you find this project useful, give it a star! ⭐

GitHub stars

Built with ❀️ for the Python community

About

Resources

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages