lamhieu/docsifer
13
<div align="center">
๐ Docsifer
Convert documents into clean, LLM-ready Markdown.
PDF ยท Word ยท PowerPoint ยท Excel ยท HTML ยท Audio ยท Image ยท CSV ยท JSON ยท ZIP
   
</div>
Features
- Multi-format โ PDF, Office, audio (Whisper), images (vision), HTML, CSV, JSON, ZIP, and more โ powered by MarkItDown.
- Optional LLM โ bring your own OpenAI-compatible key for OCR, transcription and structured layout extraction.
- Production-grade โ bounded concurrency, per-IP fairness, memory watchdog, disk cleanup, circuit breaker.
- Hardened โ SSRF guard, path-traversal sanitation, body-size limits, security headers.
- Observable โ JSON logs with request id,
/v1/healthz,/v1/readyz,/v1/stats. - Privacy-first โ files are processed in-memory and discarded immediately.
Quickstart
# Local
make install
cp .env.example .env
make run
# Docker
docker build -t docsifer .
docker run --rm -p 7860:7860 --env-file .env docsiferOpen <http://localhost:7860> for the UI or <http://localhost:7860/docs> for the API.
API
Examples
Basic conversion:
curl -X POST http://localhost:7860/v1/convert \
-F "file=@document.pdf"With LLM enhancement:
curl -X POST http://localhost:7860/v1/convert \
-F "file=@page.html" \
-F 'openai={"api_key":"sk-...","model":"gpt-4o-mini"}'Convert a URL:
curl -X POST http://localhost:7860/v1/convert \
-F "url=https://example.com/article"Configuration
All settings are environment-driven (prefix DOCSIFER_). See `.env.example` for the full list. Common knobs:
Architecture
docsifer/
โโโ api/ FastAPI layer โ routes, schemas, middleware
โโโ core/ Pure logic โ converter, MIME, tokenizer, LLM cache
โโโ analytics/ Lifespan-managed analytics (Upstash + in-memory)
โโโ safety/ Anti-crash primitives (gate, limiter, watchdog, breaker)
โโโ ui/ Optional Gradio playground
โโโ config.py Pydantic settings
โโโ exceptions.py
โโโ logging_config.py
โโโ main.py App factory + lifespanSee `ARCHITECTURE.md` for the full design notes.
Development
make install # runtime + dev deps
make lint # ruff
make format # ruff format
make type # mypy
make test # pytest
make cov # pytest with coverageLicense
MIT ยฉ Lam Hieu โ built on top of the wonderful MarkItDown.
