Transform Your Study Experience with AI-Powered Document Analysis
UniDash lets you upload PDFs, chat with an AI that understands your content, and autoβgenerate spacedβrepetition flashcards from your documents. It ships with a modern React UI and a Node.js/Express backend powered by MongoDB, LangChain, Gemini, and Pinecone.
UniDash is an intelligent study assistant that revolutionizes how students interact with their academic materials. Upload PDFs, chat with AI that understands your content, and auto-generate spaced-repetition flashcards from your documents. Built with modern technologies and powered by advanced RAG (Retrieval Augmented Generation) capabilities.
- π§ AI Chat Interface: Ask questions about your documents and get instant, contextual answers
- π PDF Processing: Advanced document parsing, chunking, and vector storage
- π΄ Smart Flashcards: AI-generated flashcards with spaced repetition and progress tracking
- π Secure Authentication: JWT-based auth with Firebase integration
- β‘ Lightning Fast: Optimized RAG system with real-time responses
- π¨ Beautiful UI: Modern design with Tailwind CSS and Framer Motion
Transform your study materials into an interactive learning experience. Our advanced RAG system understands context and provides accurate, grounded responses from your uploaded documents.
Interactive chat interface with contextual responses from your documents
Upload and manage your academic PDFs with ease. Support for research papers, textbooks, lecture notes, and more with automatic processing and indexing.
Drag-and-drop interface with real-time processing status
Automatically generate high-quality flashcards from your documents using AI. Features include:
- Smart Content Extraction: AI identifies key concepts and definitions
- Difficulty Levels: Easy, medium, and hard questions
- Spaced Repetition: Optimized review scheduling
- Progress Tracking: Detailed analytics and performance metrics
AI-powered flashcard creation from document content
Comprehensive study experience with interactive flashcards, progress tracking, and detailed statistics to optimize your learning.
Interactive study interface with flip animations and progress tracking
Organize your conversations with document-specific chat sessions, search functionality, and conversation management.
Chat history with search and organization features
Multi-layered security with JWT tokens, HTTP-only cookies, and Firebase integration for Google Sign-In.
Secure login interface with multiple authentication options
- React 19 - Modern UI library with latest features
- Vite 7 - Lightning-fast build tool and dev server
- Tailwind CSS 4 - Utility-first CSS framework
- Framer Motion 12 - Production-ready motion library
- React Router 7 - Declarative routing
- TanStack Query 5 - Powerful data fetching
- Radix UI - Accessible component primitives
- Lucide Icons - Beautiful icon library
- Node.js - JavaScript runtime environment
- Express 5 - Fast, minimalist web framework
- MongoDB - NoSQL database with Mongoose ODM
- JWT - Secure authentication tokens
- Multer - File upload handling
- CORS - Cross-origin resource sharing
- LangChain - Framework for developing AI applications
- Google Gemini AI - Advanced language model for chat and embeddings
- Pinecone - Vector database for semantic search
- RAG (Retrieval Augmented Generation) - Context-aware AI responses
- JWT (JSON Web Tokens) - Stateless authentication
- Firebase Admin - User management and Google Sign-In
- HTTP-Only Cookies - Secure token storage
- CORS Protection - Cross-origin request security
UniDash follows a modern full-stack architecture with clear separation of concerns:
graph TB
A[React Frontend] -->|HTTP Requests| B[Express Backend]
B -->|JWT Auth| C[MongoDB]
B -->|Vector Storage| D[Pinecone DB]
B -->|AI Processing| E[Google Gemini]
B -->|File Storage| F[Local/Cloud Storage]
B -->|Authentication| G[Firebase Admin]
subgraph "RAG Pipeline"
H[PDF Upload] --> I[Text Extraction]
I --> J[Chunking]
J --> K[Embeddings]
K --> L[Vector Storage]
end
- Document Processing: PDFs are uploaded, parsed, chunked, and converted to embeddings
- Vector Storage: Embeddings stored in Pinecone with user-specific namespaces
- Query Processing: User questions are embedded and used for similarity search
- Response Generation: Relevant context is passed to Gemini AI for response generation
- Flashcard Creation: AI analyzes document content to generate educational flashcards
UniDash/
client/ # React app (Vite)
src/
Api/ # Axios wrappers for backend endpoints
components/ # Reusable UI (Chat, Upload, Flashcards, etc.)
contexts/ # Auth context
pages/ # Route pages: home, login, signup, dashboard, flashcards
firebase.js # Client Firebase config (used for Google sign-in)
package.json
vite.config.js
server/ # Express API
controllers/ # Route handlers
authController.js
userController.js
uploadController.js
queryController.js
firebaseController.js
chatController.js
messageController.js
flashCardController.js
flashCardSetController.js
models/ # Mongoose schemas
user.js
Document.js
Chat.js
Message.js
FlashCard.js
FlashCardSet.js
config/ # Integrations
dbconfig.js # Mongo connection
firebaseAdmin.js # Firebase Admin init (service account)
pinecone.js # Pinecone init + index helpers
utils/
langchain.js # RAG service: PDF -> chunks -> embeddings -> Pinecone; query + flashcards
app.js # Express middleware + route mounting
server.js # Server bootstrap + Pinecone init + uploads dir
uploads/ # Uploaded PDFs (local dev)
package.json
-
Upload a PDF
uploadController
stores the file and aDocument
recordRAGService.processDocument
loads PDF, splits into chunks, creates Gemini embeddings, and stores them in Pinecone (namespaced per user)
-
Ask a question in Chat
- Client posts
/api/query
with{ query, userId }
RAGService.queryDocuments
retrieves topβK chunks from Pinecone, constructs a prompt, invokes Gemini chat, and returns a grounded answer with quick source previews- The conversation is stored as
Message
items linked to aChat
- Client posts
-
Generate Flashcards
- Client posts
/api/flashcards/generate
with{ documentId, userId }
RAGService.generateFlashCards
selects diverse chunks, prompts LLM, regexβparses Q/A pairs, validates and saves toFlashCard
- A
FlashCardSet
is automatically created with the generated cards
- Client posts
-
Study Mode
- Interactive flipping cards, correctness tracking, spacedβrepetition stats, and study session logging per
FlashCardSet
- Interactive flipping cards, correctness tracking, spacedβrepetition stats, and study session logging per
- Node.js (v18 or higher)
- MongoDB (local or cloud instance)
- Google AI API Key (for Gemini AI)
- Pinecone Account (for vector storage)
- Firebase Project (optional, for Google Auth)
git clone https://github.com/yourusername/unidash.git
cd unidash
cd server
npm install
Create .env
file in the server directory:
# Server Configuration
PORT=4000
NODE_ENV=development
# Database
MONGO_URL=mongodb://localhost:27017/unidash
# Authentication
JWT_SECRET=your_super_secret_jwt_key_here
# AI & Vector Database
GOOGLE_API_KEY=your_google_ai_api_key
PINECONE_API_KEY=your_pinecone_api_key
PINECONE_INDEX_NAME=unidash-index
# File Upload
UPLOAD_DIR=uploads
MAX_FILE_SIZE=10485760
cd ../client
npm install
- Create a Firebase project at Firebase Console
- Enable Authentication with Google Sign-In
- Download service account key and place it at
server/config/firebaseServiceAccountKey.json
- Update
client/src/firebase.js
with your Firebase config
- Create account at Pinecone
- Create a new index with:
- Dimensions: 768 (for Gemini embeddings)
- Metric: cosine
- Environment: as per your plan
Backend (Terminal 1):
cd server
npm start
Frontend (Terminal 2):
cd client
npm run dev
- Frontend: http://localhost:5173
- Backend API: http://localhost:4000
# 1) Backend
cd server
npm install
npm start
# 2) Frontend (new terminal)
cd ../client
npm install
npm run dev
# App
# Frontend: http://localhost:5173
# Backend: http://localhost:4000
Vite dev server proxies API calls to http://localhost:4000
(see client/package.json
). CORS in server/app.js
allows http://localhost:5173
and http://localhost:5174
.
Base URL: /api
POST /auth/signup
β email/password signupPOST /auth/login
β email/password login, sets JWT cookiePOST /auth/logout
β clears JWT cookiePOST /firebase-login
β login with Firebase ID token (sets JWT cookie)
GET /user/get-logged-user
β returns current user (JWT required)PUT /user/update-profile
β updatefirstname
,lastname
(JWT required)
POST /upload
β multipart upload: fieldfile
(PDF), bodyuserId
GET /documents/:userId
β list user documents (no file paths exposed)DELETE /documents/:documentId
β delete a document (bodyuserId
)DELETE /documents/:userId
β delete all vectors for user from Pinecone (body{ confirmDelete: true }
)
POST /query
β{ query, userId }
β grounded answer and quick source previewsGET /stats/:userId
β vector stats (totalVectors
) for the user namespace
GET /chats/:userId
β list chats (pagination)GET /chats/:userId/stats
β totals for chats/messages/queries + recent activityGET /chats/:userId/:chatId
β fetch a chatPOST /chats
β create chat{ userId, name, description? }
PUT /chats/:chatId
β update chat{ userId, name?, description? }
DELETE /chats/:chatId
β delete chat and all messages (bodyuserId
)
GET /messages/:chatId
β list messages (pagination)POST /messages
β create message{ chatId, userId, content, role, messageType?, metadata? }
DELETE /messages/:messageId
β delete a message (bodyuserId
)GET /messages/search/:userId
β search by content (optionalchatId
)
GET /flashcards/health
β health checkPOST /flashcards/generate
β{ documentId, userId, options? }
β creates 1 set with up to 6 cardsGET /flashcards/user/:userId
β list user cards (filters, pagination)GET /flashcards/stats/:userId
β aggregated stats (accuracy, totals, distribution)GET /flashcards/:cardId?userId=...
β fetch a cardPUT /flashcards/:cardId
β update a card (Q/A, tags, difficulty, bookmark)DELETE /flashcards/:cardId
β soft deletePOST /flashcards/:cardId/review
β record a review{ userId, isCorrect, responseTime }
POST /flashcard-sets
β create setGET /flashcard-sets/user/:userId
β list sets (filters, pagination)GET /flashcard-sets/:setId?userId=...
β fetch a setPUT /flashcard-sets/:setId
β update set (name, description, tags, settings, bookmark)POST /flashcard-sets/:setId/cards
β add cards to setDELETE /flashcard-sets/:setId/cards
β remove cards from setDELETE /flashcard-sets/:setId
β soft delete setPOST /flashcard-sets/:setId/study-session
β log study session summary
Users
β profile and email/password hash (password optional if logging in via Firebase)Document
β upload metadata and processing statusChat
β chat sessions per userMessage
β message items linked to chats (role: user/assistant)FlashCard
β question/answer, difficulty, review statsFlashCardSet
β collection of cards, tags, study settings, and setβlevel stats
# Login
curl -X POST http://localhost:4000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "secret"}' -i
# Upload a PDF
curl -X POST http://localhost:4000/api/upload \
-F "file=@/path/to/file.pdf" \
-F "userId=USER_ID"
# Ask a question
curl -X POST http://localhost:4000/api/query \
-H "Content-Type: application/json" \
-d '{"query": "Explain attention", "userId": "USER_ID"}'
# Generate flashcards for a document
curl -X POST http://localhost:4000/api/flashcards/generate \
-H "Content-Type: application/json" \
-d '{"documentId":"DOC_ID","userId":"USER_ID"}'
- JWT Tokens: Stateless authentication with HTTP-only cookies
- Password Hashing: bcrypt with salt rounds
- Route Protection: Middleware-based access control
- CORS Configuration: Restricted cross-origin requests
- User Data Isolation: Namespace-based vector storage
- Secure File Storage: Protected upload directory
- Session Management: Automatic token expiration
This project is licensed under the MIT License - see the LICENSE file for details.