SYS.ID: THEORIONGD
INNOVATE. BUILD. IMPACT.
BACK TO MASTER CATALOG
SPEC-ID: SCHOLARAI-LEARNINGPLATFORMDOM: [APPLIED DATA & DOMAIN INTELLIGENCE]DEVELOPMENT BUILD

ScholarAI LMS

AI-Enhanced LMS Platform with Adaptive Learning Pathways & Progress Auditing.

TECHNICAL SPECIFICATION SHEETREVISION: 2024
SYSTEM NAME:ScholarAI LMS
VERIFIED MATURITY:DEVELOPMENT BUILD
DEVELOPMENT YEAR:2024
DOMAIN CATEGORY:Applied Data & Domain Intelligence
COLLABORATORS:GRISH-SWIZZ | HARIHAR1406 | Girijesh26
SYSTEM PERFORMANCE PARAMETERS:
Data Store:MongoDB Mongoose Schemas
Analytics:Recharts Adaptive Dashboard
TECH STACK:ReactViteTypeScriptNode.jsExpressMongoDBRecharts
SYSTEM ARCHITECTURE & TECHNICAL OVERVIEW

ARCHITECTURAL SPECIFICATION

Full-stack AI learning management system delivering adaptive education pathways, automated document summary agents, and student performance metrics visualizers built with Recharts and Express.

