Developer Guide

AskDoc Documentation

AskDoc is a production-grade Retrieval-Augmented Generation (RAG) intelligence platform powered by Google Gemini, Pinecone vector search, Supabase PostgreSQL, and LangGraph.

Quick Start Command Line

# 1. Clone the repository
git clone https://github.com/DJ-InfinityCoder/RAG.git
cd RAG

# 2. Setup & Start Backend (FastAPI + LangGraph)
cd RagBackend
python -m venv venv
.\venv\Scripts\activate   # On Linux/macOS: source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload --port 8000

# 3. Setup & Start Frontend (Next.js 16 App Router)
cd ../RagFrontend
npm install
npm run dev

System Architecture

The application is decoupled into modular layers for maximum reliability, speed, and clean code organization:

Frontend (Next.js 16)

  • App Router, Server Components & Suspense
  • Tailwind CSS design system with Dark/Light theme
  • SSE Streaming token reader with real-time UI updates
  • SWR for client-side caching & optimistic mutations

Backend (Modular FastAPI)

  • 7-layer architecture (app/api, app/core, app/services)
  • Document parsers (PDF with OCR, DOCX, PPTX, XLSX, CSV)
  • FlashRank reranker for high-precision context filtering
  • In-memory sliding-window rate limiter & query caching

Storage & Vector Database

  • Pinecone Serverless Index (1024-dim Llama embeddings)
  • Supabase PostgreSQL for full-text search & chat memory
  • Supabase Storage for secure multi-format document hosting
  • PostgresSaver checkpointer for LangGraph state persistence

Security & Auth

  • Supabase JWT token verification (HS256)
  • User-isolated namespaces in Pinecone and PostgreSQL
  • Cascade deletion across vector DB, storage bucket & SQL
  • Strict 10MB file size boundary checks

Environment Variables

Backend Configuration (RagBackend/.env)
GOOGLE_API_KEYGoogle Gemini API key for chat synthesis and generation
PINECONE_API_KEYPinecone vector database API key
DATABASE_URLPostgreSQL connection string (Supabase)
ALLOWED_ORIGINSComma-separated CORS origins (e.g. https://askdoc.dilip.website)
GEMINI_MODELActive Gemini model (default: gemini-3.6-flash)

Observability & LangSmith

AskDoc natively streams telemetry and trace metadata directly to LangSmith dashboards:

Traced Nodes: classify_intent, rephrase_query, retrieve, rerank, grade_retrieval, generate_answer.

Filterable Tags: session:{id}, user:{id}, askdoc-streaming.

Support & Contact

Have questions, suggestions, or need help deploying AskDoc in your organization?

contact@dilip.website