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.