- Description
- Tech Stack
- Architecture
- Quick Start
- Key Dependencies
- Available Scripts
- Project Structure
- Development Setup
- Contributors
- Contributing
An AI-powered learning platform that transforms PDFs into an interactive study experience using Retrieval-Augmented Generation (RAG).
A high-level view of how the main pieces fit together:
flowchart LR
User["π€ User / Browser"]
FE["πΌοΈ React + Vite Frontend"]
API["π Express.js API Server"]
Auth["π JWT Authentication"]
Mongo["π MongoDB"]
Cloud["βοΈ Cloudinary\n(PDF Storage)"]
Queue["π¬ BullMQ Queue"]
Redis["β‘ Redis"]
Worker["βοΈ Background Worker"]
Parse["π PDF Parser"]
Embed["π§ Embedding Generator"]
Pinecone["π Pinecone Vector DB"]
OpenAI["π€ OpenAI API"]
User --> FE
FE --> API
API --> Auth
API --> Mongo
API --> Cloud
API --> Queue
Queue --> Redis
Redis --> Worker
Worker --> Parse
Parse --> Embed
Embed --> OpenAI
Embed --> Pinecone
FE -->|"Chat with PDF"| API
API --> Pinecone
API --> OpenAI
API --> Mongo
API --> FE
LearnWithAI allows users to upload PDF documents and instantly interact with them using AI. Instead of reading hundreds of pages manually, users can:
- π¬ Chat with their PDFs
- π Generate AI summaries
- π― Create flashcards
- β Generate quizzes
- π Take smart notes
Large PDF processing is handled asynchronously using BullMQ and Redis, ensuring the application remains fast and responsive.
- Upload PDFs securely
- Cloudinary storage
- View uploaded PDFs
- Delete PDFs
- Processing status tracking
- Chat with PDF using RAG
- AI-generated summaries
- Flashcard generation
- Quiz generation
- Context-aware responses
- Semantic document search
- JWT Authentication
- Secure HTTP-only cookies
- Protected routes
- User-specific documents
PDF processing runs in the background:
- Text extraction
- Text chunking
- Embedding generation
- Pinecone indexing
- Status updates
This prevents long upload requests and improves scalability.
Upload PDF
β
βΌ
Express Backend
β
βΌ
Store PDF in Cloudinary
β
βΌ
Save Metadata in MongoDB
β
βΌ
Create BullMQ Processing Job
β
βΌ
Redis Queue
β
βΌ
Background Worker
β
βΌ
Extract PDF Text
β
βΌ
Split into Chunks
β
βΌ
Generate OpenAI Embeddings
β
βΌ
Store Embeddings in Pinecone
β
βΌ
PDF Ready for Chat
User Question
β
βΌ
Generate Query Embedding
β
βΌ
Search Similar Chunks
β
βΌ
Retrieve Context
β
βΌ
Send Context + Prompt
β
βΌ
OpenAI Response
β
βΌ
Answer Returned to User
# 1. Clone the repository
git clone https://github.com/Garv978/LEARNBYAI.git
# 2. Install dependencies
npm install
# 3. Start the dev server
npm run devreact: ^19.2.7
react-dom: ^19.2.7
react-router-dom: ^7.18.1
axios: ^1.18.1
jwt-decode: ^4.0.0
lucide-react: ^1.24.0
tailwindcss: ^4.3.2
@tailwindcss/vite: ^4.3.2
express
mongoose
jsonwebtoken
bcryptjs
cookie-parser
cors
dotenv
helmet
morgan
express-rate-limit
express-fileupload
cloudinary
multer
streamifier
http-status-codes
openai
langchain
@langchain/openai
@langchain/community
@langchain/textsplitters
@langchain/pinecone
@pinecone-database/pinecone
pdf-parse
bullmq
ioredis
zod
nodemon
eslint
vite
- dev β
npm run dev - build β
npm run build - lint β
npm run lint - preview β
npm run preview
.
βββ client
β βββ eslint.config.js
β βββ index.html
β βββ package.json
β βββ public
β β βββ favicon.svg
β β βββ icons.svg
β βββ src
β β βββ App.css
β β βββ App.jsx
β β βββ api.js
β β βββ components
β β β βββ HeroSection.jsx
β β β βββ Navbar.jsx
β β β βββ Pdfnavbar.jsx
β β β βββ Sidebar.jsx
β β βββ context
β β β βββ AuthContext.jsx
β β βββ index.css
β β βββ layouts
β β β βββ PdfLayout.jsx
β β β βββ UserLayout.jsx
β β βββ main.jsx
β β βββ pages
β β β βββ Dashboard.jsx
β β β βββ ForgotPassword.jsx
β β β βββ Home.jsx
β β β βββ Login.jsx
β β β βββ NotFound.jsx
β β β βββ PdfList.jsx
β β β βββ Register.jsx
β β β βββ ResetPassword.jsx
β β β βββ VerifyEmail.jsx
β β β βββ pdf
β β β βββ Chat.jsx
β β β βββ Flashcards.jsx
β β β βββ Notes.jsx
β β β βββ Quiz.jsx
β β β βββ Summary.jsx
β β βββ services
β β β βββ AuthServices.js
β β βββ utils
β β βββ ProtectedRoute.jsx
β βββ vite.config.js
βββ server
βββ api.js
βββ app.js
βββ config
β βββ cloudinary.js
β βββ redis.js
βββ controllers
β βββ authController.js
β βββ pdfController.js
β βββ userController.js
βββ db
β βββ connect.js
βββ errors
β βββ bad-request.js
β βββ custom-api.js
β βββ index.js
β βββ not-found.js
β βββ unauthenticated.js
β βββ unauthorized.js
βββ middleware
β βββ authentication.js
β βββ error-handler.js
β βββ not-found.js
β βββ upload.js
βββ models
β βββ Pdf.js
β βββ Token.js
β βββ User.js
βββ package.json
βββ queues
β βββ pdfQueue.js
βββ routes
β βββ authRoutes.js
β βββ pdfRoutes.js
β βββ userRoutes.js
βββ utils
β βββ checkPermissions.js
β βββ createTokenUser.js
β βββ index.js
β βββ jwt.js
β βββ sendEmail.js
βββ workers
βββ pdfworker.js
- Install Node.js (v18+ recommended)
- Install dependencies:
npm install(oryarn/pnpm install/bun install) - Start the dev server: see the Quick Start above
Thanks to everyone who has contributed to this project:
See the full list of contributors β
Contributions are welcome! Here's the standard flow:
- Fork the repository
- Clone your fork:
git clone https://github.com/Garv978/LEARNBYAI.git - Branch:
git checkout -b feature/your-feature - Commit:
git commit -m 'feat: add some feature' - Push:
git push origin feature/your-feature - Open a pull request
Please follow the existing code style and include tests for new behavior where applicable.