Skip to content

Cybernerd1/learnova-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 Learnova Backend — AI-Powered Learning Platform API

The backend server for Learnova, built with Node.js and Express.js, providing RESTful APIs, secure authentication, database management, and AI integration powered by Gemini.


🚀 Features

  • 🔐 Secure Authentication: JWT-based authentication with bcryptjs password hashing and HTTP-only cookies
  • 🧠 AI Integration: Gemini API integration for intelligent chat responses and personalized learning recommendations
  • 💾 Database Management: MongoDB with Mongoose ODM for efficient data storage and retrieval
  • ☁️ Cloud Storage: Cloudinary integration for seamless image and file uploads
  • 🍪 Session Management: Secure cookie-based session handling
  • 🛡️ API Security: CORS configuration, input validation, and request sanitization
  • 📡 RESTful Architecture: Clean, modular API design following REST principles
  • 👥 User Management: Complete user profile and account management system
  • 📚 Course System: Full CRUD operations for course management
  • 🎯 Role-Based Access: Admin and user role permissions
  • 📊 Progress Tracking: Student enrollment and learning progress monitoring
  • 🔄 Real-time Updates: Efficient data synchronization between frontend and database

🧱 Tech Stack

  • Runtime: Node.js
  • Framework: Express.js
  • Database: MongoDB (Mongoose ODM)
  • Authentication: JWT, bcryptjs, cookie-parser
  • AI Engine: Gemini API (@google/genai)
  • File Upload: Multer middleware
  • Cloud Storage: Cloudinary SDK
  • Date Utilities: Moment.js
  • Environment Management: dotenv
  • Security: Helmet, CORS

🔗 API Endpoints

Authentication System

  • User Registration: Create new user accounts with email verification
  • User Login: Secure login with JWT token generation
  • User Logout: Session termination and token invalidation
  • Token Verification: Validate and refresh authentication tokens
  • Password Reset: Secure password recovery flow

User Management

  • Profile Retrieval: Fetch user profile information
  • Profile Update: Modify user details and preferences
  • Avatar Upload: Profile picture management
  • Enrollment History: Track user's enrolled courses
  • Learning Progress: Monitor and update course completion status

Course Management

  • Course Listing: Retrieve all available courses with pagination
  • Course Details: Get comprehensive course information
  • Course Creation: Admin-only course publishing
  • Course Updates: Modify existing course content
  • Course Deletion: Remove courses from platform
  • Course Search: Filter and search courses by various criteria
  • Enrollment Management: Handle student course enrollments

AI-Powered Features

  • AI Chat: Interactive conversations for learning assistance
  • Smart Recommendations: Personalized course suggestions based on user history
  • Content Analysis: AI-driven content understanding and explanation
  • Learning Path Generation: Custom learning roadmaps

File Operations

  • Image Upload: Course thumbnails and user avatars
  • Document Handling: Support for various file formats
  • Cloud Storage Management: Efficient media storage and retrieval

🗄️ Database Architecture

User Model

Comprehensive user data including authentication credentials, profile information, role permissions, enrolled courses, learning progress, and account metadata.

Course Model

Complete course information with title, description, instructor details, media assets, pricing, difficulty level, curriculum structure, and engagement metrics.

Enrollment Model

Tracks student-course relationships, progress tracking, completion status, and enrollment timestamps.

Progress Model

Detailed learning analytics including completed lessons, quiz scores, time spent, and achievement tracking.


🔐 Security Features

  • Password Encryption: Bcrypt hashing for secure password storage
  • JWT Authentication: Stateless authentication with secure token generation
  • HTTP-Only Cookies: Protected cookie storage preventing XSS attacks
  • CORS Protection: Configured cross-origin resource sharing
  • Input Validation: Comprehensive request data validation
  • Rate Limiting: API request throttling to prevent abuse
  • SQL Injection Prevention: Mongoose schema validation
  • Environment Security: Sensitive data stored in environment variables

🧠 AI Integration Details

Gemini API Implementation

  • Context-Aware Responses: AI maintains conversation context for relevant answers
  • Educational Focus: Optimized prompts for learning assistance
  • Multi-turn Conversations: Support for extended learning dialogues
  • Smart Recommendations: Course suggestions based on user interests and history
  • Content Generation: AI-assisted course descriptions and summaries

AI Features

  • Real-time chat responses for student queries
  • Personalized learning path suggestions
  • Difficulty assessment for course placement
  • Automated content tagging and categorization
  • Smart search enhancement

📊 Key Functionalities

Authentication Flow

JWT tokens generated on login, stored in HTTP-only cookies, validated on each protected route request, and automatically refreshed for active sessions.

Course Workflow

Admins create and publish courses, users browse and enroll, progress is tracked automatically, and AI provides personalized recommendations.

File Management

Images uploaded through Multer, processed and optimized, stored on Cloudinary, and URLs saved in MongoDB for efficient retrieval.

Error Handling

Centralized error middleware, custom error classes, appropriate HTTP status codes, and detailed error logging for debugging.


🧑‍💻 Author

Developed by CyberNerd

"Where learning meets intelligence."


📜 License

Licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors