Mahmoud AymanFull-stack & creative development
Back to work

DocuMind

Ask a document a question. Get an answer you can trace back to the source.

A document conversation with source references and structured answers.
A document conversation with source references and structured answers. Inspect full image

Screenshots from the project interface. Populated product views use synthetic demo data; displayed figures are not measured customer outcomes.

The problem.

Document question answering needs more than a convincing response. It needs relevant context, source citations, and a processing flow that remains responsive while files are indexed.

Inside the system.

Follow the request, one step at a time.

Architecture walkthrough
Step 01 / 05

Next.js interface

question: "What are the key findings?"

A question is sent for a processed document. Its chunks were embedded and indexed by background workers.

More work

An illustrated request flow, based on the project architecture. Select any step to inspect it.

The decisions.

Move indexing off the request path

BullMQ workers handle chunking, embedding, and indexing while the interface displays processing status.

The trade-offUploads stay responsive, but jobs need lifecycle management and the user must know when a document is ready.

Combine lexical and semantic retrieval

BM25 keyword search and vector embeddings feed hybrid retrieval, followed by MMR reranking for diversity.

The trade-offThe pipeline covers exact terms and conceptual matches, at the cost of more retrieval parameters to tune and evaluate.

Stream the answer with its sources

Server-sent events deliver the answer incrementally, alongside citations to the retrieved material.

The trade-offA response appears progressively; the interface also needs to handle incomplete streams and retries.

What I’d improve next.

Build a labelled question set to evaluate retrieval quality and citation support, rather than relying on a few successful example answers.

SecureScout