An AI-powered SaaS platform for academic writing. Features a custom Retrieval-Augmented Generation (RAG) pipeline to let researchers chat with their papers and generate cited abstracts without hallucination
Next.jsReactTypeScriptJavaSpring BootPythonFastAPIPostgreSQLpgvectorRedisOpenAI API
No comments yet. Be the first to share your thoughts!
Leave a Comment
ScholarAI is a full-stack, microservice-based SaaS platform designed specifically for academic and research writing. It leverages a custom Retrieval-Augmented Generation (RAG) pipeline to allow researchers to upload their papers (PDF, DOCX, TXT, MD), embed them in a vector database, and chat with an AI assistant that answers questions grounded strictly in the user's own documents—complete with inline citations and no hallucinated references.
🏗️ Microservice Architecture
The platform is designed with security and scalability in mind, using an API Gateway pattern:
Frontend (Next.js 16): Built with the App Router, TypeScript, TanStack Query, and Tailwind CSS. It
communicates strictly with the Spring API using HTTP-only cookies and CSRF protection.
API Gateway (Spring Boot 3.5): Acts as the public-facing backend. It handles JWT authentication, OAuth2,
database transactions (PostgreSQL), and orchestrates the AI service.
AI Service (FastAPI / Python): An internal, private service that runs the RAG engine. It handles document parsing, chunking, OpenAI embeddings (text-embedding-3-small), vector retrieval, and AI writing tools. It is never exposed publicly and communicates with Spring via a secure X-Internal-Service-Token.
✨ Key Features
Grounded RAG Chat: Ask questions about your documents and receive answers with precise citations (document name, page number, quote, similarity score). The AI is prompted to refuse answers when evidence in the text is weak.
AI Writing Tools: Tunable tools to generate outlines, abstracts, and summaries, or extract paper insights based on desired tone (Academic/Simple/Formal) and length.
Asynchronous Document Ingestion: Uploaded files are parsed, chunked, and embedded into a pgvector
database asynchronously, with real-time status tracking (PROCESSING → READY / FAILED).
Robust Security: Email/password (BCrypt) and Google OAuth2 login, with JWT access tokens and rotating
refresh tokens stored in HTTP-only cookies.
Usage Tracking: Granular tracking of AI model calls and token usage (input/output) on a per-user basis.
🗄️ Database & Infrastructure
Data is managed via PostgreSQL 16 with the pgvector extension to store both relational data (users,
projects, documents) and 1536-dimensional vector embeddings within the same database using an IVFFlat cosine index.
Redis is utilized for high-speed caching and session management.