Skip to content

Learning Management System with AI features including automatic transcription, translation, note generation, and personalized recommendations.

Notifications You must be signed in to change notification settings

bPavan16/smart-lms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI-Powered Learning Management System (LMS)

A comprehensive Learning Management System with AI features including automatic transcription, translation, note generation, and personalized recommendations.

🚀 Features

  • User Authentication: JWT-based authentication with role-based access control (Student, Teacher, Admin)
  • Course Management: Teachers can create and manage courses
  • Video Upload & Processing:
    • Upload lecture videos (MP4, AVI, MOV, MKV)
    • Automatic transcription using Whisper (local, offline)
    • Automatic caption generation (VTT format)
    • Multi-language translation (Hindi, Kannada) via Gemini
    • Auto-generated summaries and notes
    • Quiz generation from lecture content
  • Exam & Results Management: Upload and view exam results with question-wise analysis
  • AI Recommendations:
    • Student progress analysis and study plans
    • Teacher feedback and teaching effectiveness insights
    • Powered by LangGraph and Gemini
  • Video Player: Watch videos with multi-language captions
  • Dashboard: Personalized dashboards for students and teachers

🛠️ Tech Stack

Backend

  • FastAPI: Python web framework
  • MongoDB: Database with GridFS for file storage
  • Whisper: Speech-to-text transcription (local, offline)
  • Gemini API: Translation, summarization, and AI recommendations
  • LangGraph: AI agent orchestration
  • JWT: Authentication
  • FFmpeg: Video/audio processing

Frontend

  • Next.js 14: React framework
  • TypeScript: Type safety
  • Tailwind CSS: Styling
  • React Player: Video playback
  • Axios: HTTP client

📋 Prerequisites

⚡ Quick Start

Windows Users - One-Click Startup

Simply double-click start_application.bat in the project root. This will:

Note: Make sure MongoDB is running before starting the application.

Manual Setup

1. Backend Setup

cd backend

# Create virtual environment
python -m venv venv

# Activate virtual environment
venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Create .env file (see Configuration section below)
# Create required directories
New-Item -ItemType Directory -Force -Path media, uploads

# Run server
python run.py

Backend will be available at: http://localhost:8000

2. Frontend Setup

cd frontend

# Install dependencies
npm install

# Run development server
npm run dev

Frontend will be available at: http://localhost:3000

⚙️ Configuration

Backend Environment Variables

Create a .env file in the backend/ directory:

MONGODB_URL=mongodb://localhost:27017
DATABASE_NAME=lms_db
JWT_SECRET_KEY=your-secret-key-change-in-production-use-long-random-string
JWT_ALGORITHM=HS256
JWT_ACCESS_TOKEN_EXPIRE_MINUTES=30
GEMINI_API_KEY=your-gemini-api-key-here
BACKEND_URL=http://localhost:8000
CORS_ORIGINS=http://localhost:3000,http://localhost:3001
MEDIA_ROOT=./media
UPLOAD_DIR=./uploads
REDIS_URL=redis://localhost:6379/0

Important:

  • Replace GEMINI_API_KEY with your actual API key from Google AI Studio
  • If using MongoDB Atlas, replace MONGODB_URL with your connection string
  • Generate a strong JWT_SECRET_KEY: python -c "import secrets; print(secrets.token_urlsafe(32))"

Frontend Environment Variables (Optional)

Create .env.local in the frontend/ directory:

NEXT_PUBLIC_API_URL=http://localhost:8000

Note: Default value is already set, so this step is optional.

📦 Installing Prerequisites

Python 3.9+

  1. Download from: https://www.python.org/downloads/
  2. During installation, check "Add Python to PATH"
  3. Verify: python --version

Node.js 18+

  1. Download from: https://nodejs.org/
  2. Install LTS version
  3. Verify: node --version

MongoDB

Option A: MongoDB Community (Local)

  1. Download: https://www.mongodb.com/try/download/community
  2. Install and start MongoDB service
  3. Default connection: mongodb://localhost:27017

Option B: MongoDB Atlas (Cloud - Recommended)

  1. Create free account: https://www.mongodb.com/cloud/atlas
  2. Create a free cluster
  3. Get connection string and update in .env

FFmpeg

Windows - Using Chocolatey:

choco install ffmpeg

Windows - Manual Installation:

  1. Download: https://www.gyan.dev/ffmpeg/builds/
  2. Extract to C:\ffmpeg
  3. Add C:\ffmpeg\bin to System PATH
  4. Restart terminal
  5. Verify: ffmpeg -version

Linux:

sudo apt-get update
sudo apt-get install ffmpeg

Mac:

brew install ffmpeg

Gemini API Key

  1. Visit: https://makersuite.google.com/app/apikey
  2. Sign in with Google account
  3. Click "Create API Key"
  4. Copy and paste into .env as GEMINI_API_KEY

📁 Project Structure

