DocGen is a fully offline AI-powered documentation generator that transforms programming code into structured, professional documentation using a locally running Large Language Model (LLM).
The system integrates a modern React frontend, Django REST backend, and Ollama with the Qwen2.5-Coder model β eliminating dependency on external APIs like OpenAI or Gemini.
Most AI documentation tools rely on paid cloud APIs. DocGen runs completely offline using a local LLM.
β No API cost β No internet dependency β Secure local execution β Full-stack architecture β Production-ready implementation
β Paste code and generate documentation instantly
β Upload .py, .cpp, .java, .js files
β AI-generated structured Markdown documentation
β Export documentation as PDF
β Export documentation as DOCX
β JWT-based authentication
β Document history tracking
β Clean split-screen UI
β Dark mode with animated background
β Fully Offline (No OpenAI / Gemini required)
User
β
React Frontend (UI + API Calls)
β
Django REST API
β
Ollama Local Model (Qwen2.5-Coder:7B)
β
Documentation Generator Engine
β
Generated Output
βββ Markdown Docs
βββ PDF Export
βββ DOCX Export
β
Download to User
| Layer | Technology |
|---|---|
| Frontend | React, Tailwind CSS, Framer Motion |
| Backend | Django, Django REST Framework |
| Authentication | SimpleJWT (JWT-based Auth) |
| AI Model | Ollama + Qwen2.5-Coder:7B |
| PDF Engine | ReportLab (Platypus) |
| DOCX Export | python-docx |
DocGen/
β
βββ backend/
β βββ backend/
β β βββ __init__.py
β β βββ settings.py
β β βββ urls.py
β β βββ asgi.py
β β βββ wsgi.py
β β
β βββ generator/
β β βββ migrations/
β β βββ admin.py
β β βββ apps.py
β β βββ models.py
β β βββ serializers.py
β β βββ views.py
β β βββ urls.py
β β βββ utils.py
β β
β βββ manage.py
β βββ requirements.txt
β
βββ frontend/
β βββ public/
β β βββ index.html
β β βββ favicon.ico
β β βββ manifest.json
β β
β βββ src/
β β βββ components/
β β β βββ Login.jsx
β β β βββ Dashboard.jsx
β β β βββ Editor.jsx
β β β βββ History.jsx
β β β
β β βββ services/
β β β βββ api.js
β β β
β β βββ App.js
β β βββ index.js
β β βββ App.css
β β
β βββ package.json
β βββ tailwind.config.js
β βββ postcss.config.js
β
βββ .gitignore
βββ README.md
Python 3.10+
Node.js + npm
Ollama installed locally
git clone https://github.com/SanjayMarathi/DocGen.git
cd DocGen
Pull the model and start Ollama:
ollama pull qwen2.5-coder:7b
ollama serve
Ollama runs at:
http://localhost:11434
cd backend
python -m venv venv
Windows (PowerShell)
.\venv\Scripts\activate
Mac/Linux (Bash)
source venv/bin/activate
pip install -r requirements.txt
If requirements.txt is not available:
pip install django djangorestframework djangorestframework-simplejwt django-cors-headers requests reportlab python-docx wikipedia
python manage.py migrate
python manage.py runserver 8000
http://127.0.0.1:8000
cd frontend
npm install
npm start
http://localhost:3000
Method Endpoint Description
POST /api/generate/ Generate streaming documentation
POST /api/pdf/ Export generated documentation as PDF
POST /api/docx/ Export generated documentation as DOCX
JWT-based authentication (SimpleJWT)
Token-based API communication
Document history linked to user account
PDF export uses ReportLab Platypus Engine
DOCX export uses python-docx
Structured headings
Code block formatting
Professional layout
Instant download
Start Ollama
Start Backend
Start Frontend
Paste or upload code
Click Generate Documentation
Click Export PDF / DOCX
ollama list
If model missing:
ollama pull qwen2.5-coder:7b
## CORS Issues
Already enabled in settings.py:
CORS_ALLOW_ALL_ORIGINS = True
## Port Conflict
Update ports in:
frontend/src/App.js
backend/generator/views.py
Markdown live preview panel
Multi-language documentation templates
Docker containerization
Role-based access control
Cloud deployment version.