StudyBuddy AI is a Next.js application that helps students study more efficiently by processing documents (PDFs, DOCX, TXT) and creating flashcards, quizzes, and concept summaries using RAG (Retrieval Augmented Generation).
- 📄 Upload and process academic documents
- 🔍 Extract key concepts and information
- 🧠 Generate flashcards for effective studying
- 📝 Create quizzes to test understanding
- 📊 Track progress and identify areas for improvement
This project now uses MongoDB (instead of PostgreSQL) for data storage, providing:
- 🚀 Simpler setup and maintenance
- 🔄 Flexible schema for evolving data models
- 🔍 Built-in vector search capabilities (via MongoDB Atlas)
- 🔗 Native integration with Node.js applications
- Node.js (v16+)
- MongoDB Atlas account (free tier is sufficient)
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/yourusername/StudyBuddy-ai.git cd StudyBuddy-ai -
Install dependencies
npm install --legacy-peer-deps
-
Configure MongoDB
Follow the instructions in MONGODB_SETUP.md to set up your MongoDB Atlas database with vector search capabilities.
-
Environment Variables
Create a
.env.localfile in the project root with:DATABASE_URL="mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<dbname>?retryWrites=true&w=majority"Replace the placeholders with your actual MongoDB connection details.
-
Run the application
npm run dev
Access the application at http://localhost:3000
- User uploads a document through the UI
- Backend processes the document:
- Saves file temporarily
- Loads and parses content
- Splits content into manageable chunks
- Generates embeddings for each chunk
- Stores document metadata and chunks in MongoDB
- The stored documents are available for search and used to generate flashcards, quizzes, and concept summaries
To test the document processing API:
- Use Postman or a similar tool to send a POST request to
/api/process-document - Set the request body to
form-dataformat - Add a key
filewith a file as the value (PDF, DOCX, or TXT) - Optionally add a
userIdkey if you have authentication set up - Send the request and check the response
Example response:
{
"success": true,
"message": "Document processed and ingested successfully.",
"documentId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"fileName": "your-document.pdf",
"flashcards": [...],
"quizzes": [...]
}- Next.js
- MongoDB Atlas
- LangChain
- HuggingFace Transformers