AI-Powered Documentation Generator β Open Source & Self-Hostable
DocForge is a production-ready documentation generation tool that uses AI to automatically scan your codebase and create high-quality documentation. It features a Node.js CLI client with a premium static website builder and a FastAPI backend server compatible with any OpenAI-compatible LLM.
Privacy by default: DocForge now points to
http://localhost:8000unless you explicitly configure another endpoint. Review your chosen AI provider's data policy before sending source code to it.
- π Multi-Language Support: Scans and documents JavaScript, TypeScript, Python, Go, Rust, Java, PHP, C++, C#, Kotlin, Swift, and more.
- π€ Bring Your Own AI: Seamlessly connect to Ollama, vLLM, LM Studio, OpenAI, OpenRouter, or Groq.
- β‘ Framework Detection & Integration: Automatically detects Laravel, Next.js, Vite/React, or Static projects and injects custom-tailored documentation pages (
Docs.tsx,docs.blade.php, or staticindex.html) directly. - π Website Builder: Builds a premium documentation site from Markdown files featuring:
- Nested Sidebar Tree Navigation with custom guide lines.
- Active State Highlights synced across scrolling, manual clicks, and Next/Previous navigation buttons.
- Clean Expanded Layout with full responsiveness and copy-to-clipboard buttons on code snippets.
- π Docker Ready: Easy self-hosting with preconfigured
docker-compose.yml.
Generate documentation for your project in seconds without installing anything:
# Generate markdown documentation files
npx @ultramaxoo/docforge generate
# Build a premium documentation site
npx @ultramaxoo/docforge build-siteInstall globally on your system to use the CLI directly:
# Install CLI
npm install -g @ultramaxoo/docforge
# Initialize docforge config in your project
docforge init
# Generate docs
docforge generate
# Build docs site
docforge build-siteInitializes a local configuration file .docforge/config.json and a placeholder documentation folder.
Scans the directory files and generates markdown docs.
-o, --output <dir>: Output directory (default:./)-s, --server <url>: Target server URL override-i, --include <patterns...>: File patterns to include-e, --exclude <patterns...>: File patterns to exclude--readme/--no-readme: Toggle README.md generation--api/--no-api: Toggle API.md generation--architecture/--no-architecture: Toggle ARCHITECTURE.md generation--changelog/--no-changelog: Toggle CHANGELOG.md generation
Compiles generated markdown files into a premium docs site matching your local framework.
-i, --input <dir>: Directory containing markdown files (default:./docs)-o, --output <dir>: Output directory for static HTML pages (default:./docs-site)--compile-only: Compile existing markdown files directly without calling the AI
Starts the DocForge server locally for self-hosting.
-p, --port <port>: Port to listen on (default:8000)--ai-url <url>: AI endpoint base URL--ai-model <model>: AI model name--ai-key <key>: AI provider API key (optional)
Sets or displays the default DocForge API backend server URL.
You can run the full server stack locally using Docker Compose:
# Start server + Ollama AI service
docker compose up -d
# Pull an AI model to your local Ollama instance
docker compose exec ollama ollama pull llama3
# Configure CLI to point to your local server
docforge set-server http://localhost:8000Configure the FastAPI server by creating a .env file under server/:
AI_BASE_URL=http://localhost:11434/v1 # OpenAI-compatible API endpoint
AI_MODEL=llama3 # Model identifier
AI_API_KEY=your-api-key-here # Optional key for cloud providers
MAX_TOKENS=4000
TEMPERATURE=0.7
HOST=0.0.0.0
PORT=8000
RATE_LIMIT_PER_MINUTE=10
CORS_ORIGINS=*DocForge works out of the box with any OpenAI-compatible API:
| Provider | Base URL | Note |
|---|---|---|
| Ollama | http://localhost:11434/v1 |
Free & local |
| vLLM | http://localhost:8000/v1 |
High-performance |
| LM Studio | http://localhost:1234/v1 |
GUI local runner |
| OpenAI | https://api.openai.com/v1 |
Cloud API |
| OpenRouter | https://openrouter.ai/api/v1 |
Aggregated services |
| Groq | https://api.groq.com/openai/v1 |
Fast inference |
DocForge is built in public and welcomes maintainers, documentation writers, and developers.
- Read CONTRIBUTING.md for local setup and pull-request guidelines.
- Report reproducible problems or propose features in GitHub Issues.
- Read SECURITY.md before reporting a vulnerability.
- See ROADMAP.md for current priorities.
- See ADOPTERS.md to share a public project that uses DocForge.
- All participation follows the Code of Conduct.
Useful contributions include provider setup examples, tests, framework templates, documentation improvements, and fixes that make self-hosting easier.
docforge/
βββ server/ # FastAPI server (AI processing)
β βββ main.py # App entry, middleware, logging
β βββ config.py # Environment config + validation
β βββ routes/
β β βββ generate.py # POST /generate
β β βββ repo.py # POST /generate-from-repo
β β βββ health.py # GET /health (with AI status)
β βββ services/
β β βββ ai_provider.py # Unified OpenAI-compatible client
β β βββ doc_generator.py # Prompt building + parsing
β β βββ repo_downloader.py
β βββ models/
β β βββ schemas.py # Pydantic models + validators
β βββ Dockerfile
β βββ requirements.txt
β
βββ client/ # Node.js CLI
β βββ src/
β β βββ index.js # CLI command registration
β β βββ commands/
β β β βββ generate.js # Doc generation engine
β β β βββ buildSite.js # Site compilation engine
β β β βββ init.js
β β β βββ serve.js
β β βββ templates/
β β βββ react-component.tsx # React template (Next.js/Vite)
β β βββ laravel.blade.php # Laravel Blade template
β β βββ static.html # Static HTML/Alpine.js template
β βββ package.json
β
βββ docker-compose.yml
βββ README.md
MIT