SideQuest is a RAG-based document intelligence system that allows users to upload documents and query them with AI-powered answers that feature narrative tone and inline citations.
The backend is built with FastAPI and handles document ingestion, vector storage, and AI-driven retrieval.
- main.py: The entry point of the API, configures middleware (CORS) and includes routers.
- requirements.txt: Lists all Python dependencies.
- upload.py: Handles file uploads, background processing, and initial status tracking.
- query.py: Orchestrates the RAG flow, from retrieval to LLM generation.
- documents.py: Provides endpoints for listing and deleting documents.
- init.py: Exports the routers for easy import in main.py.
- parser.py: Extracts text from PDF and DOCX files.
- chunker.py: Splits extracted text into manageable, overlapping tokens.
- embedder.py: Converts text chunks into mathematical vectors using Gemini.
- database.py: Manages SQLite connection and SQLAlchemy sessions.
- models.py: Defines the database schema for document metadata.
- status_manager.py: Tracks the lifecycle of document processing (processing, completed, failed).
- vector_store.py: Interacts with ChromaDB for saving and searching chunks.
- retriever.py: Performs semantic searches filtered by user_id and document_id.
- prompt_builder.py: Constructs the final narrative-style prompt for the LLM.
- llm_client.py: Wraps the Gemini API for answering questions based on context.
The frontend is a Next.js application designed with a premium, glassmorphic UI.
- src/auth.ts: Configures NextAuth for session management and JWT strategy.
- src/middleware.ts: Protects routes and ensures only authenticated users can access the dashboard.
- src/utils/api.ts: Axios-based client for communicating with the backend API.
- layout/Shell.tsx: The main application layout, handling the sidebar and user session.
- views/Library.tsx: The document management view (uploading, listing, deleting).
- views/Chat.tsx: The AI chat interface with markdown rendering and history.
- src/app/globals.css: Global CSS variables and glassmorphism definitions.
- src/components//*.module.css**: Scoped styles for individual components.
The project is configured for a professional cloud environment:
- render.yaml: Defines the backend infrastructure (FastAPI on Render.com).
- Persistent Storage: Uses Render Disks to persist the SQLite database and ChromaDB vectors.
- Environment Driven: All URLs and secrets are managed via environment variables on Render and Vercel.