Chat with PDF — cited answers highlighted in yellow upload → PyMuPDF / Tesseract OCR → chunks + word boxes → Cohere Embed v4 → Qdrant · question → Rerank 3.5 → Claude Sonnet 4.6 with verbatim quotes → aligned, scored, highlighted on the PDF ⓘ click any component for details 01 · WEB APP & API USER iBrowserdrag & drop PDFsask questions WEB · NEXT.JS 16 · REACT 19 iNext.jsApp Router · Tailwind 4/api/* rewrite proxy iPDF.js vieweryellow citation overlaysexact at any zoom iChat · Statisticsresizable split viewExcel / CSV export API · FASTAPI iREST /api/*upload · chat · statsOpenAPI docs iAuthJWT httpOnly cookiescrypt · owner checks STORAGE iPostgreSQLSQLite locallydocs · chunks · chat iAmazon S3original PDFsSSE / KMS · or disk 02 · INGESTION — background worker per upload READ PAGES iPyMuPDFevery word + its boxtables · figures iTesseract OCRscanned pagesara+eng · 300 dpi STRUCTURE iArabic repairligatures · RTL cellsdrop headers/footers iChunks + anchors~900-char passages"Table 3.3" · "جدول ٢" clean text AWS BEDROCK iClaude Sonnet 4.6reads charts → numberslabels statistics iCohere Embed v4one vector per chunkArabic + English INDEX iQdrantvectors filteredby document_id iStatisticstext + table + chart→ PostgreSQL 03 · CHAT — grounded answer, every claim highlighted in yellow RETRIEVE iEmbed question+ previous questionfor follow-ups iVector searchtop-K passagesthis document only query vector RERANK · BEDROCK iCohere Rerank 3.5best passagesbecome context ANSWER · BEDROCK iClaude Sonnet 4.6statements, each withverbatim quotes GROUND & SCORE iQuote alignmentfuzzy match quoteto PDF word boxes iMatch score0.7 rerank + 0.3 fidelity≤ 45% if number absent boxes SHOW iYellow highlightsHigh / Medium / Lowclick → cross-refs HTTPS /api/* SQL · S3 pages chunks · charts vectors candidates context JSON boxes · % upload → queued for ingestion indexed document HOW IT HOLDS TOGETHER Answers come only from the document. Claude must return each statement with a verbatim quote from a numbered source; with no supporting passage it says the document doesn't contain the answer. Highlights are exact, not approximate. Every word's box is stored at ingestion (0–1 page coordinates); the quote is aligned to those words and drawn as yellow overlays on the PDF.js canvas. The match % is measured, not self-reported. score = 0.7 × Cohere Rerank(statement, cited passage) + 0.3 × quote fidelity, capped at 45% when a number in the statement is missing from the source. Arabic and scanned PDFs are first-class. Tesseract ara+eng OCR, ligature and RTL table repair, and Arabic-Indic digits normalised before matching and statistics extraction. Per-user and private. httpOnly JWT cookie, ownership check on every document route, PDF magic-byte and size validation, S3 server-side encryption. request / data pathpersistenceDocker Compose locally · ECS Fargate / App Runner / EC2 + RDS + S3 on AWS