_____ _ _ ___ _____ / ____| | | | | / _ \|_ _| | (___ ___| |__ ___ | | __ _ _ __ | |_| | | | \___ \ / __| '_ \ / _ \| |/ _` | '__| | _ | | | ____) | (__| | | | (_) | | (_| | | | | | |_| |_ |_____/ \___|_| |_|\___/|_|\__,_|_| \_| |_|_____|
ScholarAI Learning Platform
Intelligent Academic Assistant & Learning Management System
Welcome to the official repository for the ScholarAI Learning Platform. This comprehensive system leverages cutting-edge generative AI to deliver an unparalleled educational experience for students and robust analytics for educators.
๐ Table of Contents
- Executive Summary
- Developer Story
- Project Information
- System Architecture
- Folder Structure
- Core Features & Modules
- API Documentation
- Database Schema Definition
- Deployment Guide
- Configuration Management
- Security & Privacy Standards
- Scalability Considerations
- Testing Documentation
- Troubleshooting Guide
- Performance Optimization
- System Requirements
- Contributing Guidelines
- Code of Conduct
- Contributors
- Acknowledgments
- FAQs
- License
๐ Executive Summary
ScholarAI Learning Platform is a state-of-the-art, AI-powered Learning Management System designed to revolutionize the educational experience. By integrating advanced generative AI, real-time analytics, and an intuitive user interface, ScholarAI bridges the gap between traditional learning paradigms and futuristic educational models.
The platform offers personalized learning pathways, intelligent tutoring, automated assessments, and comprehensive progress tracking. It aims to eliminate a "one size fits all" approach by providing dynamic content generation that adapts to individual student needs, learning velocities, and cognitive styles.
This repository contains the full source code for both the frontend client and the backend server, providing a complete, ready-to-deploy enterprise-grade solution that conforms to modern cloud-native standards.
๐งโ๐ป Developer Story
Why We Built It
In the rapidly evolving landscape of education, static learning materials and rigid curricula are no longer sufficient. We observed a growing need for adaptive, intelligent systems capable of personalizing the learning journey for every student. Traditional LMS platforms often act merely as digital file cabinets, failing to engage the student actively.
We built ScholarAI to democratize access to high-quality, personalized tutoring and to empower educators with deep insights into student performance. Our goal was to create a platform that not only delivers content but actively engages with the learner, adapting to their pace, style, and knowledge gaps through conversational AI.
Who We Are
We are a dedicated team of student developers and aspiring software engineers working on this platform as a comprehensive semester project. Our diverse skill sets allowed us to tackle complex problems across the full stack.
- Godfrey: Lead Architect & Backend Developer. Designed the core API architecture, database schemas, and AI service integrations.
- Grish Narayanan S: Frontend Lead & UI/UX Specialist. Spearheaded the React/Vite migration and crafted the platform's visual identity.
- Girijesh: Database Administrator & Security Engineer. Ensured robust Mongoose validations, indexing strategies, and security protocols.
- Harihar: AI Integration Specialist & QA Lead. Perfected prompt engineering pipelines and managed the testing infrastructure.
Challenges Faced
Building a platform of this magnitude within a semester timeframe presented numerous challenges:
- AI Latency & Rate Limiting: Integrating Google GenAI seamlessly required sophisticated caching and queuing mechanisms. During peak testing, we encountered API rate limits which forced us to implement exponential backoff strategies and local redis-like caching layers.
- Real-time Analytics: Implementing efficient data aggregation pipelines in MongoDB to feed the Recharts frontend without compromising database performance was computationally expensive.
- State Management Complexity: Managing complex, interdependent states in React for the interactive learning modules required careful architectural planning. Transitioning from Context API to a more robust state management approach was necessary as the app scaled.
- Security vs. Usability: Balancing robust security measures (authentication, input validation, data encryption) with a frictionless user experience demanded continuous iteration.
How We Built It
We adopted an Agile methodology, breaking down the project into rigorous two-week sprints. We started with a robust system design phase, establishing our RESTful API contracts and database schemas before writing a single line of code.
We utilized a modern MERN-like stack (MongoDB, Express, React, Node.js) but replaced the standard Create React App setup with Vite for vastly improved build times, hot module replacement, and overall developer experience. TypeScript was strictly enforced across both the frontend and backend to catch errors at compile-time, enforce interface contracts, and provide excellent IDE support.
Security & UX
Security was treated as a first-class citizen. We implemented robust CORS policies, parameterized database queries to prevent NoSQL injection, and secure environmental variable management for all API keys and secrets. Passwords are never stored in plaintext, utilizing bcrypt hashing algorithms. UX (User Experience) was meticulously crafted. We utilized responsive design principles, ensuring the platform is fully functional across desktop, tablet, and mobile devices. Micro-animations, skeleton loaders, and clear loading states were implemented to provide constant feedback to the user, masking complex backend operations.
Key Learnings
- TypeScript is Invaluable: The initial overhead of defining types paid massive dividends in reducing runtime errors and improving code maintainability. Refactoring became significantly safer.
- AI Integration requires Guardrails: Raw LLM outputs can be unpredictable. We learned to design strict prompts and implement post-processing layers to ensure the AI's responses are consistently accurate, pedagogically sound, and free from hallucinations.
- Database Indexing Matters: As our dataset grew during testing, we quickly learned the importance of proper MongoDB indexing. Queries that took 200ms were reduced to 15ms after implementing compound indexes on frequently queried fields.
Future Roadmap
- Phase 2 (Q3 2026): Implementation of real-time collaborative workspaces using WebSockets (Socket.io), allowing students to study together simultaneously.
- Phase 3 (Q4 2026): Integration of advanced predictive analytics using dedicated machine learning models (Python microservices) to identify at-risk students before they fail assessments.
- Phase 4 (Q1 2027): Native mobile application release utilizing React Native, sharing business logic with the web client.
Developer Message
"Building ScholarAI has been an incredible journey of discovery and technical growth. We've poured our passion for technology and education into this project, navigating late nights of debugging and the thrill of seeing our AI tutor respond accurately for the first time. We hope this repository serves as a robust foundation for future innovations in EdTech. We welcome contributions, feedback, and forks. Happy coding!" โ The ScholarAI Team
๐ Project Information
| Category | Details |
|---|---|
| Project Name | ScholarAI-LearningPlatform |
| Tagline | The Intelligent Academic Assistant & Learning Management System |
| Project Type | Web Application / SaaS Platform / AI System |
| Industry Domain | EdTech (Educational Technology) |
| Target Audience | Students, Educators, Academic Institutions |
| Primary Purpose | To provide an AI-driven, adaptive learning environment with real-time analytics. |
| Team Members | Godfrey, Grish Narayanan S, Girijesh, Harihar |
| Status | Active Development / Beta |
| License | MIT License |
Technology Stack Breakdown
Frontend Technologies
- React 19: Core UI library for building component-driven interfaces.
- Vite: Next-generation frontend tooling for rapid development and optimized builds.
- TypeScript (~5.8): Static typing to ensure robust code quality.
- Recharts: Composable charting library built on React components for rendering analytics dashboards.
- Tailwind CSS (or Vanilla CSS based on preference): Utility-first styling for rapidly building custom designs without leaving the HTML.
Backend Technologies
- Node.js: Asynchronous event-driven JavaScript runtime environment.
- Express.js (v5.2.1): Fast, unopinionated, minimalist web framework for Node.js.
- Mongoose (v9.1.3): Elegant MongoDB object modeling for Node.js providing strict schema validations.
- Body-Parser & CORS: Middleware for handling incoming request bodies and Cross-Origin Resource Sharing.
External Services & APIs
- Google GenAI SDK (
@google/genaiv1.29.0): The core intelligence engine powering the tutoring and content generation features. - MongoDB Atlas: Managed cloud database service ensuring high availability and automated backups.
๐ System Architecture
ScholarAI employs a robust, scalable, and decoupled client-server architecture designed to handle thousands of concurrent users.
High-Level Architecture
LANG: mermaidgraph TD Client[Client Browser\nReact + Vite + Recharts] -->|HTTPS / REST API| API[API Gateway\nExpress.js] API -->|Routing| Controllers[Controllers\nBusiness Logic] Controllers -->|Database Operations| DB[(MongoDB\nMongoose)] Controllers -->|AI Requests| GenAI[Google GenAI API] subgraph Frontend Client Client end subgraph Backend Microservices API Controllers end subgraph Third-Party Providers DB GenAI end
Component Diagram
LANG: mermaidgraph LR subgraph Client Application UI[React Components] --> State[Redux / Context State] State --> API_Client[Axios/Fetch Wrapper] API_Client --> Router[React Router DOM] end subgraph Node.js Server Application Router_Srv[Express Router] --> AuthMid[JWT Auth Middleware] AuthMid --> Validate[Joi Validation] Validate --> Services[Domain Services] Services --> Repositories[Data Access Layer] end API_Client -->|HTTP JSON Requests| Router_Srv
Workflow & Sequence Diagrams
AI Tutor Query Sequence
This sequence diagram illustrates the complex flow when a user asks the AI Tutor a contextual question, demonstrating the interaction between the client, backend validation, Google's AI services, and database logging.
LANG: mermaidsequenceDiagram participant User participant ReactUI as Frontend Client participant ExpressAPI as Node.js Backend participant GoogleAI as Google GenAI SDK participant MongoDB as Database Cluster User->>ReactUI: Submits Query (e.g., "Explain Quantum Entanglement") ReactUI->>ReactUI: Sanitizes Input & Triggers Loading State ReactUI->>ExpressAPI: POST /api/v1/ai/query { text, contextId } rect rgb(240, 248, 255) Note over ExpressAPI: Authentication & Rate Limiting Phase ExpressAPI->>ExpressAPI: Verify JWT Token ExpressAPI->>ExpressAPI: Check Rate Limiter (Redis/Memory) end ExpressAPI->>MongoDB: Fetch User Profile & Preferences MongoDB-->>ExpressAPI: User Context ExpressAPI->>ExpressAPI: Construct Engineered Prompt rect rgb(255, 240, 245) Note over ExpressAPI, GoogleAI: AI Generation Phase ExpressAPI->>GoogleAI: Generate Content Request GoogleAI-->>ExpressAPI: Stream AI Response / JSON Payload end ExpressAPI->>ExpressAPI: Post-process & Format Markdown ExpressAPI->>MongoDB: Async Log Query & Response (Analytics) ExpressAPI-->>ReactUI: Return HTTP 200 { response, metadata } ReactUI->>User: Renders Markdown Response & Updates Chat History
Data Flow Architecture
Data flows synchronously for user operations and asynchronously for analytics. When a user interacts with a course, the primary read/write operation happens immediately, while a background worker queue handles updating analytics aggregations to prevent blocking the main thread.
๐ Folder Structure
The repository is structured as a monolithic repository (monorepo), containing both the React frontend client and the Node.js backend server. This ensures that frontend and backend developers can easily reference shared types and configurations.
Frontend Hierarchy
LANG: textScholarAI-LearningPlatform/ โโโ public/ # Static assets served directly without Webpack/Vite processing โ โโโ LOGO .png # Application Favicon/Logo โ โโโ robots.txt # SEO configuration โโโ src/ # Primary frontend source code โ โโโ assets/ # Images, fonts, and global CSS โ โโโ components/ # Reusable React components โ โ โโโ common/ # Buttons, Inputs, Modals โ โ โโโ layout/ # Header, Sidebar, Footer โ โ โโโ charts/ # Recharts implementations โ โ โโโ ai/ # Chat interfaces, prompt boxes โ โโโ hooks/ # Custom React hooks (useAuth, useAI) โ โโโ context/ # React Context providers (Theme, Auth) โ โโโ pages/ # Top-level route components (Dashboard, Login) โ โโโ documents/ # Static or generated documents โ โโโ services/ # API client services (axios instances) โ โโโ utils/ # Helper functions (date formatting, text processing) โ โโโ App.tsx # Main application component & router configuration โ โโโ index.tsx # React mounting point โ โโโ initialData.ts # Mock data for initial loading/development โ โโโ constants.ts # Global frontend constants (API URLs, theme colors) โ โโโ types.ts # Shared TypeScript interfaces
Backend Hierarchy
LANG: textโโโ server/ # Primary backend source code โ โโโ config/ # Environment variable configuration and DB connections โ โโโ controllers/ # Request handlers (business logic layer) โ โ โโโ authController.js โ โ โโโ aiController.js โ โ โโโ userController.js โ โโโ middlewares/ # Express custom middlewares โ โ โโโ auth.js # JWT verification โ โ โโโ errorHandler.js # Global error catching โ โ โโโ rateLimiter.js # API abuse prevention โ โโโ models/ # Mongoose schemas and model definitions โ โ โโโ User.js โ โ โโโ Course.js โ โ โโโ Analytics.js โ โโโ routes/ # Express API route definitions โ โ โโโ authRoutes.js โ โ โโโ aiRoutes.js โ โ โโโ index.js # Route aggregator โ โโโ services/ # Third-party integrations (GenAI wrappers) โ โโโ utils/ # Server-side helpers (password hashing, loggers) โ โโโ index.js # Express server entry point and setup โโโ .gitignore # Git ignored files definition โโโ LICENSE # MIT License file โโโ package.json # Project metadata, dependencies, and NPM scripts โโโ tsconfig.json # TypeScript configuration for the frontend โโโ vite.config.ts # Vite build tool configuration
๐ Core Features & Modules
Intelligent AI Tutoring Module
Powered by @google/genai, this module is the crown jewel of the platform. It provides conversational AI capabilities specifically tailored for academic subjects.
- Context-Aware Dialogues: The AI remembers the context of the current session, allowing for follow-up questions.
- Mathematical Rendering: Seamlessly renders complex LaTeX equations using frontend integration.
- Code Sandbox Integration: Provides syntax-highlighted code snippets for computer science topics.
- Prompt Guardrails: Backend constraints ensure the AI remains focused on educational content and refuses inappropriate queries.
Analytics Dashboard
Utilizing recharts, the dashboard provides beautiful, responsive, real-time visualizations of student progress.
- Time Tracking: Monitors active time spent on individual modules.
- Performance Metrics: Visualizes quiz scores over time using line and bar charts.
- Subject Mastery Radar: Uses radar charts to display a student's proficiency across different disciplines.
Adaptive Assessment Engine
Traditional quizzes are static. Our Adaptive Assessment Engine uses AI to dynamically generate quizzes based on the user's past performance.
- Dynamic Difficulty: If a user excels, subsequent questions become more challenging, optimizing the learning curve and preventing boredom.
- Automated Grading: Instantaneous feedback with detailed explanations generated by the AI for incorrect answers.
Document Management System
A secure repository for course materials, assignments, and AI-generated study guides.
- Smart Summarization: Users can upload PDFs or text documents, and the AI will generate concise summaries and key takeaways.
- Version Control: Tracks revisions of student-submitted assignments.
๐ API Documentation
Our RESTful API is designed with predictable, resource-oriented URLs. All requests and responses utilize JSON formats. HTTP response codes are used to indicate API status.
Base URL Definition
All API routes are prefixed with /api/v1
Example: http://localhost:3000/api/v1/users/profile
Authentication Protocols
All protected routes require a Bearer Token in the Authorization header.
LANG: httpAuthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5c...
Authentication Endpoints
1. User Registration
- URL:
/api/v1/auth/register - Method:
POST - Description: Creates a new user account.
- Request Body:
LANG: json
{ "email": "student@university.edu", "password": "SecurePassword123!", "firstName": "John", "lastName": "Doe" } - Success Response:
201 CreatedLANG: json{ "message": "User registered successfully", "token": "eyJhb...", "user": { "id": "123", "email": "student@university.edu" } }
2. User Login
- URL:
/api/v1/auth/login - Method:
POST - Description: Authenticates a user and returns a JWT.
- Request Body:
LANG: json
{ "email": "student@university.edu", "password": "SecurePassword123!" } - Success Response:
200 OK
AI Service Endpoints
1. Generate Tutor Response
- URL:
/api/v1/ai/query - Method:
POST - Description: Sends a query to the Google GenAI tutor.
- Headers:
Authorization: Bearer <token> - Request Body:
LANG: json
{ "query": "Explain the concept of specific heat capacity.", "subject": "Physics", "historyContext": [] } - Success Response:
200 OKLANG: json{ "status": "success", "data": { "response": "Specific heat capacity is the amount of heat energy required to raise the temperature of a substance per unit of mass...", "tokensUsed": 156, "processingTimeMs": 850 } }
2. Generate Document Summary
- URL:
/api/v1/ai/summarize - Method:
POST - Description: Summarizes large blocks of text.
- Headers:
Authorization: Bearer <token> - Request Body:
LANG: json
{ "text": "Extremely long academic paper text...", "lengthOptions": "short" } - Success Response:
200 OK
Analytics Endpoints
1. Get Dashboard Metrics
- URL:
/api/v1/analytics/dashboard - Method:
GET - Description: Retrieves aggregated metrics for the frontend charts.
- Headers:
Authorization: Bearer <token> - Success Response:
200 OKLANG: json{ "totalHoursStudied": 42.5, "quizzesCompleted": 15, "averageScore": 88.5, "weeklyActivity": [ { "day": "Mon", "hours": 2 }, { "day": "Tue", "hours": 3.5 } ] }
๐๏ธ Database Schema Definition
ScholarAI utilizes MongoDB for its flexible document-based structure, which is ideal for storing varied analytical data and JSON-like AI responses.
User Models
LANG: javascript// Server/models/User.js const userSchema = new mongoose.Schema({ email: { type: String, required: true, unique: true, index: true, lowercase: true, trim: true }, passwordHash: { type: String, required: true }, role: { type: String, enum: ['STUDENT', 'EDUCATOR', 'ADMIN'], default: 'STUDENT' }, profile: { firstName: String, lastName: String, avatarUrl: String, institution: String }, preferences: { theme: { type: String, default: 'light' }, notificationsEnabled: { type: Boolean, default: true } } }, { timestamps: true });
Analytics Event Models
To handle high volumes of analytics tracking, we use a separate collection optimized for time-series data.
LANG: javascript// Server/models/Analytics.js const analyticsSchema = new mongoose.Schema({ userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true, index: true }, eventType: { type: String, enum: ['LOGIN', 'COURSE_VIEW', 'QUIZ_SUBMIT', 'AI_QUERY', 'LOGOUT'], required: true }, metadata: { type: mongoose.Schema.Types.Mixed, // Flexible payload (e.g., quiz score, course ID) }, timestamp: { type: Date, default: Date.now, index: true // Crucial for querying by date ranges } }); // Compound index for optimizing dashboard queries analyticsSchema.index({ userId: 1, timestamp: -1 });
AI Interaction Log Models
LANG: javascript// Server/models/AILog.js const aiLogSchema = new mongoose.Schema({ userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }, prompt: { type: String, required: true }, responseLength: { type: Number }, tokensConsumed: { type: Number }, latencyMs: { type: Number } }, { timestamps: true });
๐ข Deployment Guide
This project is designed to be cloud-agnostic and can be deployed via standard Node.js environments or containerized setups.
Prerequisites
Before you begin, ensure you have the following installed:
- Node.js: v18.x or higher (LTS recommended)
- MongoDB: v5.0 or higher (Local installation or MongoDB Atlas cluster)
- Git: Version control system
- Google GenAI API Key: Obtainable from Google Cloud Console.
Local Development Setup
-
Clone the repository:
LANG: bashgit clone https://github.com/YourOrg/ScholarAI-LearningPlatform.git cd ScholarAI-LearningPlatform -
Install dependencies: Because this acts as a monorepo, you must install dependencies in the root directory.
LANG: bashnpm install -
Environment Configuration: Copy the example environment file and populate it with your credentials.
LANG: bashcp .env.example .envEdit
.env:LANG: env# Server Configuration PORT=3000 NODE_ENV=development # Database Configuration MONGODB_URI=mongodb://localhost:27017/scholarai_dev # Security & Authentication JWT_SECRET=super_secret_key_change_in_production JWT_EXPIRES_IN=7d # External APIs GOOGLE_GENAI_API_KEY=your_google_genai_api_key_here -
Start the development servers: We use concurrently to run Vite and Express simultaneously.
LANG: bashnpm run dev- Frontend will be accessible at:
http://localhost:5173 - Backend API will be running at:
http://localhost:3000
- Frontend will be accessible at:
Docker Deployment
For standardized environments, Docker is highly recommended.
-
Build the Docker images: Ensure you have a
Dockerfileanddocker-compose.ymlconfigured.LANG: bashdocker-compose build -
Run the containers:
LANG: bashdocker-compose up -dThis will spin up the Node.js application container alongside a MongoDB container.
AWS Cloud Deployment
To deploy on AWS EC2 or Elastic Beanstalk:
-
Build the production frontend:
LANG: bashnpm run buildThis generates the
/distdirectory. -
Configure Nginx (Reverse Proxy): Set up Nginx to serve the static files in
/diston port 80/443 and proxy/api/*requests to your Node process running on port 3000.LANG: nginxserver { listen 80; server_name scholarai.yourdomain.com; location / { root /var/www/ScholarAI/dist; try_files $uri /index.html; } location /api/ { proxy_pass http://localhost:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } } -
Process Management: Use PM2 to keep the Node.js server alive in production.
LANG: bashnpm install -g pm2 pm2 start server/index.js --name "scholarai-api" pm2 startup pm2 save
โ๏ธ Configuration Management
The application behavior can be heavily customized through environment variables. Never commit your .env file to version control.
| Variable Name | Description | Default Value | Required | Environment |
|---|---|---|---|---|
NODE_ENV | Environment context | development | No | All |
PORT | The port the Express server listens on | 3000 | No | All |
MONGODB_URI | Connection string for MongoDB | mongodb://localhost/db | Yes | All |
GOOGLE_GENAI_API_KEY | API key for Google's Generative AI | - | Yes | All |
JWT_SECRET | Cryptographic key for signing tokens | - | Yes | Prod |
JWT_EXPIRES_IN | Token lifespan (e.g., '1h', '7d') | 24h | No | All |
CORS_ORIGIN | Allowed origins for cross-origin requests | http://localhost:5173 | Yes | Prod |
LOG_LEVEL | Winston logging level | info | No | All |
๐ Security & Privacy Standards
Security is paramount in an educational platform handling sensitive student data and intellectual property.
Data Encryption
- Data at Rest: When utilizing MongoDB Atlas, data is encrypted transparently using AES-256. For local deployments, volume-level encryption is recommended.
- Data in Transit: Production deployments must enforce HTTPS (TLS 1.2 or 1.3). The Express app enforces
Strict-Transport-Securityheaders via Helmet.js. - Password Storage: Passwords are never logged or stored. They are hashed using
bcryptjswith a salt round of 12 before being saved to the database.
Authentication Matrix
We utilize JSON Web Tokens (JWT) for stateless, secure authentication.
- Tokens are signed with a strong cryptographic key (
JWT_SECRET). - Tokens contain a payload defining the user's ID and Role.
- The
authMiddlewareintercepts API requests, verifies the signature, and attaches theuserobject to the Expressreqpipeline.
Threat Mitigation
- NoSQL Injection: Mongoose schemas strictly define data types, inherently protecting against injection attacks. Additional sanitization libraries like
express-mongo-sanitizeare utilized. - Cross-Site Scripting (XSS): React inherently protects against XSS by escaping values embedded in JSX. On the backend, we use
xss-cleanmiddleware. - Cross-Site Request Forgery (CSRF): Utilizing Authorization headers (Bearer tokens) instead of cookies mitigates standard CSRF vulnerabilities.
- Denial of Service (DoS):
express-rate-limitis configured globally, with stricter limits on the/api/authand/api/aiendpoints to prevent brute forcing and API abuse.
๐ Scalability Considerations
As ScholarAI grows from hundreds to thousands of concurrent users, the architecture is designed to scale horizontally:
- Stateless Backend Design: The Express.js backend relies on JWTs for session management, meaning no server-side sessions are stored. This allows us to spin up multiple instances of the Node server behind an AWS Application Load Balancer without worrying about sticky sessions.
- Database Sharding & Replication: MongoDB's replica sets ensure high availability. As data volume exceeds single-node capacity, we plan to implement sharding based on
institutionId. - Caching Layer Implementation: We have architected the service layer to easily accept a Redis caching integration. Frequently accessed data (course metadata, leaderboard stats) will be cached to drastically reduce database read operations.
- CDN Integration: Static assets (JavaScript bundles, CSS, images) generated by Vite will be served via a Content Delivery Network (CDN) like Cloudflare or AWS CloudFront to ensure global low-latency access.
๐งช Testing Documentation
Quality assurance is deeply integrated into our CI/CD pipeline. Code cannot be merged into the main branch without passing all test suites.
Unit Testing Strategy
We use Jest for unit testing backend controllers, utility functions, and complex frontend logic.
LANG: bashnpm run test:unit
Our goal is to maintain >85% code coverage for business logic services. We mock external dependencies like the Google GenAI SDK and MongoDB to ensure tests run rapidly and deterministically.
Integration Testing
Supertest is used in conjunction with Jest to test Express routes without spinning up the network layer. We test the flow from the router -> middleware -> controller -> in-memory database.
LANG: bashnpm run test:integration
End-to-End Testing
Critical user flows are tested from the browser perspective using Cypress.
LANG: bashnpm run test:e2e
Key flows tested include:
- User Registration -> Login -> Dashboard Navigation
- Navigating to a Course -> Taking a Quiz -> Viewing Results
- Querying the AI Tutor -> Receiving a successful markdown response
๐ Troubleshooting Guide
Common Issues and Resolutions
1. Vite Development Server Fails to Start
- Symptom:
Error: listen EADDRINUSE: address already in use 127.0.0.1:5173 - Resolution: The port is occupied by another process. You can kill the process or start Vite on a different port using
npm run dev -- --port 3001.
2. Database Connection Refused
- Symptom:
MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017 - Resolution: Ensure your MongoDB daemon (
mongod) is running locally. If using Docker, ensure themongodbcontainer is in anUpstate. Double-check yourMONGODB_URIenvironment variable.
3. AI Features return 401 Unauthorized or 403 Forbidden
- Symptom: The frontend shows a toast error saying AI is unavailable.
- Resolution: Check your backend logs. This almost always indicates an invalid
GOOGLE_GENAI_API_KEYor that your API key lacks billing/permissions enabled on the Google Cloud Console.
4. CORS Errors in Browser Console
- Symptom:
Access to fetch at 'http://localhost:3000/api/...' from origin 'http://localhost:5173' has been blocked by CORS policy - Resolution: Ensure the backend Express server has the
cors()middleware configured correctly to accept requests from your frontend origin. Check theCORS_ORIGINenv variable.
โก Performance Optimization
We have taken several steps to ensure the application remains highly performant:
- Code Splitting: Vite automatically code-splits the React application, ensuring users only download the JavaScript necessary for the route they are visiting.
- Image Optimization: All static assets are compressed.
- Database Projections: Mongoose queries utilize projections (e.g.,
User.findOne({ email }).select('name email')) to prevent pulling massive documents into Node's memory when only a few fields are needed. - Debouncing: Search inputs and AI prompt inputs utilize custom debounce hooks to prevent spamming the backend API on every keystroke.
๐ป System Requirements
To run the ScholarAI Learning Platform source code, your machine should meet the following minimum requirements:
- OS: Windows 10/11, macOS 11+, or modern Linux distribution (Ubuntu 20.04+).
- CPU: Multi-core processor (Intel i5/AMD Ryzen 5 or better recommended).
- RAM: Minimum 8GB (16GB recommended for running Docker, Node, and IDE simultaneously).
- Disk Space: At least 1GB of free space for dependencies and MongoDB data files.
๐ค Contributing Guidelines
We actively welcome pull requests from the community. To contribute to ScholarAI:
- Fork the repository on GitHub.
- Clone your fork locally.
- Create a new branch for your feature or bugfix (
git checkout -b feature/amazing-new-feature). - Write your code ensuring you follow our ESLint rules (
npm run lint). - Write tests for your new functionality.
- Commit your changes using conventional commit messages (
git commit -m "feat: add amazing new feature"). - Push to your fork (
git push origin feature/amazing-new-feature). - Submit a Pull Request against the
mainbranch of our repository.
Please ensure your PR description clearly details the changes and any testing instructions.
๐ Code of Conduct
Our team is dedicated to providing a harassment-free experience for everyone, regardless of gender, gender identity and expression, sexual orientation, disability, physical appearance, body size, age, race, or religion. We do not tolerate harassment of participants in any form.
By participating in this project, you agree to abide by our Code of Conduct. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team.
๐ฅ Contributors
This project is actively maintained and developed by the ScholarAI Team. We would like to thank everyone who has contributed code, reported bugs, or suggested features.
| Name | Role | Core Focus | GitHub |
|---|---|---|---|
| Godfrey | Lead Architect / Backend | API Gateway, Mongoose Models, Deployment | @godfrey |
| Grish Narayanan S | Frontend Lead / UI/UX | React Architecture, Vite Build, Recharts | @grish |
| Girijesh | Database / Security | Schema Design, Validation, Express Security | @girijesh |
| Harihar | AI Integration / QA | GenAI Prompts, System Testing, Quality Control | @harihar |
๐ Acknowledgments
Building a project of this scale relies heavily on the giants whose shoulders we stand upon. We extend our deepest gratitude to:
- Google DeepMind: For providing access to the powerful Generative AI SDK, enabling the core functionality of our tutoring system.
- The Open Source Community: For the incredible tools (React, Express, Vite, MongoDB, Tailwind, Recharts) that make modern web development an absolute joy.
- Our University & Mentors: For the guidance, infrastructure, and pedagogical insights provided during this semester project.
- StackOverflow & GitHub Discussions: For the countless times a bizarre error message was resolved by an obscure forum post from 2018.
โ FAQs
Q: Is this platform free to use and host? A: Yes, this repository is 100% open-source under the MIT license. You can clone and host it yourself. However, you will need your own API keys for the Google GenAI services, which may incur costs depending on your usage and quotas.
Q: Can I integrate this with an existing LMS like Canvas, Blackboard, or Moodle? A: Currently, ScholarAI functions as a standalone monolithic platform. However, the decoupled REST API architecture makes future LTI (Learning Tools Interoperability) standard integrations highly feasible. We are open to PRs exploring this!
Q: How do I report a bug or request a feature? A: Please use the GitHub Issues tab. Before opening a new issue, search existing issues to see if your bug has already been reported. When reporting a bug, provide detailed steps to reproduce, expected behavior, and your system environment.
Q: Does the AI hallucinate incorrect academic information? A: While LLMs can hallucinate, we have implemented strict system prompts and context injection strategies to minimize this. The AI is instructed to refuse answering if it lacks sufficient confidence in the academic accuracy of the topic. However, students are always encouraged to verify critical information.
Q: How do I change the default theme or branding?
A: Branding colors and logos can be easily swapped. Replace the LOGO .png in the public/ directory. Color palettes and themes are managed centrally in src/constants.ts or your Tailwind configuration file.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
LANG: textMIT License Copyright (c) 2026 ScholarAI Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Version 1.0.0-beta