DocuAsk
Full-Stack Developer
DocuAsk is a production-grade, multi-tenant RAG platform that enables precise document Q&A with verifiable page-level source citations. Built with Next.js, PostgreSQL, and pgvector, it couples strict database-level row security with a dual-layer anti-hallucination pipeline that halts zero-relevance queries before they ever touch an LLM.
Key features
Zero-cost retrieval floor
Queries evaluate against a cosine similarity threshold (minScore: 0.12) before reaching the model pipeline; if no retrieved chunks cross the floor, the system returns an immediate grounded refusal without invoking the LLM, eliminating hallucinations while saving token spend.
Grounded citations with chunk relevance cards
The prompt pipeline enforces strict context-only answers with inline page markers mapped to interactive citation cards displaying file names, exact pages, and percentage match scores, backed by a deterministic regex safety net.
1024-dim pgvector HNSW indexing
PDF text chunks are embedded into 1024-dimensional vectors using Cloudflare Workers AI (@cf/baai/bge-m3) and indexed via PostgreSQL pgvector with HNSW cosine distance (vector_cosine_ops) for sub-millisecond nearest-neighbor search.
Forced PostgreSQL Row-Level Security (RLS)
Multi-tenancy is enforced at the database engine level via FORCE ROW LEVEL SECURITY, executing each query within a transaction setting app.tenant_id with a fail-closed NULLIF cast to prevent cross-tenant data leakage.
Screens
A walk through the key screens in DocuAsk, one at a time.

Landing
The public landing page. It explains the promise — upload a PDF, ask in plain language, get cited answers — and shows a sample question answered with its sources before asking for a sign-up.

Tanya Dokumen
The workspace. A question is typed in plain Indonesian and the answer comes back grounded in the uploaded document, with the source pages and match scores shown alongside it.

Dokumen
The document library. PDFs are uploaded and ingested here — extracted, chunked and embedded — and each one is listed with its status so you always know what the assistant can see.