Skip to main content

Design a multi-tenant AI Document Q&A (RAG) SaaS

Allow teams to upload PDFs/docs, index them asynchronously, enforce per-workspace access control, and answer cited questions fast.

Official Reference

Model Answer & Explanation

Upload files directly to S3/R2 via presigned URLs -> async worker extracts text, chunks with hierarchy + metadata, computes embeddings in batches, and stores chunks + ACL/workspace_id in Postgres+pgvector (or dedicated vector DB). Queries enforce workspace/role ACLs BEFORE retrieval, combine vector + FTS + reranker, stream cited answers via SSE, and cache frequent queries.

Follow-up Interview Question · How do you re-index documents cleanly when upgrading your embedding model or chunking strategy?

Module Context & References

System Design · Widely asked design scenarios The 80/20 classic architecture prompts: requirements, data model, bottlenecks & tradeoffs
Personal Notes · Markdown

Technologies & Interview Topics Covered

Switch between short-term interview tracks and long-term 80/20 engineering depth to practice JavaScript internals, React rendering and hooks, timed frontend machine coding UI challenges, MeetaPro FG300, Blind 75 & NeetCode 150 DSA patterns, Python & FastAPI APIs, PostgreSQL query optimization & MVCC, Redis caching, Applied AI RAG pipelines & evaluations, and distributed system design.