smart-lms/
├── backend/
│   ├── app/
│   │   ├── core/           # Configuration and security
│   │   ├── models/         # Pydantic models
│   │   ├── routers/        # API endpoints
│   │   ├── services/       # Business logic (Whisper, Gemini, LangGraph)
│   │   ├── database.py     # MongoDB connection
│   │   └── main.py         # FastAPI app
│   ├── requirements.txt
│   ├── run.py
│   ├── start_server.bat    # Backend startup script
│   └── .env
│
├── frontend/
│   ├── app/                # Next.js pages and routes
│   ├── components/         # React components
│   ├── lib/                # API client and utilities
│   ├── package.json
│   └── .env.local
│
├── start_application.bat   # Unified startup script
└── README.md

🎯 Usage

1. Register/Login

  • Visit http://localhost:3000
  • Register as a Student, Teacher, or Admin
  • Login with your credentials

2. For Teachers

  • Create a course
  • Upload lecture videos
  • Wait for processing (transcription, translation, notes generation - typically 5-6 minutes)
  • Upload exam results
  • View AI-generated teaching feedback

3. For Students

  • Browse and enroll in courses
  • Watch videos with captions (multiple languages)
  • View transcripts and notes
  • Take auto-generated quizzes
  • View exam results
  • Get AI-generated study plans

🔌 API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login
  • GET /api/auth/me - Get current user

Courses

  • GET /api/courses - List courses
  • POST /api/courses - Create course (teacher)
  • GET /api/courses/{id} - Get course details
  • POST /api/courses/{id}/enroll - Enroll in course (student)

Videos

  • GET /api/videos - List videos
  • POST /api/videos - Upload video (teacher)
  • GET /api/videos/{id} - Get video details
  • GET /api/videos/{id}/stream - Stream video
  • GET /api/videos/{id}/captions/{language} - Get captions

Exams

  • GET /api/exams - List exams
  • POST /api/exams - Create exam (teacher)
  • GET /api/exams/{id} - Get exam details

Recommendations

  • GET /api/recommendations - Get recommendations
  • GET /api/recommendations/student/{id}/generate - Generate student recommendations
  • GET /api/recommendations/teacher/{id}/generate - Generate teacher feedback

API Documentation: Visit http://localhost:8000/docs for interactive Swagger UI

🐛 Troubleshooting

Backend Issues

"python is not recognized"

  • Reinstall Python with "Add to PATH" checked
  • Or manually add Python to System PATH

"venv\Scripts\Activate.ps1 cannot be loaded"

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

"MongoDB connection failed"

  • Check if MongoDB service is running: Get-Service MongoDB
  • Start service: Start-Service MongoDB (as Administrator)
  • Check connection string in .env file
  • For Atlas: Check IP whitelist and connection string

"FFmpeg not found"

  • Verify FFmpeg is in PATH: ffmpeg -version
  • Add FFmpeg bin folder to PATH
  • Restart terminal after adding to PATH

"Port 8000 already in use"

  • Close other applications using port 8000
  • Or change port in run.py

"ModuleNotFoundError" or import errors

# Make sure virtual environment is activated
# Reinstall dependencies
pip install -r requirements.txt --force-reinstall

"GEMINI_API_KEY not set"

  • Ensure .env file exists in backend/ directory
  • Verify GEMINI_API_KEY is set in .env
  • Restart backend server after updating .env

Frontend Issues

Port 3000 already in use

npm run dev -- -p 3001

API Connection Issues

  • Ensure backend is running on http://localhost:8000
  • Check CORS settings in backend .env
  • Verify NEXT_PUBLIC_API_URL in .env.local

Build Errors

# Clear Next.js cache
Remove-Item -Recurse -Force .next
npm run build

Video Processing Issues

Video processing fails

  • Ensure FFmpeg is installed: ffmpeg -version
  • Check disk space for uploads
  • Verify Gemini API key is valid
  • Check backend logs for detailed error messages

Processing takes too long

  • Video processing typically takes 5-6 minutes per video
  • Processing happens in background - you can continue using the app
  • Check backend logs for progress updates

📝 Notes

  • Whisper model runs locally - first run will download the model (~150MB for base model)
  • Video processing happens asynchronously in the background
  • Ensure sufficient disk space for video uploads
  • Gemini API key is required for translation and AI features
  • MongoDB should be running before starting the backend
  • The application uses optimized full-text translation for faster processing

🚀 Development

Running Tests

# Backend
cd backend
pytest

# Frontend
cd frontend
npm test

Building for Production

# Frontend
cd frontend
npm run build
npm start

# Backend
cd backend
uvicorn app.main:app --host 0.0.0.0 --port 8000

📄 License

MIT

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📞 Support

For issues and questions:

  • Check the troubleshooting section above
  • Review API documentation at http://localhost:8000/docs
  • Check backend logs for detailed error messages

Happy Learning! 🎓

About

Learning Management System with AI features including automatic transcription, translation, note generation, and personalized recommendations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published