Try the fit-to-box engine
Click the text and start typing — this mirrors the client-side
auto-shrink algorithm in useTypographyCanvas.ts: the string is re-measured
on every keystroke and the font size binary-searches down to stay inside the original box.
Core capabilities
Dual-Engine Extraction
Structural PDF parsing (PyMuPDF) for vector text; OCR + layout analysis (PaddleOCR/OpenCV) for scans and PNGs — unified into one typography schema.
Style Cloning
Weight, italic slant, proportional scaling, tracking, and exact RGB color sampling, reproduced on redraw.
Content-Aware Erase
Vector redaction removes glyph outlines cleanly; raster inpainting (Telea) restores background texture before new ink is drawn.
Font Similarity Matching
Visual-metrics embedding (x-height, stroke density, slant) finds the closest available font when an exact family can't be resolved.
Live Collaboration
WebSocket channel per document streams render progress, undo/redo events, and peer cursor state to every connected client.
Non-Destructive History
Every edit is a diff in an undo/redo ledger — nothing is baked into the source document until export.
Architecture
Client (Next.js + Konva) │ REST + WebSocket ▼ FastAPI Gateway ── Celery (vector-extract / raster-extract / render queues) │ │ ▼ ▼ Redis (broker) PyMuPDF · PaddleOCR · OpenCV · PyTorch │ ▼ Postgres (metadata) · MinIO/S3 (documents)
See ARCHITECTURE.md in the repo for the full data-flow breakdown and typography schema.
API reference (selected)
| Method | Path | Purpose |
|---|---|---|
| POST | /documents/upload | Upload a PDF or PNG |
| POST | /documents/{id}/extract | Dispatch typography extraction (vector or raster queue) |
| POST | /documents/edit | Apply a text mutation to a region, auto-fitted to its bbox |
| POST | /documents/{id}/undo / /redo | Step through the non-destructive edit ledger |
| POST | /fonts/match | Nearest-font lookup by weight/italic/x-height profile |
| WS | /ws/documents/{id} | Live render-progress and collaboration channel |
Run it locally
git clone https://github.com/Nikhil-creat/typeclone.git cd typeclone/backend-lite pip install -r requirements.txt uvicorn app:app --reload # Or skip local setup entirely — deploy free on Render (see README-LITE.md)
This documentation page is static and runs on GitHub Pages. The working engine
(backend-lite/ — FastAPI + PyMuPDF + Gemini vision) is deployed separately
on Render's free tier and powers the Live Editor. A heavier
full architecture (Celery/Redis/PaddleOCR/PyTorch) also exists in this repo for anyone
wanting to self-host at production scale — see ARCHITECTURE.md.