Skip to main content

AskDocs v2

Full-stack RAG system with semantic document retrieval, streamed AI answers, and page-linked citations

A document intelligence application combining semantic PDF retrieval, persistent conversations, streamed AI responses, and source-linked citations.

Role
Software Engineer — Backend & GenAI Systems
Year
2026

Technologies

TypeScript
NestJS
Next.js
PostgreSQL
pgvector
LangChain
OpenAI API
React
Node.js
Tailwind CSS
Docker
Jest
Vitest
GitHub Actions

Video documentation

EXTERNAL_MEDIA_BLOCKED

This project video is hosted on YouTube. Enable external media in cookie settings to load the embed here.

(En) AskDocs — Full-Stack RAG Document Intelligence Demo

Technical context

Retrieving information across multiple PDFs involves more than text search. Effective document question-answering requires relevant context selection, persistent document relationships, and a clear connection between generated responses and their underlying sources.

Project media

Workspace (DarkMode)

Problem

Design an end-to-end document question-answering system that supports scoped semantic retrieval, consistent conversation history, streamed responses, and traceable citations while managing document and message lifecycles reliably.

Project files

Project overview

AskDocs processes uploaded PDFs through text extraction, overlapping chunk generation, embedding generation, and PostgreSQL/pgvector indexing. Its RAG pipeline retrieves relevant passages from selected documents, removes duplicate content, applies a context budget, and supplies source-labeled evidence to the language model.

The NestJS backend manages document relationships, conversation history, model orchestration, and response streaming. A Next.js interface provides document management, Slovak and English conversations, persistent chat history, and an integrated viewer that opens referenced pages directly in the original PDFs.

Technical approach

  • Build a PDF ingestion pipeline with text extraction, chunking, embeddings, and vector indexing
  • Design a PostgreSQL data model for documents, original files, conversations, messages, and citations
  • Implement scoped semantic retrieval with deduplication and bounded context preparation
  • Develop streamed AI responses with persistent message states and cancellation handling
  • Connect generated citations to original PDF pages and validate retrieval behavior through automated evaluation

Technical focus

  • Retrieval-Augmented Generation and semantic vector search
  • Relational database design and persistent conversational state
  • Streaming API architecture, cancellation, and failure handling
  • Context preparation, citation mapping, and prompt trust boundaries
  • Automated testing and deterministic RAG evaluation

Architecture notes

  • NestJS API coordinating document ingestion, semantic retrieval, LLM orchestration, and NDJSON streaming
  • PostgreSQL persistence for document metadata, original PDF content, vector embeddings, conversations, and message history
  • RAG pipeline with document-scope filtering, ranked retrieval, context deduplication, and controlled source identifiers
  • Transactional conversation handling with guarded message-state transitions and interruption recovery
  • Next.js frontend integrating streamed conversations, document management, citation navigation, and PDF rendering

Engineering highlights

  • Semantic retrieval across conversation-specific documents or the complete document library
  • Page-level citations linked to original PDFs through an integrated document viewer
  • Persistent conversations with streaming, cancellation, and interrupted-session recovery
  • Concurrent AI-generated chat titles with protection against overwriting manual changes
  • Automated unit, integration, end-to-end, and deterministic RAG evaluation workflows

Outcome

Delivered a complete document question-answering workflow with persistent conversations, configurable document scopes, bilingual interaction, streamed responses, and integrated PDF citations. The implementation includes automated unit, integration, end-to-end, and RAG evaluation workflows.