EduCat - AI-Powered Note Revision Platform
EduCat is a modern web application that helps students improve their study notes using AI. Built with Node.js, Express, and EJS, it features secure file upload capabilities, AI-powered note revision, interactive quizzes, and an intelligent chatbot.
Features
🔐 Security & Authentication
- Secure login and registration system
- Session-based authentication with flash messages
- Password hashing with bcrypt
- Strict file type whitelisting for secure uploads
📁 Document Processing
- Upload notes in multiple formats (PDF, DOC, DOCX, XLSX, XLS, TXT, MD, JSON, CSV, XML)
- Secure document extraction with proper error handling
- File preview with extraction information and metadata
- Separate storage for original uploads and AI-revised notes
🤖 AI-Powered Features
- Note Revision: Automatically improve, summarize, and generate study questions
- Interactive Chatbot: Chat with AI for study assistance
- Quiz Generation: Create interactive quizzes from uploaded documents
- Smart Content Extraction: Extract text from various document formats
📊 Dashboard & Management
- Modern dashboard to manage uploaded files
- Separate sections for original files and AI-revised notes
- File preview with extraction status and metadata
- Download and delete functionality for all file types
🎯 Quiz System
- Generate quizzes from uploaded documents
- Multiple question types (multiple choice, true/false, short answer)
- Comprehensive quiz review with explanations
- Statistics tracking for quiz performance
🎨 Modern UI/UX
- Beautiful, responsive design with Bootstrap 5
- Custom SVG favicon and branded interface
- Improved file icons and visual indicators
- Mobile-friendly responsive layout
🔗 AI Integration
- Connected to Flowise at https://flowise.suika.cc/
- RAG (Retrieval-Augmented Generation) capabilities
- Secure API integration with proper error handling-Powered Note Revision Platform
EduCat is a modern web application that helps students improve their study notes using AI. Built with Node.js, Express, and EJS, it features file upload capabilities, AI-powered note revision, and an interactive chatbot.
Features
- <EFBFBD> User Authentication: Secure login and registration system
- <EFBFBD>📁 File Upload: Upload notes in various formats (PDF, DOC, TXT, images)
- 🤖 AI-Powered Revision: Automatically improve, summarize, and generate study questions
- 💬 Interactive Chatbot: Chat with AI for study assistance
- 📊 Dashboard: Manage and track your uploaded notes
- 🎨 Modern UI: Beautiful, responsive design with Bootstrap
- 🔗 Flowise Integration: Connected to Flowise at https://flowise.suika.cc/
Technologies Used
- Backend: Node.js, Express.js
- Frontend: EJS templates, Bootstrap 5, Font Awesome
- Authentication: bcrypt for password hashing, express-session
- File Handling: Multer for secure file uploads with type validation
- Document Processing:
- PDFParse for PDF extraction
- Mammoth for Word document processing
- ExcelJS for secure Excel file handling (replaced vulnerable xlsx)
- AI Integration: Flowise API integration with RAG capabilities
- Session Management: Express Session with flash messages
- Security: File type whitelisting, secure extraction methods
- Styling: Custom CSS with Bootstrap and custom SVG favicon
Installation
-
Clone the repository:
git clone <repository-url> cd EduCat -
Install dependencies:
npm installKey Dependencies:
express- Web frameworkejs- Template enginemulter- File upload handlingbcrypt- Password hashingexpress-session- Session managementpdf-parse- PDF text extractionmammoth- Word document processingexceljs- Secure Excel file handlingaxios- HTTP client for API calls
-
Configure environment variables:
- Copy
.env.exampleto.env(if exists) or create a new.envfile - Update the following variables:
PORT=3000 SESSION_SECRET=your-secret-key-here FLOWISE_API_URL=https://flowise.suika.cc/api/v1/prediction FLOWISE_CHATFLOW_ID=your-chatflow-id-here
- Copy
-
Set up your Flowise chatflow:
- Go to https://flowise.suika.cc/
- Create or find your chatflow
- Copy the chatflow ID and update it in the
.envfile
-
Start the application:
npm startFor development with auto-reload:
npm run dev -
Access the application:
- Open your browser and navigate to
http://localhost:3000
- Open your browser and navigate to
Usage
Authentication
- Visit
http://localhost:3000 - Click "Login" or "Register" to create an account
- Use demo accounts:
- Admin: username
admin, passwordpassword - Student: username
student, passwordpassword
- Admin: username
Uploading Notes
- After logging in, click "Upload Notes" in the navigation
- Drag and drop your file or click to browse
- Select a supported file type:
- Documents: PDF, DOC, DOCX
- Spreadsheets: XLSX, XLS
- Text Files: TXT, MD, JSON, CSV, XML
- Click "Upload & Process"
- View file preview with extraction information
Revising Notes
- Go to your Dashboard to see uploaded files
- Click "Revise with AI" on any file
- Choose revision type:
- Improve & Enhance: Makes notes more comprehensive
- Summarize: Creates concise summaries
- Generate Questions: Creates study questions
- Click "Revise with AI" to process
- Save and download revised notes from the "AI-Revised Notes" section
Quiz System
- Upload a document to generate quizzes from
- Navigate to the quiz section
- Take interactive quizzes with multiple question types
- Review answers with detailed explanations
- Track your quiz performance and statistics
Using the Chatbot
- Navigate to the "Chat" section
- Type your questions about study materials or academic topics
- Get instant AI-powered responses using RAG technology
Project Structure
EduCat/
├── public/
│ ├── css/
│ │ └── style.css
│ ├── js/
│ │ └── main.js
│ ├── images/
│ │ └── favicon.svg
│ ├── favicon.svg
│ └── favicon-32x32.svg
├── views/
│ ├── partials/
│ │ ├── header.ejs
│ │ └── footer.ejs
│ ├── index.ejs
│ ├── upload.ejs
│ ├── revise.ejs
│ ├── chat.ejs
│ ├── dashboard.ejs
│ ├── quiz.ejs
│ └── error.ejs
├── uploads/
│ └── revised-notes/
├── data/
│ ├── user-files/
│ ├── revised-files/
│ └── quiz-results/
├── server.js
├── package.json
└── .env
API Endpoints
Authentication & Core Routes
GET /- Home pageGET /login- Login pagePOST /login- Handle loginGET /register- Registration pagePOST /register- Handle registrationGET /logout- Logout user
File Management
GET /upload- File upload pagePOST /upload- Handle file uploads with validationGET /dashboard- User dashboard with file managementGET /api/files/:fileId/preview- File preview with extraction infoDELETE /api/files/:fileId- Delete uploaded file
AI-Powered Features
GET /revise/:fileId- Note revision pagePOST /api/revise- AI revision endpointPOST /api/save-revised- Save revised notesGET /api/download-revised/:fileId- Download revised notesGET /api/revised-files/:fileId/info- Get revised file infoDELETE /api/revised-files/:fileId- Delete revised file
Quiz System
GET /quiz- Quiz interfacePOST /api/quiz/generate- Generate quiz from documentPOST /api/quiz/submit- Submit quiz answersGET /api/quiz/results- Get quiz statistics
Chat Integration
GET /chat- Chat interfacePOST /api/chat- Chat API endpoint with RAG support
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 3000 |
SESSION_SECRET |
Session encryption key | educat-secret-key |
FLOWISE_API_URL |
Flowise API base URL | https://flowise.suika.cc/api/v1/prediction |
FLOWISE_CHATFLOW_ID |
Your Flowise chatflow ID | Required |
File Upload Settings
- Maximum file size: 10MB
- Allowed formats: PDF, DOC, DOCX, XLSX, XLS, TXT, MD, JSON, CSV, XML
- Upload directory:
uploads/(original files) - Revised notes directory:
uploads/revised-notes/ - Security: Strict file type whitelisting with MIME type validation
- Processing: Automatic text extraction with error handling
Customization
Styling
- Edit
public/css/style.cssto customize the appearance - The design uses Bootstrap 5 with custom CSS variables
- Custom SVG favicon and file icons for better visual consistency
- Responsive design optimized for mobile and desktop
AI Integration
- Modify the Flowise API calls in
server.js - Update prompts in the
/api/reviseendpoint - Customize chat responses in the
/api/chatendpoint - Configure RAG settings for document-based queries
Security
- File type restrictions configured in server.js and main.js
- MIME type validation for uploaded files
- Secure document extraction methods
- Session security with proper secret management
Adding Features
- Add new routes in
server.js - Create corresponding EJS templates in
views/ - Add client-side JavaScript in
public/js/main.js - Update CSS in
public/css/style.css
Troubleshooting
Common Issues
-
File upload fails:
- Check file size (max 10MB)
- Verify file format is supported (PDF, DOC, DOCX, XLSX, XLS, TXT, MD, JSON, CSV, XML)
- Ensure
uploads/anduploads/revised-notes/directories exist - Check file type validation in both client and server
-
Document extraction errors:
- Verify document is not corrupted
- Check extraction status in file preview
- Ensure proper permissions for file access
- Review server logs for specific extraction errors
-
AI responses don't work:
- Verify Flowise API URL is correct
- Check if your chatflow ID is valid
- Ensure Flowise server is accessible
- Verify RAG configuration for document-based queries
-
Quiz generation fails:
- Ensure document has sufficient text content
- Check if document extraction was successful
- Verify AI service is properly connected
- Review quiz generation prompts
-
Session issues:
- Verify SESSION_SECRET is set in .env
- Check if sessions are properly configured
- Clear browser cookies and try again
-
Revised notes not saving:
- Ensure
uploads/revised-notes/directory exists - Check file permissions
- Verify sufficient disk space
- Review server logs for save errors
- Ensure
Development
To run in development mode with auto-reload:
npm install -g nodemon
npm run dev
Recent Updates & Security Improvements
Version 2.0 Security Enhancements
- 🔒 Enhanced Security: Replaced vulnerable
xlsxlibrary with secureexceljsfor Excel processing - 🛡️ File Type Whitelisting: Implemented strict file type validation to prevent malicious uploads
- 🔍 MIME Type Validation: Added comprehensive file type checking on both client and server
- 🗂️ Secure Document Processing: Improved extraction methods with proper error handling
UI/UX Improvements
- 🎨 Custom Favicon: Added custom SVG favicon for brand consistency
- 📱 Responsive Design: Enhanced mobile-friendly interface with improved layouts
- 🔧 File Icons: Updated file type icons for better visual clarity
- 📊 Dashboard Enhancements: Separate sections for original and revised files
- 🏷️ Badge System: Improved status indicators and badge alignment
New Features
- 💾 Revised Notes Management: Save, download, and manage AI-revised notes separately
- 🎯 Enhanced Quiz System: Fixed short-answer questions with explanations
- 📈 Quiz Statistics: Comprehensive tracking of quiz performance
- 🔍 File Preview: Detailed extraction information and metadata display
- 📁 Persistent Storage: Improved file tracking and session management
Performance & Reliability
- ⚡ Optimized Extraction: Faster and more reliable document processing
- 🔄 Error Handling: Comprehensive error handling for all file operations
- 💪 Robust API: Improved API endpoints with better validation
- 🧹 Code Refactoring: Cleaner, more maintainable codebase
Deployment & Production
Production Considerations
- Set strong
SESSION_SECRETin production environment - Configure proper file upload limits based on server capacity
- Set up proper logging and monitoring
- Implement rate limiting for API endpoints
- Configure HTTPS for secure file uploads
- Set up backup procedures for uploaded files and data
Environment Setup
- Ensure Node.js 14+ is installed
- Create proper directory structure with correct permissions
- Configure environment variables for production
- Set up reverse proxy (nginx/Apache) if needed
- Configure SSL certificates for HTTPS
Monitoring & Maintenance
- Monitor disk space for uploads directory
- Set up log rotation for application logs
- Regular security updates for dependencies
- Monitor API usage and performance
- Backup user data and quiz results regularly
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
License
This project is licensed under the MIT License.
Support
For support or questions, please contact the EduCat development team.
Made with ❤️ by the EduCat Team