ORIGINAL REPOSITORY DOCUMENTATION (README)
README DOCUMENT
   _____      _           _               ___  _____ 
  / ____|    | |         | |             / _ \|_   _|
 | (___   ___| |__   ___ | | __ _ _ __  | |_| | | |  
  \___ \ / __| '_ \ / _ \| |/ _` | '__| |  _  | | |  
  ____) | (__| | | | (_) | | (_| | |    | | | |_| |_ 
 |_____/ \___|_| |_|\___/|_|\__,_|_|    \_| |_|_____|
  

ScholarAI Learning Platform

Intelligent Academic Assistant & Learning Management System

Features Architecture Documentation License Build Coverage

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

  1. Executive Summary
  2. Developer Story
  3. Project Information
  4. System Architecture
  5. Folder Structure
  6. Core Features & Modules
  7. API Documentation
  8. Database Schema Definition
  9. Deployment Guide
  10. Configuration Management
  11. Security & Privacy Standards
  12. Scalability Considerations
  13. Testing Documentation
  14. Troubleshooting Guide
  15. Performance Optimization
  16. System Requirements
  17. Contributing Guidelines
  18. Code of Conduct
  19. Contributors
  20. Acknowledgments
  21. FAQs
  22. 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:

  1. 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.
  2. Real-time Analytics: Implementing efficient data aggregation pipelines in MongoDB to feed the Recharts frontend without compromising database performance was computationally expensive.
  3. 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.
  4. 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

  1. TypeScript is Invaluable: The initial overhead of defining types paid massive dividends in reducing runtime errors and improving code maintainability. Refactoring became significantly safer.
  2. 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.
  3. 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

CategoryDetails
Project NameScholarAI-LearningPlatform
TaglineThe Intelligent Academic Assistant & Learning Management System
Project TypeWeb Application / SaaS Platform / AI System
Industry DomainEdTech (Educational Technology)
Target AudienceStudents, Educators, Academic Institutions
Primary PurposeTo provide an AI-driven, adaptive learning environment with real-time analytics.
Team MembersGodfrey, Grish Narayanan S, Girijesh, Harihar
StatusActive Development / Beta
LicenseMIT 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/genai v1.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: mermaid
graph 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: mermaid
graph 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: mermaid
sequenceDiagram
    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: text
ScholarAI-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: http
Authorization: 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 Created
    LANG: 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 OK
    LANG: 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 OK
    LANG: 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

  1. Clone the repository:

    LANG: bash
    git clone https://github.com/YourOrg/ScholarAI-LearningPlatform.git
    cd ScholarAI-LearningPlatform
    
  2. Install dependencies: Because this acts as a monorepo, you must install dependencies in the root directory.

    LANG: bash
    npm install
    
  3. Environment Configuration: Copy the example environment file and populate it with your credentials.

    LANG: bash
    cp .env.example .env
    

    Edit .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
    
  4. Start the development servers: We use concurrently to run Vite and Express simultaneously.

    LANG: bash
    npm run dev
    
    • Frontend will be accessible at: http://localhost:5173
    • Backend API will be running at: http://localhost:3000

Docker Deployment

For standardized environments, Docker is highly recommended.

  1. Build the Docker images: Ensure you have a Dockerfile and docker-compose.yml configured.

    LANG: bash
    docker-compose build
    
  2. Run the containers:

    LANG: bash
    docker-compose up -d
    

    This will spin up the Node.js application container alongside a MongoDB container.

AWS Cloud Deployment

To deploy on AWS EC2 or Elastic Beanstalk:

  1. Build the production frontend:

    LANG: bash
    npm run build
    

    This generates the /dist directory.

  2. Configure Nginx (Reverse Proxy): Set up Nginx to serve the static files in /dist on port 80/443 and proxy /api/* requests to your Node process running on port 3000.

    LANG: nginx
    server {
        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;
        }
    }
    
  3. Process Management: Use PM2 to keep the Node.js server alive in production.

    LANG: bash
    npm 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 NameDescriptionDefault ValueRequiredEnvironment
NODE_ENVEnvironment contextdevelopmentNoAll
PORTThe port the Express server listens on3000NoAll
MONGODB_URIConnection string for MongoDBmongodb://localhost/dbYesAll
GOOGLE_GENAI_API_KEYAPI key for Google's Generative AI-YesAll
JWT_SECRETCryptographic key for signing tokens-YesProd
JWT_EXPIRES_INToken lifespan (e.g., '1h', '7d')24hNoAll
CORS_ORIGINAllowed origins for cross-origin requestshttp://localhost:5173YesProd
LOG_LEVELWinston logging levelinfoNoAll

๐Ÿ”’ 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-Security headers via Helmet.js.
  • Password Storage: Passwords are never logged or stored. They are hashed using bcryptjs with 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 authMiddleware intercepts API requests, verifies the signature, and attaches the user object to the Express req pipeline.

Threat Mitigation

  1. NoSQL Injection: Mongoose schemas strictly define data types, inherently protecting against injection attacks. Additional sanitization libraries like express-mongo-sanitize are utilized.
  2. Cross-Site Scripting (XSS): React inherently protects against XSS by escaping values embedded in JSX. On the backend, we use xss-clean middleware.
  3. Cross-Site Request Forgery (CSRF): Utilizing Authorization headers (Bearer tokens) instead of cookies mitigates standard CSRF vulnerabilities.
  4. Denial of Service (DoS): express-rate-limit is configured globally, with stricter limits on the /api/auth and /api/ai endpoints 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:

  1. 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.
  2. 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.
  3. 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.
  4. 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: bash
npm 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: bash
npm run test:integration

End-to-End Testing

Critical user flows are tested from the browser perspective using Cypress.

LANG: bash
npm 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 the mongodb container is in an Up state. Double-check your MONGODB_URI environment 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_KEY or 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 the CORS_ORIGIN env 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:

  1. Fork the repository on GitHub.
  2. Clone your fork locally.
  3. Create a new branch for your feature or bugfix (git checkout -b feature/amazing-new-feature).
  4. Write your code ensuring you follow our ESLint rules (npm run lint).
  5. Write tests for your new functionality.
  6. Commit your changes using conventional commit messages (git commit -m "feat: add amazing new feature").
  7. Push to your fork (git push origin feature/amazing-new-feature).
  8. Submit a Pull Request against the main branch 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.

NameRoleCore FocusGitHub
GodfreyLead Architect / BackendAPI Gateway, Mongoose Models, Deployment@godfrey
Grish Narayanan SFrontend Lead / UI/UXReact Architecture, Vite Build, Recharts@grish
GirijeshDatabase / SecuritySchema Design, Validation, Express Security@girijesh
HariharAI Integration / QAGenAI 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: text
MIT 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.

Built with โค๏ธ by the ScholarAI Team. Empowering the future of education, one token at a time.

Version 1.0.0-beta